Page 3 of 3
Re: Script that compare temperature reading from two sensors
Posted:
Wed Nov 04, 2020 3:19 pm
by FlyingDiver
As I said, that script needs to be the Action of the schedule, not the Condition.
Re: Script that compare temperature reading from two sensors
Posted:
Wed Nov 04, 2020 3:29 pm
by Eagleye
Ok, I have never done this below.
So just confirming, I would need to do the following for the schedule to work correctly?:
Re: Script that compare temperature reading from two sensors
Posted:
Wed Nov 04, 2020 3:30 pm
by FlyingDiver
On the condition tab, delete the script and select the "Always" option.
Other than that, looks right.
Re: Script that compare temperature reading from two sensors
Posted:
Wed Nov 04, 2020 3:33 pm
by Eagleye
Perfect
Thank you for your help with this, I learned something new. I just need to learn more about script writing.
Re: Script that compare temperature reading from two sensors
Posted:
Wed Nov 04, 2020 3:34 pm
by FlyingDiver
There are lots of good Python beginner tutorials on the net.
Re: Script that compare temperature reading from two sensors
Posted:
Wed Nov 04, 2020 3:37 pm
by Eagleye
Thanks Flyingdiver, I will check it out.
Re: Script that compare temperature reading from two sensors
Posted:
Fri Dec 02, 2022 3:49 pm
by Eagleye
I have created the following script to change a temperature variable, but for some reason I'm getting a "name 'Unicode"is not defined". As my script writing is limited, can someone please help me to correct the script error.
- Code: Select all
outside_temp = indigo.devices[76913492].states['sensorValue']
inside_temp = indigo.devices[181198247].states['sensorValue']
indigo.variable.updateValue(1281976055, value=unicode(outside_temp <= inside_temp))
Re: Script that compare temperature reading from two sensors
Posted:
Fri Dec 02, 2022 4:45 pm
by jay (support)
unicode is invalid in Python 3 (which is what's used for scripts in Indigo 2022.1 and later). Change it to
str (all strings are unicode in Python 3):
- Code: Select all
outside_temp = indigo.devices[76913492].states['sensorValue']
inside_temp = indigo.devices[181198247].states['sensorValue']
indigo.variable.updateValue(1281976055, value=str(outside_temp <= inside_temp))
Re: Script that compare temperature reading from two sensors
Posted:
Fri Dec 02, 2022 8:48 pm
by Eagleye
Thanks Jay, appreciate your prompt response.
After further search on the internet, I came up with the same solution.
John