pophttp is run as a service on a computer and acts like a fake LIFX light running on your LAN. You then configure the Logitech pop app to make this fake light different colors for each different switch and each unique color is translated into a standard HTTP request.
- Install Python 3.6 or later if you don't already have 1 of these versions installed.
- Run
pip install -r requirements.txt
to install the required dependencies. - Clone the repo and run
pophttp.py
with-vv
from the local directory.git clone https://github.com/brokeh/pophttp cd pophttp
- Copy the
config-sample.ini
file toconfig.ini
to start making your changes - Start the script with some extra logging enabled to be able to see unconfigured lights
python pophttp.py -vv
- In the Logitech POP app on your phone, go to the My Devices section and add LIFX. If you already have LIFX configured, tap refresh to find the new Pop HTTP light.
- Add the new Pop HTTP light to any switch you want to use a HTTP request for, and choose a random color for it. It is recommended to use the Basic Mode as this will make the switch more responsive to pressing it twice quickly.
- Press the switch and check the console log for the pophttp server. You should see something like the following
The
2017-04-23 22:05:07,742 192.168.1.25 request 31851h,36751s,32768b,3612k,on not mapped to a URL
31851h,36751s,32768b,3612k,on
is the ID for the colour you chose, and what is going to be used to identify the light in the config file. Each component of the ID is optional and can be omitted if you want to match multiple actions. You will likely want to omit the final,on
or,off
so that it will match the same filter for both the on and off action. - Now add the new switch to the
config.yml
file under theswitches
section. You can include parameters from the fake light in the URL if required using{}
. See the comments in the config file for full details on how to specify the URL.Notice that theswitches: 31851h,36751s,32768b,3612k: http://example.com/switch1?power={onoff}
,on
is not included, but instead, the power state is included in the URL aspower={onoff}
. - Restart the python script for the config changes to take effect and you're done. Just repeat steps 6 - 8 for each switch.
- Once you're done configuring everything, the
-vv
can be removed from the command to reduce the amount of output to the console.
If you already have LIFX hardware it is recommended to also include the ip_filter
option in the config.yml
file to only respond to your pop bridge. You can find the IP of the bridge in the logs when running with -vv
. This will prevent the fake light showing up in the LIFX app.
There are further configuration options available too. Check out the config-sample.yml
provided to see a list of all configuration options and details on how to use them.
This repository also contains a Dockerfile
to allow it to be built into a Docker image.
- Build the Docker image, make an empty
config.yml
file and run it with the verbose logging so the unconfigured switches can be seendocker build -t pophttp . touch config.yml docker run -p 56700:56700/udp -v `pwd`/config.yml:/pophttp/config.yml -t pophttp -vv
- Configure your POP switches in the same way as steps 7 & 8 in the Getting Started section above in the
config.yml
. - Restart the Docker container to pick up the new config
docker restart pophttp