How to automatically turn on Hue bulbs when TV is on?

What’s the best way to automatically turn on 2 Philips Hue bulbs (connected to Hass with bridge) when I turn on my TV (Samsung UE55KU6475).

Is there anyway to make Hass discover when the TV is on and then light up the bulbs?

Is it a smart TV? Do you have a Harmony Hub?

Yes it’s a smart tv, It’s a new TV, bought it in December 2016 and yes I have a Harmony Hub

I have an automation that happens when my harmony hub goes into my tv activity.

You can also add the samsung tv sensor and use that to have an automation occur when the tv is on.

Here’s how I do it with the Harmony Hub: First you need to install and configure the remote support that was added in 0.34.x

Then you can trigger off the sensor it creates for the Harmony Activities.

# Set lighting for theater experience after it gets dim in the living room
- alias: 'Theater Lights'
  trigger:
    - platform: state
      entity_id: remote.living_room
      from: 'off'
  condition:
    condition: sun
    after: sunset
    after_offset: "-00:45:00"
  action:
    - service: scene.turn_on
      entity_id: scene.sunset
    - delay: 00:02:00
    - service: scene.turn_on
      entity_id: scene.sunset_dimmed

The condition I use here is optional - I just find that in my Living Room, about 45 minutes before sunset it gets dark enough for the lights to be useful.

The action steps between a full brightness scene and a dimmed one. The two minute delay gives me enough time to ‘get settled in’.

Don’t know what brand TV you have but this is what I do for my Panasonic. I believe it’s the same for Samsungs as well.

Add it as a media player to your config:

media_player:
  - platform: panasonic_viera
    host: 192.168.0.x

Add some automation:

- alias: "turn on lights with tv"
  trigger:
    platform: state
    entity_id: media_player.panasonic_tv
    to: 'on'
  action:
    service: light.turn_on
    entity_id: light.living_room

I wrote in my first post what TV I have.

Samsung UE55KU6475

I will try both your solutions.
Thanx

The nice thing about using Harmony as the trigger is that you could have different settings for different activities. Mine just sets according to powering on, but that’s because it is a port from the original Harmony support API before native support was added (I just changed the sensor).

I’ve been tied up beta testing things for other devs but I intend to set up different scenes for different activities as soon as I can carve out some time.

I just use device tracker for my TV and that’s all

Using the Harmony solution Will only work if you turn on and off the TV with the Harmony?

I don’t have any remote, I only have the hub and I use it with my Amazon Echo Dot. Mostly my family members turn on/off the TV with Samsung original remote.

Yes; then the Samsung Smart TV sensor will work better for you. Just use the same logic but change the trigger.

do you use nmap or a router to get the devices turned on/off

i quit nmap and use ping to recognise devices. use this for home presence detection to open my door :stuck_out_tongue: what exaclty do u wanna do?

I’m looking for to turn on 2philips Hue bulbs when I turn on my tv, and turn off the bulbs when the tv is off.

Unfortunately the Option to use Samsung Smart TV sensor doesn’t work. It doesn’t recognize if my tv is on or off, the state is always “unknown”

So if you have a working config for this, please share :slight_smile:

I guess u have your TV connected to your local network ? U might want to use ping component

This will add your TV in file known_devices.

Now u can make automation like

Trigger ✓.platform✓ state✓ to✓home✓ action ✓ service ✓ light.turn_on/off entity_id✓ your bulbs …Will send u a config tomorrow if u want

Yes please, I’m learning to make automation and other config in Hass, so would be great to see how you did it.

this could be one automation:

  - alias: Night Light Living Room
    trigger:
      - platform: state
        entity_id: binary_sensor.multisensor_downstairs_sensor_9_0
        to: 'on'
    condition:
      condition: and
      conditions:
        - condition: time
          after: '23:45:00'
        - condition: time
          before: '05:00:00'
        - condition: state
          entity_id: device_tracker.tvlivingroomhome
          state: 'not_home'        
    action:
      - service: light.turn_on
        entity_id: light.fibaro_system_fgrgbwm441_rgbw_controller_level_16_0
        data:
          brightness: 255
          rgb_color: [255,33,111]
      - delay:
          minutes: 3
      - service: light.turn_off
        entity_id: light.fibaro_system_fgrgbwm441_rgbw_controller_level_16_0

this are my device trackers:

  - alias: Night Light Living Room
    trigger:
      - platform: state
        entity_id: binary_sensor.multisensor_downstairs_sensor_9_0
        to: 'on'
    condition:
      condition: and
      conditions:
        - condition: time
          after: '23:45:00'
        - condition: time
          before: '05:00:00'
        - condition: state
          entity_id: device_tracker.tvlivingroomhome
          state: 'not_home'        
    action:
      - service: light.turn_on
        entity_id: light.fibaro_system_fgrgbwm441_rgbw_controller_level_16_0
        data:
          brightness: 255
          rgb_color: [255,33,111]
      - delay:
          minutes: 3
      - service: light.turn_off
        entity_id: light.fibaro_system_fgrgbwm441_rgbw_controller_level_16_0

May I to get your configuration file. I also have this kind request.
I want to know the TV condition wth ping command. Then to modify the switch (TV on/off) status.
Thanks you.

will send them tonight as I’m at work atm