Controlling hue via shelly with low delay

Hi all,

I was searching around a while but could not find a solution yet. I use OH 3.3 and use the Shelly binding via CoLoT. In addition I have Hue devices. I have configured shelly in detached mode and want to toggle the hue device itself. The only way I could get it working so far is via a rule that causes A delay of around 2-4 seconds. The rule also only triggers at one position of the shelly in detached mode.

I guess there are already smart ways how to control hue via shelly. I had idead to use the action urls of shelly and send a rest api command to openhab but failed so far. On top i would need to toggle, not set a defined state.

Any ideas / hints?


Did you try the trigger channel for the buttons?

Current rule I am using that does not accept switch toggle in detached mode and feels very slow

rule "Dadezimmer Deckenlicht"
    Channel "shelly:shelly25-relay:xxx:relay1#button" triggered LONG_PRESSED or
    Channel "shelly:shelly25-relay:yyy:relay1#button" triggered LONG_PRESSED
    if (HueBadDeckenlichtSwitch.state == OFF) {
    } else {

Why are you triggering LONG_PRESSED twice ? Why not SHORT_PRESSED ?

Sorry, just saw that it’s two different shellys

Not shure if it helps, but you can try and change shelly CoIoT settings from multicast to your openHAB IP address.

Did you see this

It shows good curl examples which should be adoptable to actions.

If I know correct hue and shelly use different methods for http, so having them speaking to each other directly would be intuitive but as I know does not work.

I already have shelly configured to use dedicated openhab host instead of multicast.

For the channel I checked the log what I can observe when using the shelly switch. I can only see the used channel. This might be due to detached mode?

Is there any rest api url I can directly use withing shelly to toggle an item?

It will always use the event bus, so no benefit.

But if you can use a curl command, you should be able to send a command to the hue bridge directly.

I also found this.

Any recommendations curl vs get/put translator? Both would mean one more hope and a tool on some device to “translate” anyhow? Anything known directly on hue or shelly?

Hi together,

thanks for the ideas and suggestions so far! I take the chance to summarize - might be potentially relevant for others in the future:

  • Shelly scripts are working on only new kind of “pro” devices. As I have a lot of shelly 2.5, this is not an option
  • I have physical switches that can have two physical positions. Nevertheless, as different sources might control the light, I configured them to toggle the light as soon as you toggle the physical switch. This is a must-have config as I do not want to change the switch kind of twice or even knowing how to put it to control the light (one of the rooms is the badroom, I might not have full brain working yet).
  • Besides shelly I also use google assistent (currentl using hue devices via hue, not openhab) and openhab to control as well. Rarely the hue app itself.
  • I could not find a hue API to toggle the light but only explicitly turn on or off. Hence, I need to know the state of the light somehow. Either I detect from hue itself every time. This would be precise but potentially slow. Or I cache it somehow. This might then be potentially out of sync for some situations.
  • Using openhab rules is sadly slow if I understood correct
  • There are different options to translate the shelly I/O url actions (HTTP GET) to HUE API (HTTP PUT) (cURL, hueget, potentially more)
  • Shelly only fires in one position if I configure it to detached mode, hence I would have to change the switch twice all the time.

New idea

  • I change the wiring to have the hue lights powered on all time without shelly
  • Changing shelly config back to edge switch. This would allow me to use shelly to cache the state
  • Using Output Switched On/Off URL as I/O url action of shelly to turn hue on/off explicitly. No need to toggle as shelly will have this logic and knows the status via the status of the relay (even thugh relais not used physically)
  • One shelly is kind of the “master”, the other one sends the on command to the other shelly, not to the hue translator itself
  • Openhab switch status item can read and control shelly instead of hue => openhab would be synced

Additional thoughts:

  • Controlling without shelly or openhab cause de-synchronization state (e.g. hue app or google assistant)
  • Google Assistant could be fixed using openhab interface instead of hue directly if I care / use more often
  • Unclear about delay for this solution as shelly sends a command to an additional network hop incl. a script to run
  • Unclear which “translator” is best?

Ideas / remarks?