brokeh / pophttp Goto Github PK
View Code? Open in Web Editor NEWAdd support for HTTP requests to the Logitech pop switches
License: MIT License
Add support for HTTP requests to the Logitech pop switches
License: MIT License
Hi,
Yesterday I bought a Logitech Pop starters kit (2016 version) and was very disappointed it had no built-in functionality to call custom URLs. I applaud your efforts to add this functionality. Logitech should hire you :-)
I hate to submit issues without contributing to a project, so I apologize in advance. I'm more than willing to look into it myself, but wanted to check with you first.
I've installed PopHTTP on a Raspberry Pi 2 (Model B) and am running it on Python 3. When I add the LIFX brand on the Pop (Android) app's My Devices screen, I get a Scanning screen. After a while I get the "Hmm... cannot find LIFX. Make sure it's powered on. Check your Wi-Fi network".
I run the pophttp.py script with Debug verbosity level. This is the output it generates:
2017-09-03 11:32:31,271 192.168.178.120 recv Light_Get()
2017-09-03 11:32:31,273 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:31,451 192.168.178.120 recv Light_Get()
2017-09-03 11:32:31,453 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:31,851 192.168.178.120 recv Light_Get()
2017-09-03 11:32:31,853 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:32,052 192.168.178.120 recv Light_Get()
2017-09-03 11:32:32,054 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:32,490 192.168.178.120 recv Light_Get()
2017-09-03 11:32:32,492 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:32,654 192.168.178.120 recv Light_Get()
2017-09-03 11:32:32,656 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:33,054 192.168.178.120 recv Light_Get()
2017-09-03 11:32:33,056 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:33,258 192.168.178.120 recv Light_Get()
2017-09-03 11:32:33,259 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:33,667 192.168.178.120 recv Light_Get()
2017-09-03 11:32:33,669 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:33,866 192.168.178.120 recv Light_Get()
2017-09-03 11:32:33,868 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:34,266 192.168.178.120 recv Light_Get()
2017-09-03 11:32:34,268 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:34,488 192.168.178.120 recv Light_Get()
2017-09-03 11:32:34,489 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:34,874 192.168.178.120 recv Light_Get()
2017-09-03 11:32:34,876 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:35,083 192.168.178.120 recv Light_Get()
2017-09-03 11:32:35,085 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:35,478 192.168.178.120 recv Light_Get()
2017-09-03 11:32:35,480 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:35,680 192.168.178.120 recv Light_Get()
2017-09-03 11:32:35,682 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:36,086 192.168.178.120 recv Light_Get()
2017-09-03 11:32:36,088 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:36,283 192.168.178.120 recv Light_Get()
2017-09-03 11:32:36,285 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:36,692 192.168.178.120 recv Light_Get()
2017-09-03 11:32:36,694 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:36,888 192.168.178.120 recv Light_Get()
2017-09-03 11:32:36,890 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:37,292 192.168.178.120 recv Light_Get()
2017-09-03 11:32:37,294 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:37,491 192.168.178.120 recv Light_Get()
2017-09-03 11:32:37,493 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:37,912 192.168.178.120 recv Light_Get()
2017-09-03 11:32:37,914 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:38,096 192.168.178.120 recv Light_Get()
2017-09-03 11:32:38,098 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:38,513 192.168.178.120 recv Light_Get()
2017-09-03 11:32:38,515 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:38,701 192.168.178.120 recv Light_Get()
2017-09-03 11:32:38,702 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:39,109 192.168.178.120 recv Light_Get()
2017-09-03 11:32:39,111 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:39,312 192.168.178.120 recv Light_Get()
2017-09-03 11:32:39,314 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:39,713 192.168.178.120 recv Light_Get()
2017-09-03 11:32:39,715 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:39,917 192.168.178.120 recv Light_Get()
2017-09-03 11:32:39,919 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:40,316 192.168.178.120 recv Light_Get()
2017-09-03 11:32:40,318 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:40,535 192.168.178.120 recv Light_Get()
2017-09-03 11:32:40,537 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:40,931 192.168.178.120 recv Light_Get()
2017-09-03 11:32:40,933 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:41,131 192.168.178.120 recv Light_Get()
2017-09-03 11:32:41,133 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:41,531 192.168.178.120 recv Light_Get()
2017-09-03 11:32:41,533 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:41,736 192.168.178.120 recv Light_Get()
2017-09-03 11:32:41,738 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:42,131 192.168.178.120 recv Light_Get()
2017-09-03 11:32:42,133 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:42,333 192.168.178.120 recv Light_Get()
2017-09-03 11:32:42,335 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:42,739 192.168.178.120 recv Light_Get()
2017-09-03 11:32:42,741 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)
2017-09-03 11:32:42,938 192.168.178.120 recv Light_Get()
2017-09-03 11:32:42,939 192.168.178.120 send Light_State(hue=0, saturation=655, brightness=65535, kelvin=2500, dim=0, power=65535, label='Pop HTTP', tags=0)`
(This is all output I see between adding the LIFX and the error message that LIFX cannot be found on my network)
Some more info about my setup:
If the script still works in your setup, would you be willing to share your version numbers?
Thanks for your time!
I just setup my home-assistant and I realized that even if my request has no body, just something like this:
"http://ip:8123/api/services/script/turnofflivingroom" it will not work.
I tested with postman and when I use the GET method I get: 405: Method Not Allowed
When I use the POST method it works.
So I was assuming that this might be issue. Any other idea how to send a request to home-assistant from pophttp? Thanks
Typically I would have multiple lights to turn on or off for a scene.
Is there a way to send or concatenate multiple HTTP request from one click. Or is there another package that will accept a HTTP request and send out a few at the same time?
Thank you
Would it be possible to add a license to this repository and/or is the lack of a license intentional?
No License: https://choosealicense.com/no-permission/
Hi! This would be a great addition to use POP locally!
Unfortunately I haven't been succesful yet in getting this working.
The pairing seems to work fine, the POP HTTP device is showing in the POP app, and I can add it to a button. But the docker (or when I run without docker) does not output anything.
When i run with -vvv I get the following message:
2018-10-30 23:59:17,870 192.168.178.122 recv Unknown packet type $4
It would be great if you could point me in the direction of what this could be. :)
Thanks in advance!!
I'm running with:
docker run -p 56700:56700/udp -t pophttp -vv
uname -a
Linux hassio 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Logitech Pop Bridge = 1.4.145 version
Hello,
Great little tool as I love the Pop Buttons, but want flexibility.
My problem is that quiet often I press the button and the light turns on then shorty after off again. I normally use "toggle" modes. It seems that either the request is beeing repeated/executed twice. Is there a way to say for lets say 3 seconds one button press will only call the http request once?
It happens even more often when I have two logitech bridges in the network.
Thank you
Awesome script!
Can you add support for basic auth as well?
Great tool and I wanted to make it run as systemd service, but run into some problems regarding the config.ini.
I followed some general
`[Unit]
Description=Pophttp service
[Service]
Type=simple
ExecStart=/usr/bin/python /opt/pophttp/pophttp.py
[Install]
WantedBy=multi-user.target`
The problem is that when I run it with this it seems not to take my config.ini into account. It is like it did no execute it in the right path.
I continued investigating and it looks like I get the same behaviour when running it manually.
Running it within the folder with:
cd /opt/pophttp/ python pophttp.py -vv
is returning:
Server started on on 0.0.0.0
2020-10-08 20:36:25,615 192.168.1.229 resp 200 in 312ms http://192.168.1.124/toggle
-> Works fine.
On the other hand running from another folder:
/usr/bin/python /opt/pophttp/pophttp.py
is returning:
Server started on on 0.0.0.0
2020-10-08 20:39:02,834 192.168.1.229 request 3495h,37659s,33542b,3612k,on not mapped to a URL
-> It looks like if it is not taking the config into account. (it was the exact same button).
Any idea on this? My only goal is to run the service as systemd and thats why I was using the absolute path.
Thank you
Hi there,
I installed a docker version and I am trying to get pophttp to send an http request to node red so that I can do some magic with a LIFX bulb (I know, it sounds funny)
However, I noticed that there is a significant time delay in between pressing the button and when node red gets the http request. Sometimes the packet just drops.
Iโm wondering if this is normal? Are you still using this and how is your performance?
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.