phareous / insteonlocal Goto Github PK
View Code? Open in Web Editor NEWPython library for controlling Insteon Hub locally
License: GNU General Public License v3.0
Python library for controlling Insteon Hub locally
License: GNU General Public License v3.0
Following up on a discussion in the Gitter chat, attached is the output from running the example script and calling hub.get_linked(). Device discovery does not seem to be working.
I've got the Home Assistant working to toggle locally, however, in order to get status, I have to comment out line 308 of Hub.py otherwise I get an empty string for raw_text and a nonetype returned. Was this just needed to trim the trailing zeros?
(raw_text value starts with a zero when I'm stepping through)
Just putting this here so anyone that happens to look at it knows this is something we are working on.
https://github.com/phareous/insteonlocal/blob/master/insteonlocal/Dimmer.py#L106
Please replace the %S with %s
Jun 05 18:54:53 mozart docker[1232]: ValueError: unsupported format character 'S' (0x53) at index 8
Jun 05 18:54:53 mozart docker[1232]: Call stack:
Jun 05 18:54:53 mozart docker[1232]: File "/usr/local/lib/python3.6/threading.py", line 884, in _bootstrap
Jun 05 18:54:53 mozart docker[1232]: self._bootstrap_inner()
Jun 05 18:54:53 mozart docker[1232]: File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner
Jun 05 18:54:53 mozart docker[1232]: self.run()
Jun 05 18:54:53 mozart docker[1232]: File "/usr/local/lib/python3.6/threading.py", line 864, in run
Jun 05 18:54:53 mozart docker[1232]: self._target(*self._args, **self._kwargs)
Jun 05 18:54:53 mozart docker[1232]: File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 66, in _worker
Jun 05 18:54:53 mozart docker[1232]: work_item.run()
Jun 05 18:54:53 mozart docker[1232]: File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 55, in run
Jun 05 18:54:53 mozart docker[1232]: result = self.fn(*self.args, **self.kwargs)
Jun 05 18:54:53 mozart docker[1232]: File "/usr/src/app/homeassistant/components/light/insteon_local.py", line 178, in turn_on
Jun 05 18:54:53 mozart docker[1232]: self.node.change_level(brightness)
Jun 05 18:54:53 mozart docker[1232]: File "/usr/local/lib/python3.6/site-packages/insteonlocal/Dimmer.py", line 107, in change_level
Jun 05 18:54:53 mozart docker[1232]: level)
Jun 05 18:54:53 mozart docker[1232]: Message: 'Dimmer %S change_level: level %s'
Impact of the bug
Malicious code execution
Describe the bug
There are an unmet dependency in setup.py
and requirements.txt
- library pprint:
https://github.com/phareous/insteonlocal/blob/master/setup.py#L14
https://github.com/phareous/insteonlocal/blob/master/requirements.txt#L3
Despite pprint
library is built-in, it can be reinstalled using pypi
if:
112.0
For now, this package does not registered:
python -m pip install pprint
ERROR: Could not find a version that satisfies the requirement pprint (from versions: none)
ERROR: No matching distribution found for pprint
Affected versions:
At least insteonlocal
0.53
and 0.52
are affected (the latest one).
Solution:
Need to delete these potential unsafe packages from pypi and probably publish new version without these verbose dependencies.
INFO:insteonlocal.Hub:getBufferStatus: Got raw text with size 35 and contents: 401 Unauthorized: Password required INFO:insteonlocal.Hub:postDirectCommand: http://192.168.1.2:25105/1?XB=M=1 INFO:insteonlocal.Hub:clearBuffer: <Response [401]> OrderedDict([('error', False), ('success', True), ('message', ''), ('msgs', [OrderedDict([('im_code', '1 ')]), OrderedDict([('im_code', 'au')]), OrderedDict([('im_code', 'or')]), OrderedDict([('im_code', 'ed')]), OrderedDict([('im_code', 'Pa')]), OrderedDict([('im_code', 'wo')]), OrderedDict([('im_code', ' r')]), OrderedDict([('im_code', 'ui')])])])
INFO:insteonlocal.Hub: Dimmer 2F25FD status: None
I am getting the following error in my log. I had no issues until today and no config change was made, the devices just stopped reporting status and not responding to state changes.
(node:3248) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 connect listeners added to [Insteon]. Use emitter.setMaxListeners() to increase limit
(Use node --trace-warnings ...
to show where the warning was created)
Few weeks in to Home Assistant.. Loaded the insteon lights and switches. I have 16 lights/dimmers 7switches several firmware versions and types.
Hub 2245-222.
It seems the polling/checking states causes a lot of traffic. I have noticed when homeassistant is running several of my dimmers flicker randomly.So we'll see the lights turn off and on <1 second. When I turn off homeassistant/insteon config they no longer flicker. Is there a way to slow down how often it checks states?
Vanilla install..
Has anyone ran into this?
Thanks!
Hello,
I have a lot of insteon devices and can contribute it. Please let me know
I am getting the following error in my log. I had no issues until today and no config change was made, the devices just stopped reporting status and not responding to state changes.
(node:3248) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 connect listeners added to [Insteon]. Use emitter.setMaxListeners() to increase limit
(Use node --trace-warnings ...
to show where the warning was created)
Hey,
re: home-assistant/core#3811
I'm getting started on trying to integrate this with HomeAssistant and https://pypi.python.org/simple/insteonlocal/ seems to be empty resulting in an error when trying to pip install or include in requirements.txt.
I was able to install it by pip install git+https://github.com/phareous/insteonlocal.git
but unfortunately the requirements parser seems to barf on that, so I can't really include it properly.
In the issue on the hass project you had mentioned are a PHP developer by trade. I work as a PHP dev too and this is the first real python project I'm trying to dig my teeth into, so unfortunately I don't have any experience with pip and can't offer any quick fixes.
This library becomes extremely slow and unreliable once I add > 10 devices. I tried to debug and found that cache is not being used.
I added a debug line around line 447/448 in Hub.py and found this:
get_device_status for device 43****
INFO:homeassistant.components.insteon_local:key 1900 not in command cache
INFO:homeassistant.components.insteon_local:no cached status for device 43****
I tried to rebuild the cache at this point, but that did not solve the issue.Any idea what would cause this?
I am using HA in virtualenv.
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.