Programming Tips - Nanoleaf: check if your device is online and alive

Date: 2023aug15 Lanuage: bash Q. Nanoleaf: check if your device is online and alive A. This bash script is a lightweight way to do that
#!/bin/sh IP=127.0.0.1 # Replace with the IP-address of your Nanoleaf device PORT=16021 # Standard nanoleaf API port wget -q --timeout=20 --tries=1 -O /dev/null "http://$IP:$PORT/api/v1" STATUS=$? if [[ $STATUS -eq 6 ]]; then # Exit code 6 means bad authentication which means its alive. # We aren't providing any authentication here so the error is expected. echo Alive exit 0 else echo Problem exit 1 fi