[SOLVED]iTunes Pause and Speak script

Posted on
Thu Jan 01, 2015 3:11 pm
jay (support) offline
Site Admin
User avatar
Posts: 18200
Joined: Mar 19, 2008
Location: Austin, Texas

Re: [SOLVED]iTunes Pause and Speak script

If that's the case, I'm not sure how his script above is working since the access to the state will return a string. The behavior should be that it always executes the script unless th string value is None...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Jan 01, 2015 3:30 pm
achterberg offline
Posts: 93
Joined: Feb 22, 2005
Location: Texas

Re: [SOLVED]iTunes Pause and Speak script

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.

Posted on
Thu Jan 01, 2015 4:17 pm
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: [SOLVED]iTunes Pause and Speak script

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

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu Jan 01, 2015 4:25 pm
achterberg offline
Posts: 93
Joined: Feb 22, 2005
Location: Texas

Re: [SOLVED]iTunes Pause and Speak script

I get both False and false returned at different times in seemingly no particular order, for what it's worth. But this isn't an issue for me as I explained before, this was a learning exercise. So whatever your timeframe is OK by me.


Sent using Tapatalk

Posted on
Thu Jan 01, 2015 5:17 pm
DaveL17 offline
User avatar
Posts: 6744
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: [SOLVED]iTunes Pause and Speak script

achterberg wrote:
I get both False and false returned at different times in seemingly no particular order, for what it's worth. But this isn't an issue for me as I explained before, this was a learning exercise. So whatever your timeframe is OK by me.

Thanks. Still good for me to make the code proper.
Dave

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Who is online

Users browsing this forum: No registered users and 3 guests