Shelly with Philips Hue

Hi there

I’m relativly new to HA and just wired up my wall light buttons with a few Shelly Plus 1s.
I also have a few Philips Hue lights which I added to HA.

I want to be able to do the following:

  1. Turn the Light on and off over the light switch.
  2. Turn the Light on and off over the HA-App.
  3. Turn the Light on with the light switch and off with the HA-App (also other way around)

To achive this, I set the following Input/Output Settings in my Shelly:
Input Mode: Button
Set output type: Detached

Now when I press the button, HA gets an event from my button called “event.livingroom_button”.

Then I added the following automation:

alias: New Automation
description: ""
trigger:
  - platform: state
    entity_id:
      - event.livingroom_button
    id: PRESS - livingroom_button
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - PRESS - Wohnzimmer_button
          - condition: device
            type: is_off
            device_id: 8c13327f941706167104814a871fe0ca
            entity_id: 2e909ee319873e94e5d76fbe60a655b3
            domain: light
        sequence:
          - service: light.turn_on
            metadata: {}
            data:
              transition: 2
              brightness_pct: 100
            target:
              entity_id: light.philipps_enrave_licht
      - conditions:
          - condition: trigger
            id:
              - PRESS - Wohnzimmer_button
          - condition: device
            type: is_on
            device_id: 8c13327f941706167104814a871fe0ca
            entity_id: 2e909ee319873e94e5d76fbe60a655b3
            domain: light
        sequence:
          - service: light.turn_off
            target:
              entity_id:
                - light.philipps_enrave_licht
            data:
              transition: 2
mode: single

Now I can turn on the Philips Hue via the light switch and turn it off via the app, also the other way around. But I can’t figure out the following behaviour:

  1. Button Press → Light turns on
  2. Button Press → Light starts to turn off, but turns back on again
  3. Button Press → Light turns off
  4. Button Press → Light starts to turn on, but turns back off again
  5. Button Press → Light starts to turn on
  6. Button Press → Light starts to turn off, but turns back on again
    and so on…

Does anyone have an idea, why my Philips Hue behaves like that?

Figgured it out, hat to put a 1s timer for the conditions.

At a point in the past I was using P.Hue bulbs directly in Hubitat. Specifics escape me, but I had issues of a similar nature. There were times when it was better to set a luminance level directly (0 for off) over using an on/off command.

I’ve since gone back to having the Hue hubs host Hue bulbs (70 or so).

Not sure if that’s your answer, but until a better suggestion comes along I thought I’d share that.

Is there a chance you could post your new automation? I’m not sure where you put the 1 second timer for conditions. Also I am new to HA and would like to do the same thing with Shelly and Hue. Where in the HA platform do I paste this automation.