I have a really crazy idea that seems straightforward in theory, but possibly not.
I have a dumb “smart tv” from Hisense running googleTV (worst decision ever) which has no CEC capabilities. I’m new to home assistant and running a straight Hass.io image on a Pi 2 - no VMs or the like.
I’m very excited by the homebridge integration have having Siri turn on my TV with my Broadlink RM mini 3. That part works well.
I’m wondering if there is a way that I could poll my network and if a specific IP address is found (that correlates to my TV), then mark the TV as being powered on. The desired end result would be that when I switch on the tv via remote then ask Siri or other to turn it off from it’s HA known on state.
I have just straight up commands for ‘tv off’ but I’m wondering if I can make it smarter.
(This also assumes there is no network connection while in standby).
Similarly, the CEC scan will tell me the power state of my connected Apple TV 4 - is there a way to sync this with the switch/homebridge power status. I currently use a play IR code to turn on the Apple TV.
Please excuse any ignorances - very new to this work and coding skills are mild.
I did basically the same thing that you’re looking to do. I’m using the device_tracker component with my Unifi controller, so the Nmap link from above may be a good option for you.
Then, once you have your device tracker set up, you can use a switch template like below. I had to do this because the Apple TV has it’s quirks with integrating well.
If you’d rather not use Nmap, doing a ping sensor works pretty well, too. But I like the tracker better myself. You’d just need to change the switch template’s value template to reference the state of the binary sensor.
I’m looking to do a similar thing here. I am using a Broadlink pro to create a switch that blasts IR codes to turn my TV on and off. I am using the Netgear presence detection to determine whether my TV is considered on / off (e.g. home / away). However, I am having trouble understanding how to create the markup using the data template as suggested.
My original switch that turns the TV on / off is as follows:
switch:
as it is a rf switch. so it don’t display the actual state of the switch whether on or off. Especially, when you physically turn on/off the switch manually.
If you turn on/off through HA, this show from frontend, however if you restart HA or physically turn off from switch manually you lost the original status of the switch again. So if you want to track the status, template switch doesn’t give you what you want as well.
Presence detection is worth doing to track device with ip address or mac address but RF switch or RF device doesn’t have ip and mac address. So we cannot use their status home or not_home to detect.
I struggled for a few hours to get this setup, I wish I had found this post earlier. I using the presence detection to track the state of my hisense fake smart tv (never buy hisense). Using the template it took awhile for me to figure out that you can change the homenot_home state to onoff. I had wireless wake on lan enabled on the hisense fake smart tv so the tv would not change state. Once this was disabled it works as expected. I am using unifi for presence and the updates are pretty fast.
platform: broadlink
host: IP
mac: mac
type: rm_mini
friendly_name: “RM”
switches:
tv_hisense:
friendly_name: “Hisense Toggle”
command_on: ‘JgBYAAABK48WDxMSEzYTEhYPExEYDRYPEzYTNxMSFTQTNhM3EzYTNxISExITEhM2ExIWDxMSEhIWNBI3EzYWDxY0FTQXMhM3EwAFLQABKkcTAAxaAAErRhIADQU=’
command_off: ‘JgBYAAABK48WDxMSEzYTEhYPExEYDRYPEzYTNxMSFTQTNhM3EzYTNxISExITEhM2ExIWDxMSEhIWNBI3EzYWDxY0FTQXMhM3EwAFLQABKkcTAAxaAAErRhIADQU=’