Skip to content

Instantly share code, notes, and snippets.

@oki
Created March 21, 2019 21:50
Show Gist options
  • Select an option

  • Save oki/0d1f0ad39d7cacaee44a814bd2f6a7af to your computer and use it in GitHub Desktop.

Select an option

Save oki/0d1f0ad39d7cacaee44a814bd2f6a7af to your computer and use it in GitHub Desktop.
Paring IKEA TRÅDFRI light bulb with perfect timing via sonoff.
#!/usr/bin/env bash
TOPIC="tasmota/cmnd/sonoff1/POWER"
echo "ON and waiting 3 sec"
mosquitto_pub -h localhost -t "$TOPIC" -m "ON"
sleep 3
echo "Go!"
for ((i=1;i<=6;i++));
do
echo $i
mosquitto_pub -h localhost -t "$TOPIC" -m "OFF"
sleep 1
mosquitto_pub -h localhost -t "$TOPIC" -m "ON"
sleep 0.5
done
echo "Blinked??"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment