I’ve read a little about templating in automations, but still haven’t made it work yet. Actually haven’t even been able to get one to add to my automations using the editor. I’ll make the edit and then it refuses to save my changes and I can’t determine what’s wrong. So hoping to get some specifics so I can get one working and learn from there
Just got a TCL TV and have it added to Home Assistant. I’m able to turn it off, on etc.
Currently I have an automation that when I walk into the office, it turns on the TV and switches the source to computer. Works perfectly and is amazing. How-ever I also have an Xbox that I use in the evenings. Which means sometimes I want it to change to the Xbox source. So the template would be this
If there is motion in the office
then check to see if the Xbox is on.
if true then turn on TV and switch to Xbox source
elseif turn on TV and switch to Computer source
The TV entity is media_player.43_tcl_roku-tv
The Xbox device_tracker.xboxonex
The office motion is binary_sensor.office_motion
I’m assuming I should be able to add/edit this in the automations in the web ui correct? Just switch to yaml editing?
To do this with one automation, yes, I believe you’d need to use data_template in the service call when switching the source. Unfortunately, AFAIK, the automation editor doesn’t support data_template. But then again, I don’t use the automation editor, so I’m not sure on that.
However, you could do it with two automations. They’d both use the same trigger, but each would have a different condition. I.e., one is triggered by the motion sensor, and then has a condition that the Xbox is on, and if so, then turn on the TV and switch to Xbox. The other would have the same trigger, but the condition would be the Xbox is off, and if so, then turn on the TV and switch to computer.
That’s how I do all my automations now. But it seems to get quickly out of hand! So I was hoping to cut the amount of automations in half. Maybe I can look at editing by hand then to resolve it. Thanks
Could you give more detail how exactly integrate TCL TV to HASS? using smart plug or something else? I saw “roku” there is there a roku device in the picture as well?
Thanks
Home Assistant automatically detected it and just asked me if I wanted to add it. It shows up now under Integrations -> Roku.
There’s a roku board inside the TV I’m guessing? I really don’t care about the Roku part as I don’t know if I will ever use it. I just use the TV for the computer or for playing on Xbox
The main reason I got this model was for automation. It has ethernet, which means you can do ‘wake on LAN’ with it. Bascially ethernet giving more options that just a model with wifi only.
Regarding the controls for not only our TCL TV we are using Mini Media Player. Works pretty well with TCL TVs.
Nevertheless, when it comes to turning a TCL TV (TCL 55P725 here) to ON through HA the outcome is rather disapointing: If the TV is switched OFF/Standby mode the Android TV integration gets disconnected thus the TV becomes “unavailable” for controling it. This is different compared to i.e. the Sony Bravia Series were you can still control the Bravia although it is in Standby mode.
If you need to switch your TCL to ON through HA best is to search the forum. There are threads where people are successful by using WOL (Wake on LAN) to turn their TCL’s to ON.