davidlp / pilight Goto Github PK
View Code? Open in Web Editor NEWA pure python client to connect to a pilight daemon. Sendind and receiving commands can be asynchronous.
License: MIT License
A pure python client to connect to a pilight daemon. Sendind and receiving commands can be asynchronous.
License: MIT License
Hi maintainers,
Due to a reconnect issue with various domotica platforms I checked today what's causing the reconnections from failing. it seem that the pypi version of pilight python client (this project) is used quite a lot in pre-build docker images with version 0.1.1 however that pypi version does not have the reconnect feature that i see present in the latest source code. (i also checked the source code from the pip package its actually not 0.1.1. (even tough the package is version 0.1.1) it seems but an version older at least). I did a manual patch on the pipy package installed file with the pilight.py from this repo and the issue is fixed. perhaps create a new version to release and a new pypi package so future images will work with the reconnect?
The version is determined during runtime and can lead in faulty installations to an exception rendering this library not usable (e.g. in hackish virtual environments).
Since the version determination is not important the exceptions should be caught.
Hello,
Im trying to integrate Home Assistant with pilight.
You lib is used bij HaSS to connect to the API. For some reason pilight daemon crashes when this lib connects to it. See https://forum.pilight.org/showthread.php?tid=3218 for more info.
With this sample code:
REQUIREMENTS = ['pilight==0.1.1']
from pilight import pilight
host = "127.0.0.1"
port = 5001
pilight_client = pilight.Client(host=host, port=port)
The debug output of pilight is:
[Dec 09 20:39:35:338994] pilight-daemon: DEBUG: cpu: 0.076251%
[Dec 09 20:39:36:99890] pilight-daemon: DEBUG: new client, ip: 10.0.0.6, port: 33772
[Dec 09 20:39:36:100054] pilight-daemon: DEBUG: client fd: 17
[Dec 09 20:39:36:118482] pilight-daemon: DEBUG: new client, ip: 10.0.0.6, port: 33774
[Dec 09 20:39:36:118641] pilight-daemon: DEBUG: client fd: 18
Thread 1 "pilight-daemon" received signal SIGSEGV, Segmentation fault.
__GI_strcmp (p1=<optimized out>, p2=<optimized out>) at strcmp.c:38
38 strcmp.c: No such file or directory.
(gdb) backtrace
#0 __GI_strcmp (p1=<optimized out>, p2=<optimized out>) at strcmp.c:38
#1 0xb67c8c20 in request_handler (req=0x4b3b8) at /home/pi/repos/pilight/libs/pilight/core/webserver.c:892
#2 0xb67cba8c in client_read_cb (req=0x4b3b8, nread=0x4b7fc, buf=0x4b848 "{\"options\":") at /home/pi/repos/pilight/libs/pilight/core/webserver.c:1652
#3 0xb67abe54 in uv_custom_poll_cb (req=0x4b3b8, status=0, events=1) at /home/pi/repos/pilight/libs/pilight/core/eventpool.c:694
#4 0xb678a984 in uv__poll_io (loop=0xb6fa95f8 <default_loop_struct>, w=0x4b3ec, events=1) at /home/pi/repos/pilight/libs/libuv/unix/poll.c:64
#5 0xb6784224 in uv__io_poll (loop=0xb6fa95f8 <default_loop_struct>, timeout=2220) at /home/pi/repos/pilight/libs/libuv/unix/linux-core.c:400
#6 0xb677a8d8 in uv_run (loop=0xb6fa95f8 <default_loop_struct>, mode=UV_RUN_DEFAULT) at /home/pi/repos/pilight/libs/libuv/unix/core.c:362
#7 0x0001cb00 in main (argc=2, argv=0xbefff784) at /home/pi/repos/pilight-dev/pilight/daemon.c:3468
(gdb) frame 0
#0 __GI_strcmp (p1=<optimized out>, p2=<optimized out>) at strcmp.c:38
38 in strcmp.c
(gdb) frame 1
#1 0xb67c8c20 in request_handler (req=0x4b3b8) at /home/pi/repos/pilight/libs/pilight/core/webserver.c:892
892 } else if(strcmp(&conn->uri[(rstrstr(conn->uri, "/")-conn->uri)], "/") == 0) {
(gdb) frame 2
#2 0xb67cba8c in client_read_cb (req=0x4b3b8, nread=0x4b7fc, buf=0x4b848 "{\"options\":") at /home/pi/repos/pilight/libs/pilight/core/webserver.c:1652
1652 int x = request_handler(req);
(gdb) frame 3
#3 0xb67abe54 in uv_custom_poll_cb (req=0x4b3b8, status=0, events=1) at /home/pi/repos/pilight/libs/pilight/core/eventpool.c:694
694 custom_poll_data->read_cb(req, &custom_poll_data->recv_iobuf.len, custom_poll_data->recv_iobuf.buf);
(gdb) frame 4
Is your lib compatible with version 8 of pilight?
And is there anything I can do to fix this issue?
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.