kallefornia
New Around Here
This is a relatively simple bash script that turns off all lights when all members of a household have left and turns them back on again when one of them comes back.
Basically, it continually checks the list of clients currently connected to the router's WiFi network(s) for pre-defined IP addresses (e.g. of users' smartphones) and sends a command to the Hue bridge (via its API) to turn off the lights if it can't find any of them. It also remembers the last state of those lights and turns them back on when any of the pre-defined IP addresses reconnect.
I originally created this script because my brother keeps forgetting to turn off the lights when he leaves the house and it has since saved me a lot of unnecessary discussions and high utility bills, so I thought I'd share this, in case someone else might find it useful
You can find all the details and the files here: https://github.com/duckwilliam/hueoff
kallefornia 2023 https://github.com/duckwilliam/hueoff
Basically, it continually checks the list of clients currently connected to the router's WiFi network(s) for pre-defined IP addresses (e.g. of users' smartphones) and sends a command to the Hue bridge (via its API) to turn off the lights if it can't find any of them. It also remembers the last state of those lights and turns them back on when any of the pre-defined IP addresses reconnect.
I originally created this script because my brother keeps forgetting to turn off the lights when he leaves the house and it has since saved me a lot of unnecessary discussions and high utility bills, so I thought I'd share this, in case someone else might find it useful
You can find all the details and the files here: https://github.com/duckwilliam/hueoff
##############
Description
Bash script for automatically turning off the lights when all predefined IP-addresses have left WiFi on ASUSWRT Merlin and turn them back on when they reconnect.Prerequisites:
- jq
- curl
- bash
- jffs userscripts enabled
INSTALLATION:
- Configure this scripty by replacing the variables under User variables,
- Make sure you don't use a randomised MAC address on your device when connecting to your WiFi network.
- Make script executable (chmod +x ./hueoff) and run "hueoff install" from CLI OR:
- Place this script in /jffs/scripts/
- create this folder: /jffs/scripts//hueoff.d/logs
- add the following lines to /jffs/scripts/post-mount:
- To see the log run:
Credits:
Hue control functions were adapted from Harald van der Laan's Philips Hue Bash script: https://github.com/hvanderlaan/philips-huekallefornia 2023 https://github.com/duckwilliam/hueoff