While one can also display the active source state as a word on a control page, one can only access the "source" in the control page device state menu when the source is active.
Also, it seems the zones need direct on/off commands, as toggle is not supported. And the command may throw an error, but it works.
I have a Sonos Port, and would like to be able to turn it on, play/pause and select sources. Right now those options don't seem available. But, "Sonos://" does open the app so it can be started manually.
Code: Select all
import indigo
var = indigo.variables[493724294] # "Radio_Wake_Up_Sonos"
VolSet = var.getValue(int)
indigo.device.turnOn(1737882882) #Kitchen
indigo.device.turnOn(641672610) #Family Room
indigo.device.turnOn(1541557677) #Study Hallway
indigo.device.turnOn(1493860653) #LivRm DinRm
#indigo.device.turnOn(1644872590) #Game Rm
indigo.device.turnOn(536358103) #MBR
indigo.dimmer.setBrightness(1737882882, value=VolSet)
indigo.dimmer.setBrightness(641672610, value=VolSet)
indigo.dimmer.setBrightness(1541557677, value=VolSet)
indigo.dimmer.setBrightness(1493860653, value=VolSet)
indigo.dimmer.setBrightness(536358103, value=VolSet)
HAPlugin = indigo.server.getPlugin("no.homeassistant.plugin")
if not HAPlugin.isEnabled():
indigo.server.log("HomeAssistant Agent plugin not enabled")
exit(0)
indigo.server.log("Setting source to Sonos")
HAPlugin.executeAction("media_play_set_source", deviceId=1737882882, props={'media_source': "Sonos"})
HAPlugin.executeAction("media_play_set_source", deviceId=641672610, props={'media_source': "Sonos"})
HAPlugin.executeAction("media_play_set_source", deviceId=1541557677, props={'media_source': "Sonos"})
HAPlugin.executeAction("media_play_set_source", deviceId=1493860653, props={'media_source': "Sonos"})
HAPlugin.executeAction("media_play_set_source", deviceId=536358103, props={'media_source': "Sonos"})
Code: Select all
Error device "06 Patio" state key source not defined
Error device "06 Patio" state key source not defined
Error device "06 Patio" state key source not defined
Error device "06 Patio" state key source not defined
Error device "07 Pool House" state key source not defined
Error device "07 Pool House" state key source not defined
Error device "05 Game Rm" state key source not defined
Error device "05 Game Rm" state key source not defined
Error device "01 Kitchen" state key source not defined
Error device "01 Kitchen" state key source not defined
Error device "01 Kitchen" state key source not defined