Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

shelly-scripts

Home-automation scripts for Shelly Gen2+ smart relays, written in the on-device scripting engine (mJS) — no cloud, no Home Assistant, no extra hardware required.

Scripts

hue-toggle — a physical wall switch for Philips Hue, with a power-cut failsafe

The problem it solves: Philips Hue bulbs are meant to stay powered all the time and be controlled over Zigbee. But if they sit behind a normal wall switch, anyone flipping that switch cuts power to the bulbs — and now the Hue app, schedules, and automations can't reach them until someone turns the switch back on. The usual fixes are to remove the switch or hide it, which nobody likes.

What hue-toggle does: it puts a Shelly relay (e.g. a Shelly 2PM Gen 4, or any Gen2/Gen3/Gen4 device) behind the wall switch and runs a script on the Shelly itself. The switch input is detached from the relay, so a press no longer just cuts power — instead the script talks to your Hue bridge over the local CLIP v2 API and does the smart thing:

  • Lights off → recall a Hue scene you choose.
  • Lights on → turn the Hue group off (bulbs stay powered, still reachable).
  • Bridge or bulbs unreachable → fall back to physically toggling the relay, so the light always responds even if Hue is down.

That last point is the key feature: it detects a powered-but-unreachable bulb (for example when someone previously cut the circuit) with a per-device Zigbee reachability check, and only then reverts to switching mains power. In normal operation your bulbs keep their power and their Zigbee presence.

Highlights

  • Runs entirely on the Shelly — no Home Assistant, MQTT broker, cloud account, or extra server.
  • Local-only communication with the Hue bridge over HTTPS on your LAN.
  • Instant presses — decisions are made from cached health state, refreshed by a background poll, so a button press never waits on the network.
  • Self-healing failsafe — automatic fallback to a plain relay toggle when the bridge or the bulbs can't be reached.
  • Works with Hue scenes, rooms/zones (grouped lights), and multiple Shelly channels.

Get started: see the hue-toggle README for how it works in detail, hardware and Shelly configuration requirements, and step-by-step setup — plus hue-toggle/docs/config.md for obtaining your Hue application key and resource IDs.

Script Description
hue-toggle Turn one Shelly input into a smart toggle for a Philips Hue group, with a relay-based hardware failsafe when the bridge or bulbs are unreachable.

License

GPL-3.0.

About

Shelly Gen2+ scripts for home automation, including hue-toggle: a physical wall switch for Philips Hue with a relay power-cut failsafe. Local, no Home Assistant or cloud.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages