Hi,
I am trying to access the TRV devices through Python, and then do some stuff with the Boost. How do I get a directory of methods and properties that I could access?
Specifically, I would like to assess whether Boost is ON or OFF, and I'd like to be able to turn it on and off. The default boost mode is good enough.
I am just starting with Python and am probably missing a very simple way of getting those lists...
Thanks!
(Probably) dumb python question
- Stoutjesdijk
- Posts: 135
- Joined: Sun Dec 21, 2014 4:11 pm
- Location: The Netherlands
(Probably) dumb python question
Best regards,
Mark
Trying to tie it all together...
| Indigo | Plex | NAD M33 | Unifi | LG WebOS | Tado | Sonos | SolarEdge | HUE |
Mark
Trying to tie it all together...
| Indigo | Plex | NAD M33 | Unifi | LG WebOS | Tado | Sonos | SolarEdge | HUE |
- FlyingDiver
- Posts: 7830
- Joined: Sat Jun 07, 2014 10:36 am
- Location: Southwest Florida, USA
Re: (Probably) dumb python question
To get the states of the device that you can access, you need to expose the state list below the standard UI. To do that, drag UP on the dimple at the top of the device details pane:
There are standard methods in the Wiki for each of the standard Indigo device types (sensor, relay, thermostat, etc). If the plugin defines custom actions, either they'll be in the documentation for the plugin, or if you're brave you can look at the Actions.xml file in the plugin wrapper and figure it out from there.
There are standard methods in the Wiki for each of the standard Indigo device types (sensor, relay, thermostat, etc). If the plugin defines custom actions, either they'll be in the documentation for the plugin, or if you're brave you can look at the Actions.xml file in the plugin wrapper and figure it out from there.
joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
my plugins: http://forums.indigodomo.com/viewforum.php?f=177
Re: (Probably) dumb python question
Hi Mark,
The documentation is not yet completed for scripting. It is on my ever lengthening to-do list.
Here is an example script to invoke boost in a script:
As Joe has illustrated, all the custom state names are listed in custom states are in the Indigo devices UI.
To access the boost state in a script, you need something like:
There isn't (currently) a definitive list of methods and properties in the Wiki.
As Joe points out, you can see what is available by looking at the Actions.xml file in the plugin by using Show Package Contents from the Finder.
Hope this gets you started.
The documentation is not yet completed for scripting. It is on my ever lengthening to-do list.
Here is an example script to invoke boost in a script:
Code: Select all
import logging
trvPluginId = "com.autologplugin.indigoplugin.trvcontroller"
trvPlugin = indigo.server.getPlugin(trvPluginId)
if trvPlugin.isEnabled():
boostMode = "1" # "1" = Delta T, "2" = Setpoint
boostDeltaT = "5.0" # Only needed if boostmode = "1" [Delta T]
boostSetpoint = "25.0" # Only needed if boostmode = "2" [Setpoint]
boostMinutes = "30"
# Turn on Boost: Change deviceId to the id number of he TRV Controller device you are wanting to boost
trvPlugin.executeAction("processBoost", deviceId= 12345678, props={"boostMode":boostMode, "boostDeltaT":boostDeltaT, "boostSetpoint":boostSetpoint, "boostMinutes":boostMinutes })
# Turn off Boost: Change deviceId to the id number of he TRV Controller device you are wanting to boost
trvPlugin.executeAction("processCancelBoost", deviceId= 12345678)
else:
indigo.server.log("Boost action ignored as TRV plugin not enabled", level=logging.WARNING) # log a failure messageTo access the boost state in a script, you need something like:
Code: Select all
trvDeviceId = 12345678
trvDevice = indigo.devices[trvDeviceId]
boostActive = bool(trvDevice.states["boostActive"])
# boostActive will be either True or FalseAs Joe points out, you can see what is available by looking at the Actions.xml file in the plugin by using Show Package Contents from the Finder.
Hope this gets you started.
- Stoutjesdijk
- Posts: 135
- Joined: Sun Dec 21, 2014 4:11 pm
- Location: The Netherlands
Re: (Probably) dumb python question
Great guys, thanks!!
Best regards,
Mark
Trying to tie it all together...
| Indigo | Plex | NAD M33 | Unifi | LG WebOS | Tado | Sonos | SolarEdge | HUE |
Mark
Trying to tie it all together...
| Indigo | Plex | NAD M33 | Unifi | LG WebOS | Tado | Sonos | SolarEdge | HUE |