Kodi/XBMC light control - a (relatively) simple how-to

Another way to approach the ability to dim lights could be using the Big Switch app that would trigger Hello, Home phrases.

  1. Create a virtual on/off switch in the IDE

  2. Install the following SmartApp

 definition(
        	name: "The Big Switch HHE",
        	namespace: "smartthings",
        	author: "Ben Goodman",
        	description: "Executes a Hello Home Phrase based on the state of a specific switch.",
        	category: "Convenience",
        	iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/light_outlet.png",
        	iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/light_outlet@2x.png"
        )
        preferences {
        	page(name: "selectPhrases")
        }
        def selectPhrases() {
        	def configured = (settings.HHPhraseOff && settings.HHPhraseOn)
            dynamicPage(name: "selectPhrases", title: "Configure", nextPage:"Settings", uninstall: true) {		
        		section("When this switch is turned on or off") {
        			input "master", "capability.switch", title: "Where?"
        		}
        		section("Run These Hello Home Phrases When...") {
        			log.trace phrases
        			input "HHPhraseOn", "enum", title: "The Switch Turns On", required: true, options: phrases, refreshAfterSelection:true
        			input "HHPhraseOff", "enum", title: "The Switch Turns Off", required: true, options: phrases, refreshAfterSelection:true
        		}
        		}
            }
        }
        def installed(){
        subscribe(master, "switch.on", onHandler)
        subscribe(master, "switch.off", offHandler)
        }
        def updated(){
        unsubscribe()
        subscribe(master, "switch.on", onHandler)
        subscribe(master, "switch.off", offHandler)
        }
        def onHandler(evt) {
        log.debug evt.value
        log.info("Running Light On Event")
        location.helloHome.execute(settings.HHPhraseOn)
        }
        def offHandler(evt) {
        log.debug evt.value
        log.info("Running Light Off Event")
        location.helloHome.execute(settings.HHPhraseOff)
        }

.3. Create a new mode called “Movie Mode” in the mobile app

.4. Create Hello, Home phrase(s) that would be triggered by the SmartApp when XBMC/Kodi starting Playing/Pause/Stop

So when this is all setup it will do the following:

When a movie starts playing in Kodi, the virtual switch will turn on. When the virtual switch turns on, then a Hello, Home phrase will be invoked. The Hello, Home phrase will handle the dimming of the lights and will also put you into “Movie Mode”.

When a movie is stopped in Kodi, the virtual switch will turn off. When the virtual switch turns off, then a Hello, Home phrase will be invoked. The Hello, Home phrase will handle the bring you back into “Home Mode” or whatever other mode you prefer.

You could then setup additional smartapps that would handle dimming levels and restrict them to running only when the mode is Movie Mode.

3 Likes