External script can't see the change on the onState property
Posted: Tue Dec 27, 2016 5:23 pm
Hi,
I want to execute a while loop while a device it's on. I got this code in an external Python script:
The script works as expected in that if the device it's Off it won't go inside the while loop and if it is On it will get inside and execute what I want. But the issue I got is that if I switch the device off while the while loop it's executing it the script never exits the while loop even though ToiletLight.onState should then be False. I have printed the ToiletLight.onState inside the while statement and I can confirm it stays True, at least for context of this script. Am I doing something wrong? Why can't the external script see the change on the ToiletLight.onState property value?
Thanks
I want to execute a while loop while a device it's on. I got this code in an external Python script:
- Code: Select all
ToiletLight = indigo.devices[999999999]
while ToiletLight.onState and ToiletLight.enabled:
do something
The script works as expected in that if the device it's Off it won't go inside the while loop and if it is On it will get inside and execute what I want. But the issue I got is that if I switch the device off while the while loop it's executing it the script never exits the while loop even though ToiletLight.onState should then be False. I have printed the ToiletLight.onState inside the while statement and I can confirm it stays True, at least for context of this script. Am I doing something wrong? Why can't the external script see the change on the ToiletLight.onState property value?
Thanks