ISYlib-python
ISYlib-python copied to clipboard
variable reads don't update
I've been working with the library and so far everything seems great, but one problem I've found is that variable values don't update.
I have my code set like this:
while True:
isy_VARIABLE_NAME = isy.get_var("VARIABLE_NAME")
value = isy_VARIABLE_NAME.get_var_value()
logger.debug("The current value of WD_EventGhost: {}".format(value))
time.sleep(60)
The first time the look runs it's perfect, it grabs the value of the variable named "VARIABLE_NAME", but then after I update the value on the ISY, it never updates what python sees. Also as if it's only reaching out the ISY once.
However, if I use:
counter = 0
while True:
isy_VARIABLE_NAME.value = counter
counter = counter + 1
time.sleep(60)
it updates the variable without problems
Any ideas?
Are you creating the ISY class with the option eventupdates=1
Eg:
myisy = ISY.Isy(addr="10.1.1.3", eventupdates=1)
On Aug 23, 2016 08:56, "stevenmcastano" [email protected] wrote:
I've been working with the library and so far everything seems great, but one problem I've found is that variable values don't update.
I have my code set like this:
while True: isy_VARIABLE_NAME = isy.get_var("VARIABLE_NAME") value = isy_VARIABLE_NAME.get_var_value() logger.debug("The current value of WD_EventGhost: {}".format(value)) time.sleep(60)
The first time the look runs it's perfect, it grabs the value of the variable named "VARIABLE_NAME", but then after I update the value on the ISY, it never updates what python sees. Also as if it's only reaching out the ISY once.
However, if I use:
counter = 0 while True: isy_VARIABLE_NAME.value = counter counter = counter + 1 time.sleep(60)
it updates the variable without problems
Any ideas?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/evilpete/ISYlib-python/issues/19, or mute the thread https://github.com/notifications/unsubscribe-auth/ACRVqX0PnwzrMk-ilRNwVqVJiSgvifzsks5qixgVgaJpZM4JrF1k .
I hadn't been no, but I just added it in and that looks like it's working great! Thanks!
At least in my test tool, I'm going to try it in my actual code and see how it goes....
That option causes a sub thread to be created that reads events from the ISY device and updates object states & values
On Aug 23, 2016 09:07, "stevenmcastano" [email protected] wrote:
I hadn't been no, but I just added it in and that looks like it's working great! Thanks!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/evilpete/ISYlib-python/issues/19#issuecomment-241785421, or mute the thread https://github.com/notifications/unsubscribe-auth/ACRVqamoKqwJ36d_GFJ2mAaO2b-jycGZks5qixqigaJpZM4JrF1k .
I'm seeing that yeah, a bunch of extra screen output comes out when the isy object is created now. My test tool worked... and it the first test of a single variable is working on a single cycle in my app code, I should have it tested for multiple variables with multiple updates in a few threads shortly. The test is running now.
Looks like there's an odd error coming from the event updates. This just popped up when a program on the ISY updated another varible... one I'm not even using in my code:
Exception in thread event_looper:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/dist-packages/ISY/IsyEvent.py", line 597, in events_loop
self.process_func(d, self.process_func_arg, x)
File "/usr/local/lib/python2.7/dist-packages/ISY/IsyClass.py", line 501, in _read_event
prog_dict['lastRunTime'] = evnt_dat['eventInfo']['r']
KeyError: 'r'
The question now is, will this disturb the thread monitoring updates and stop catching them? Or is the thread still running?
And yes, from my testing is does look like the background thread is dead and not getting updates anymore. I updated my variable on the ISY and it's not being read in the ".value" statement anymore.
What software version is your ISY? If you're running 5.x make sure you are running the version from GitHub. There are some changes to the event XML data format that I recently added work around for ( it's not fully tested for backwards compatibility thus not pushec to the PyPi repository yet )
On Aug 23, 2016 09:24, "stevenmcastano" [email protected] wrote:
I'm seeing that yeah, a bunch of extra screen output comes out when the isy object is created now. My test tool worked... and it the first test of a single variable is working on a single cycle in my app code, I should have it tested for multiple variables with multiple updates in a few threads shortly. The test is running now.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/evilpete/ISYlib-python/issues/19#issuecomment-241790737, or mute the thread https://github.com/notifications/unsubscribe-auth/ACRVqe_2DGDNTkcaHrR6XzjXV98BgXGyks5qix7BgaJpZM4JrF1k .
I'm in version 4.5.1