I’ve been using a media player off trigger from my Vizio using the Vizio integration. Annoyingly, there is roughly anywhere from a 1 minute to a 2 minute delay from the time the screen is off to the time HA gets a notice which kicks off the activity.
As you can imagine, a pitch black basement kinda stinks once the system is off and my wife gets annoyed with my failing home tech (ha).
trigger:
platform: state
entity_id:
- media_player.tv_room_2
to: 'off'
condition: []
action:
- service: light.turn_on
target:
entity_id: light.basement_stairs_main_lights
data:
brightness_pct: 40
My current workaround is just to have a dim light on the whole time we watch TV and let the motion sensor kill it off once we walk upstairs. This is less than ideal but ends the pitch black conundrom:
- id: '862892703469002'
alias: Late night TV on, lights on
trigger:
platform: state
entity_id:
- media_player.tv_room_2
to: 'on'
condition:
- condition: and
conditions:
- condition: sun
after: sunset
after_offset: -02:00:00
- condition: time
before: '23:00'
action:
- service: light.turn_on
target:
entity_id: light.basement_stairs_main_lights
data:
brightness_pct: 22
Does anyone have a better option that may get around the Vizio delay issue?
According to the documentation for the Vizio integration, it employs Local Polling. That means it determines your TV’s current status by periodically polling it. In other words, it only knows the TV’s state at the instant in time when it checks it. Therefore there may be a delay between when the TV changes state and when Home Assistant is aware of it.
According to the Vizio integration’s source code, its “scan interval” is 30 seconds so it’s understandable that Home Assistant may not be immediately aware of when the TV is turned off. The Vizio integration doesn’t support adjusting the scan interval.
There’s a service call (homeassistant.update_entity) that forces an entity to update its state. However it would be an impractical way to meet your needs (forcing an update every second would flood the TV with requests).
I have found with my vizio that the Homekit controller integration is better for state information, as it updates pretty much instantly (‘ok’ for ‘on’ and ‘problem’ for ‘off’). But it won’t handle certain services like on, off, or toggle.
As far as I know, Broadlink only sends, does not receive, unless set in learning mode. If that is no more true, I would be the first, who wants to know, how I can receive IR signals
I was wrong; thanks for clarifying its capabilities.
I have a simple IR reader and made the mistaken assumption that the more sophisticated Broadlink devices can also serve as readers. I have removed the suggestion from my previous post to prevent misleading others.
I use my nVidia Shield remote which sends the command over CEC. Vizio’s integration processes its commands into HA. Per @123 comment above it polls every 30 seconds with that integration so I’m assuming based on @Didgeridrew HomeKit statement using this change, if I understood that off=problem and ok=on, would eliminate this polling delay that Vizio’s integration has.
@Didgeridrew Does your TV inevitably end up as “unavailable” via the Homekit integration? I’m looking at my Vizios and I see that they go from ok to problem to unavailable or ok to unavailable. The first seems to me to be like hitting eco mode and fully shutting off. The ok to unavailable kind of throws me off in my guess of how this flow works.
@derekcentrico I don’t know about your TV, but my TV with homekit has some setting that I needed to enable on the TV itself to ‘sleep’ rather than turn off and thus make the integration ‘unavailable’. This was specifically an option on the TV for homekit. Check your settings and see if there is such an option.