evilpete / isylib-python Goto Github PK
View Code? Open in Web Editor NEWSimple Python lib for the ISY home automation controller
License: BSD 2-Clause "Simplified" License
Simple Python lib for the ISY home automation controller
License: BSD 2-Clause "Simplified" License
_isynode.py line 580 in master branch.
Must enclose the format parameters in parenthesis to form a tuple as such:
raise IsyResponseError(
"Node Cmd/Property Set error : node=%s prop=%s " %
(naddr, prop) )
masterLight = myisy.get_node("Master Bedroom - Main")
print "Node {:} is {:}".format(masterLight.name, masterLight.formatted)
results in a formatted value of "on" or "off"
masterLight.on()
print "Node {:} is {:}".format(masterLight.name, masterLight.formatted)
results in a formatted value of "100%" or "off"
Line 88 of _isynode.py should check if the value is dimable. If it is not dimable, it should return "on" instead of "100%".
In var_get_value it appears that there is an error returning the value:
This:
if varid in self._vardict :
return(self._vardict[prop])
Should be:
if varid in self._vardict :
return(self._verdict[varid][prop])
When trying to subscribe to the event updates, I get a 401 error. It seems that on line 459 of IsyEvent.py, admin is hard coded as the username and password. I fixed this on my end, but I'm still getting another problem that I'm looking into.
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 808, in __bootstrap_inner
self.run()
File "C:\Python27\lib\threading.py", line 761, in run
self.__target(_self.__args, *_self.__kwargs)
File "ISY\IsyEvent.py", line 331, in events_loop
self.process_func(d, self.process_func_arg, x)
File "ISY\IsyClass.py", line 330, in _read_event
if evnt_dat["node"] in self._nodedict :
TypeError: argument of type 'NoneType' is not iterable
Hey, Pete.
I've cloned your code and run 'sudo python setup.py --dry-run --verbose install'.
All appears to go well until it hits this point:
...
changing mode of build/scripts-2.7/isy_nodes.py
changing mode of build/scripts-2.7/isy_var.py
zip_safe flag not set; analyzing archive contents...
error: [Errno 2] No such file or directory: 'build/bdist.linux-armv7l/egg/EGG-INFO/zip-safe'
I've attempted to locate the 'build' directory and create the necessary path but no luck so far.
Is there something I'm missing?
Thanks,
dp
This is awesome code. REALLY helpful. Thank you. I have noticed that in my event callback, the current temperature reading of my thermostats never update. The other attributes do. Any insight into something I can do? For example, this thermostat reading always says 56 degrees:
"ST": {
"formatted": "56",
"id": "ST",
"uom": "degrees",
"value": "143"
}
If I do a curl call to the REST api, I get the correct temperature in the XML that is returned.
Thanks,
David
While trying to install your library setup failed. I traced the issue to two errors in the setup.py file:
Now I need to go pick up a Nest.
It looks like this isn't released very often?
https://pypi.python.org/pypi/ISYlib
I'm going to rewrite my ISY Hue Emulator interface I use for integrating with a Harmony Hub, and was thinking to move from PyISY to ISYlib-python, but would prefer to have a released version.
Hello,
Anxious to put this to work! I'm have a basic problem however. See my simple script below and the error.
Thanks for your help!
Bob
My minimal script:
import ISY
myisy = ISY.Isy()
myisy.node_comm("Mantle LEDs", "on")
Result:
pi@raspberrypi ~/myNas/RasPi/python $ python isypy_test.py
('naddr : ', 'Mantle LEDs', ' : ', '28 20 6D 1')
Traceback (most recent call last):
File "isypy_test.py", line 4, in
myisy.node_comm("Mantle LEDs", "on")
File "/usr/local/lib/python2.7/dist-packages/ISYlib-0.1.20140704-py2.7.egg/ISY/_isynode.py", line 631, in node_comm
self._updatenode(naddr)
File "/usr/local/lib/python2.7/dist-packages/ISYlib-0.1.20140704-py2.7.egg/ISY/_isynode.py", line 791, in _updatenode
for child in list(_nodestat) :
TypeError: 'NoneType' object is not iterable
I've seen this error twice now? Not sure what triggers it.
Exception in thread event_looper: Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 505, in run self.__target(*self.__args, **self.__kwargs) File "/usr/local/lib/python2.7/dist-packages/ISY/IsyEvent.py", line 594, 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'
My program is simply checking an ISY var:
driveway_flag = myisy.get_var("Driveway_Flag")
May I suggest that the code in this library gets some much needed cleanup towards PEP8 standards? Might be time to put a Travis CI hook on the project and force flake8 validation on the entire code base.
Just tried merging the latest changes, but some of the latest commits actually introduced new PEP8 violations.
Hi,
figured I switch the discussion from the ISY forum (subscription structures thread) over here. BTW Thank you for your responses and the work you are doing here.
Question: Have you thought about adding a state cache for all nodes/structures/variables of the ISY to this class?
You could poll the ISY on startup (optional) and store the information of all accessible information in a python structure. Even on large systems thats only hundreds of items.
Then with a subscription the class could keep the information in sync with the ISY controller.
It would open up a whole new world of possibilities to take the ISY into new use cases that are very hard or complicated today.
Even some of the event processing could be done in python rather than the very limited event language of the ISY.
Let me start with saying I am nowhere near a python expert and this may be user error:
My Code:
import ISY
myisy = ISY.Isy(addr="192.168.13.130",userl="admin",userp="admin",debug=0,eventupdates=1)
light = myisy.get_node("Kitchen Lights")
print "Node {:} is {:}".format(light.name, light.formatted)
light.on()
print "Node {:} is {:}".format(light.name, light.formatted)
When I run this code with eventupdates=1 i receive the following run time errors:
Traceback (most recent call last):
File "C:\Python27\ISYlib\Pat.py", line 3, in
myisy = ISY.Isy(addr="192.168.13.130",userl="admin",userp="admin",debug=0,eventupdates=1)
File "C:\Python27\ISYlib\ISY\IsyClass.py", line 303, in init
self.start_event_thread()
File "C:\Python27\ISYlib\ISY\IsyClass.py", line 378, in start_event_thread
self._preload(rload=0)
File "C:\Python27\ISYlib\ISY\IsyClass.py", line 1393, in _preload
self.load_vars()
File "C:\Python27\ISYlib\ISY_isyvar.py", line 54, in load_vars
for v in vinfo.iter("e") :
AttributeError: 'NoneType' object has no attribute 'iter'
When I set eventupdates=0 the code executes properly however, on the second print statement the status of the light is not updated. I assume this is where the eventupdates variable becomes relevant.
Running Python 2.7.6 on Win 2K8 R2 X64
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.