Toggling Power in a Control Page

Posted on
Fri Jun 05, 2015 12:51 pm
gskarp offline
Posts: 117
Joined: Apr 19, 2012

Toggling Power in a Control Page

Not sure how you do this. I want to toggle power on my Onkyo with one button. I figure I would need to use a python script:

if indigo.devices[OnkyoReceiver].states['isPoweredOn'] is True:
indigo.devices[OnkyoReceiver].setpoweredmode['Off']

else:
indigo.devices[OnkyoReceiver].setpoweredmode['On']


This obviously doesn't work. How would I do something like this? Is there a Python guide for the plugin?

Posted on
Sun Jul 03, 2016 9:43 pm
Brady offline
Posts: 57
Joined: May 25, 2016

Re: Toggling Power in a Control Page

I know this was over a year ago... but in case anybody else comes here searching as I did I've provided my solution below. Works perfect.

Code: Select all
onkyoPlug = indigo.server.getPlugin("com.duncanware.onkyoNetworkRemote")
receiver = 1672597690 # "Receiver"
powerState   = indigo.devices[1672597690].states["isPoweredOn"]


if powerState == True:
   indigo.server.log("Turning receiver OFF")
   onkyoPlug.executeAction("setPowerStatus", receiver, props={"powerCommand":"00"})
else:
   indigo.server.log("Turning receiver ON")
   onkyoPlug.executeAction("setPowerStatus", receiver, props={"powerCommand":"01"})

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest