support wrote:You can get and set all of the Thermostat state info via AppleScript on the device model: temperatures, humidities, heat setpoint, cool setpoint, hvac mode, fan mode
Getting the properties above gets the value from what Indigo thinks the current state is for that adapter. So the data may be up to N minutes stale, where N is defined by the polling interval you are using.
Does that address what you need?
yes, but not as cleanly as i would like.
option 1: i could let indigo poll the thermostat. then i could set up a time/date action to poll the cached state of the device periodically (presumably with the same period that indigo uses to poll the device). this would work, however:
- it requires two time/date actions instead of one, with both unfortunately doing "busy wait" behavior.
- longer latency for my script to notice state changes
- no control over device polling period for different facets of thermostat state
option 2: i could let indigo poll the thermostat. then set up trigger actions that get invoked based on thermostat state changes. this seems like a more attractive option, since it eliminates one level of the "busy waiting". however, there is no way i know of to programmatically (from applescript, i mean) create a trigger action for thermostat state changes, e.g. when type: "device state changed, device: <thermostat>, base on "Operation Mode Changed". although these are very nicely supported via the UI. i can't see in the API how to specify the "operation mode changed" part of this.
to work around this limitation, i could provide the handlers in my script for each type of thermostat state change (mode change, temp change, heat setpoint changed, etc.) and then require that the user manually create trigger actions for these which invoke my handlers. so that's a possible work-around, but rather tedious with six different kinds of state change and it would need to be done separately for each thermostat if there were more than one.
(hypothetical) option 3: i create one or more handlers from which i queries various facets of the thermostat state and i would invoke them from indigo date/time action(s). i might update temp and humidity most often, update setpoints and fan mode somewhat often (since the user can potentially tweak these), and update mode changes less often still (since i'm not expecting any mode changes). this would help keep the insteon traffic down.
so i can and will live with option 1. it feels a bit klugy, but of given the way the thermostat interface was designed w/o state notifications, making it necessary to poll, i suppose its not much worse than the other options.
options 2 or 3 would be slightly preferred to option 1 but each would require minor "gaps" in the applescript interface to be fixed to allow creation of trigger actions like those that can be created manually in the UI.