Hey, I would like to automatically turn off a light, when the TV is turned off / goes to standby - I got it working for TV use but when I switch the TV to show me Netflix - that triggers the automation already - so I need a way to keep the light on, when switching from TV to Netflix on the Samsung and turn off the light when the Samsung goes to standby. I got this in my:
configuration.yaml
# add the Samsung TV for remote control
media_player:
- platform: samsungtv
host: 192.168.23.27
automations.yaml
# Turn off light, when TV turns off
- alias: 'TV Light Master-Slave'
trigger:
platform: state
entity_id: media_player.samsung_tv_remote
from: 'on'
to: 'off'
action:
- service: homeassistant.turn_off
entity_id: light.06336337cc50e3d6173a
Is there nothing else that changes like the attribute source or something? Do you have any other way to see in home assistant that you switched to Netflix?
Well, I would not consider myself that well experienced with HA, therefore I was hoping for this forum to find some additional ideas. As far as I can tell, there is nothing else changing. At least where I look, I can not see any indication that the TV is switching to Netflix. Switching to Amazon Prime does not change the state to off. Switching back from Netflix to watching TV does change the state back to on.
Where do I find the attribute source?
I check under Development - States and that shows:
Set the representation of a device within Home Assistant.
This will not communicate with the actual device.
Entität
media_player.samsung_tv_remote
State
off
State attributes (JSON, optional)
{
"friendly_name": "Samsung TV Remote",
"supported_features": 20281
}
Just checked out the Samsung TV component and see that it is very limited, e.g. it doesn’t show the source of the currently playing media.
However it seems very strange to me that the state of the TV goes to off when you change to Netflix. Do you get Netflix over an app in the TV or you have a separate box for this?
Unfortunately I don’t know any possibility to check wheter Netflix is running or not. I have a “dumb” projector and my home cinema is controlled by a harmony remote.
Thank you so much Burningstone, that is very nice of you to check the possibilities.
No, there is no separate box for Netflix, it runs as an app in the Samsung TV.
Perhaps I can take a complete different approach. I do notice that the TV changes from active to inactive on my network router fritz but that takes a long time and might not be very reliable. However pinging the device seem reliable - but how can that work as a trigger? I have this now in my configuration.yaml
# Device Tracker for Samsung TV
device_tracker:
- platform: ping
hosts:
SamsungTV: 192.168.23.27
but how can I use that as a trigger instead of the media_player? Or will that not really work with TV and / or somebody has a better idea ?!??
You could do something like this to turn of the lights, once the TV is not reachable via ping anymore. This will introduce some delay but maybe you can live with this.
- alias: 'TV Light Master-Slave'
trigger:
platform: state
entity_id: device_tracker.samsungtv
from: 'home'
to: 'not_home'
action:
- service: homeassistant.turn_off
entity_id: light.06336337cc50e3d6173a
Well, works like a charm. Yes, does delay quite a bit but that is actually nice as the light might as well turn off up to 5 minutes after the TV was turned off. Obviously not really a solution to the limited Samsung TV Media Player but it does work well with the platform: ping and I got my first device_tracker running.
# Turn off light, when TV turns off
- alias: 'TV Light Table'
trigger:
- platform: state
entity_id: media_player.samsung_tv_remote
to: 'on'
action:
- service: switch.turn_off
entity_id: switch.double_switch_2_2_2