Reading custom device states in AppleScript

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
Forum rules
This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Reading custom device states in AppleScript

Post by berkinet »

Is it possible to read a state from a custom device in AppleScript? I have defined a custom device (a Proliphix Thermostat) and would like to get the temperature (temperature-F) from that device.

In an AppleScript asked for the device's properties and got:

Code: Select all

		--> {name:"Thermostat: Foo", description:"", address:"address unknown", type:current application, model:"Proliphix Thermostat", display in remote ui:false, on state:false, brightness:0, temperatures:{}, humidities:{}, heat setpoint:0.0, cool setpoint:0.0, hvac mode:offMode, fan mode:fanAutoOn, zone index:0, binary outputs:{}, binary inputs:{}, analog inputs:{}, sensor inputs:{}, last changed:date "Thursday, November 3, 2011 11:21:16 AM", supports on off:false, supports dimming:false, supports sprinkler:false, supports multiple i/o:false, supports hvac:false, «class SIr »:false, «class SVid»:false, supports all lights on and off:false, supports all off:false, supports status request:false}
For some reason Indigo thinks this is a "thermostat" (I.e. a Venstar) and displays the standard states for that type of device rather than my custom device.

Am I missing something here, is this even supported yet?

BTW, I will eventually do this in a Python script, but I have some existing AppleScripts that I would like to change from reading variables to reading directly from the device state while I am in transition mode.
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Reading custom device states in AppleScript

Post by jay (support) »

Not possible in AppleScript (nor will it be). Either use Python or create triggers that will populate a variable from a device state (an action in the Action Collection plugin) any time the device state changes.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: Reading custom device states in AppleScript

Post by berkinet »

Ok... But, why does Indigo think that my custom device is a "thermostat" instead of an unknown? That seems like an error to me.
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Reading custom device states in AppleScript

Post by jay (support) »

It doesn't. Indigo's built-in devices have ALL properties in them regardless of type. If you look closely at the property list above you'll see that it has properties for IO devices, sprinklers, etc. as well. In fact, the flag "supports hvac" is false... ;)
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: Reading custom device states in AppleScript

Post by berkinet »

Ok, that makes sense. THanks. So, I am now updating my former AppleScriptlet to a Python scriplet (to use in a Control Page). What I am trying to do is raise the set point of my thermostat. (Each call will raise the set point by 1 degree). I have most of this coded and working except for one thing... I need to call an action defined in my plugin device and I am stuck trying to figure out how to do this.

The action method I want to call is defined as
  • def setSetPoint(self, action):
and I currently find the value I need by doing
  • setPoint = action.props.get("setPoint")
Can you show me how to do this from an embedded Python script.
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Reading custom device states in AppleScript

Post by jay (support) »

Scripting Indigo Plugins

You need to publish the appropriate information for your plugin so others can script it was well (see the docs for the Action Collection as an example).
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
Locked

Return to “Extending Indigo with Plugins and Python”