An open API service indexing awesome lists of open source software.

https://github.com/jorricks/huelightsonping

Turn your lights on or off depending on the reaction of a ping.
https://github.com/jorricks/huelightsonping

Last synced: 3 months ago
JSON representation

Turn your lights on or off depending on the reaction of a ping.

Awesome Lists containing this project

README

          

# Hue lights on ping
Simple state program that has the option to keep your lights on or off or turn them on/off based on
the result of a ping to a specific IP.

## Installation

- Get the code from the github (get it with `git clone https://github.com/JorricksTU/HueLightsOnPing.git`) for latest version.
- Install flask and phue(
`
pip3 install flask phue
`)

## Usage
Change the config at the top of the file huelightsonping.py and run using
`python3 huelightsonping.py`

## How to create a service
One can create a linux service by creating a file called hueonping.service in /etc/systemd/system with the following contents
Do not forget to change username into your username.
(Note: You might have to change the python path too.)
``` linux
[Unit]
Description=Hue lights on ping daemon
[Service]
WorkingDirectory=/home/username/HueLightsOnPing/
Type=simple
User=username
UMask=007
ExecStart=/usr/bin/python3.5 /home/username/HueLightsOnPing/huelightsonping.py
Restart=on-failure
TimeoutStopSec=300
[Install]
WantedBy=multi-user.target
```

After you created the file in the right directory, run the following commands.
```linux
sudo systemctl enable /etc/systemd/system/hueonping.service
sudo service hueonping start
sudo service hueonping stop
```
## Dependencies
- [Flask](http://flask.pocoo.org/)
- [phue](https://github.com/studioimaginaire/phue)