achterberg wrote:Sorry to be keeping this going, but the script was working previously and even works with Jay's code suggestion below (== False). I had added the debug logging as suggested by Matt and the only time it fails (doesn't return) is when the plugin returns false (lower case) as in the log: Alert state is false. It seems to work with True and true.
This actually might be an implementation thing in the (my) code.
Devices.xml:
- Code: Select all
<State
id = "alertStatus">
<ValueType>String</ValueType>
<TriggerLabel>Alert Status</TriggerLabel>
<ControlPageLabel>Alert Status</ControlPageLabel>
</State>
plugin.py
- Code: Select all
if not parsed_simplejson['alerts']:
dev.updateStateOnServer("alertStatus", value = False)
else:
dev.updateStateOnServer("alertStatus", value = True)
I'm not sure how Python (or Indigo) is handling this situation behind the scenes. Indigo wants to get a string back from the plugin, but I'm sending a boolean. In my install (development environment and production environment) I get a state of 'false' when there are no alerts.
I will set the values to be strings like Indigo would expect. I'm hesitant to change the device valueType to boolean until it's time to roll out version 1.0.
Dave