I want to find the min/max temperature during the day.
I have a weather station that fires an event when temperature changes. I can’t find the temperature in a “then” flow card, but I have it in the “when” card and can pass it on to a script for instance. Here’s my current flow:
I’ve created global variables in a script. Logically it’s easy to test for passed value being >/< than the variables, but I have several difficulties. Here’s my current script:
(the typo on tempMax should be tempMin has been fixed, but doesn’t change anything)
I would like some help on the following:
-
Why woun’t my script save the temp passed to it when it’s >/< then the values in the global variables?
-
I also have “Variables” created in the flow view with the same name as the global variable. Tests reveals that these are not the same instances of variables, so I can’t read the new say Max temperature when control is passed back from the script to the flow again. a) why aren’t these variables shared? b) how can I create variables that can be used in both Flows and scripts?
Thanks…
BTW I init the script variables by running
global.set('tempMax', -99); global.set('tempMin', 99); //init values