Blockly not triggered by user variable change
Posted: Wednesday 11 January 2023 20:44
I have created below Blockly to send me an alert if I left on the lights in my bathroom for a set period. To do so set I a variable after the lights have been on for that period. And when this variable is set it should alert me. After the alert I reset the variable to set it again after 10 minutes to keep alerting me (until I turn the lights off).
I set the trigger for this blockly script to 'All' and the user variable is defined as an integer.
Now this user variable does seem to change correctly when the lights are put off or left on for the given period, but the alerting part is never executed and I do not quite understand why.
To make it more complicated, after a lot of fiddling around with the script and/or changing the user-variable manually (I have not figured out exactly what actions caused it) I got it working occasionally for 1 time only, it alerts me one time but after that it does not work at all anymore.
I tried putting all the if-statements in separate blockly scripts (an changing trigger types) but it made no difference. Also changing the user variable to an string or other type did not make a difference (I also did not expect it to, but wanted to rule it out).
What am I missing here? (Note that I am still testing this so all the time values and multiple alerts might not make a lot of sense right now. Also the check on the value of the user variable in the first statement is not really necessary but as that part is working correctly I just left it like that ).
I set the trigger for this blockly script to 'All' and the user variable is defined as an integer.
Now this user variable does seem to change correctly when the lights are put off or left on for the given period, but the alerting part is never executed and I do not quite understand why.
To make it more complicated, after a lot of fiddling around with the script and/or changing the user-variable manually (I have not figured out exactly what actions caused it) I got it working occasionally for 1 time only, it alerts me one time but after that it does not work at all anymore.
I tried putting all the if-statements in separate blockly scripts (an changing trigger types) but it made no difference. Also changing the user variable to an string or other type did not make a difference (I also did not expect it to, but wanted to rule it out).
What am I missing here? (Note that I am still testing this so all the time values and multiple alerts might not make a lot of sense right now. Also the check on the value of the user variable in the first statement is not really necessary but as that part is working correctly I just left it like that ).