How to detect whenever a light is on?

Hey guys,

I have a bunch of lights in my setup which are mostly philips hue lights.
Now I need to turn on my RGB Light strip when I press the button on my hue dimmer switch. (for manual input, so not only automated input)
The RGB Led strip is a normal rgb strip hooked up to a ESP8266 (wemos d1 mini), which needs to be turned on with the dimmer switch or when one of the lights in my configuration are on.

So I have two possibilities:

  1. When the hue dimmer switch is pressed, The led strip has to turn on by the switch
  2. I need to create a sensor based on a light, and when that light is turned on the rgb strip has to turn on too.

I tried option 2, but that isn’t working because of reasons. It will work when turning it on from within homeassistant, but won’t turn on when pressing the dimmer switch button.
The automation looks something like this:

- action:
  - data:
      brightness: 255
      entity_id: light.kast_licht
    service: light.turn_on
  alias: New Automation
  condition: []
  id: '1509207789838'
  trigger:
  - entity_id: light.bloom_btv
    from: 'off'
    platform: state
    to: 'on'

Someone got any ideas on how to achieve this?
Sorry for my english, it isn’t my native language.

Does anyone has an idea?

For me it takes a while for Home assistant to update the light state of the lights when they are turned on from the hue app/hue dimmer.

Is your automation not triggered after the hue light goes on in home assistant? (this might have a short delay)

To make sure I understand what you’re saying:

  • you have a Hue light and a Hue Dimmer
  • you also have a led strip based on a Wemos D1
  • when you turn on the Hue light with the Hue Dimmer then you want to turn on the led strip at the same time

If that is what you’re trying to do then that is exactly what I have running at my home.
See my code below, this should work for you too by just changing the entity_IDs

# turn on the porch lights if outside light at back turns on
- alias: Porch lights on with back lights
  trigger: 
    platform: state
    entity_id: light.outside_downstairs # this is a hue light
    from: 'off'
    to: 'on'
  condition:
    - condition: time  # don't do it after we're in bed
      after: "07:00:00"
      before: "21:30:00"    
  action:
    - service: light.turn_on
      entity_id: 
        - light.front_porch # these are the non-hue lights; in your case the led strip
        - light.front_porch_side

# I only run these lights for 10 minutes, so when the back lights turn off, I want the other lights to turn off too 
# turn off if outside ligth at back turns off
- alias: Porch lights off with back lights
  trigger: 
    platform: state
    entity_id: light.outside_downstairs   #the hue light
    to: 'off'
  action:
    - service: light.turn_off
      entity_id: 
        - light.front_porch   # the non-hue lights
        - light.front_porch_side
1 Like

So, using your entity IDs and my code:

- alias: Kast licht aan
  trigger: 
    platform: state
    entity_id: light.bloom_btv
    from: 'off'
    to: 'on'
  action:
    - service: light.turn_on
      entity_id: 
        - light.kast_licht

Thanks!

It’s working now, but it has a delay.
takes roughly 10 seconds for the led strip to actually turn on

Yes, that is the same for me.
probably has to do with the comment above:

YES!

Found the solution!

try add this:

light 2:
platform: hue
scan_interval: 3

emulated_hue:
host_ip: Hass ip

This makes an emulated bridge which checks every 3 seconds whenever a light is on or off.
So when you press the button, the LED strip will go on just in a small 3 seconds which happens to appear the transition time :smiley: