Is there a way to add state to an existing broadlink switch or create a new switch containing state that calls the original switch?
I have a broadlink IR Blaster with which I’m controlling my TV and I would like to track whether it is on before sending as the command for my TV is a toggle command.
I don’t see any way to add the current state of the TV from the documentation that I see here:
I’ve done something similar before with a command line platform and would like to do something like this:
Having the same issue with my TV, i.e. the command for TV on and TV off is the same and basically comes down to a toggle, I realized had a Wemos D1 Mini lying around.
I set it up for access to my WiFi and plugged it into the USB port of my TV that only has power when the TV is actually switched on.
The Wemos shows up as ‘home’ within a few seconds of the TV being switched on but it takes a little longer for it to show up as not_home when the TV is switched off, so I read the TV stat off this info.
Still, this is by far more reliable than trying to map an input-boolean to the Broadlink that switches whenever I use it - but got out of sync easily when SWMBO used the ‘proper TV remote’ to turn the TV on and off.
There might be cheaper devices around to do that (the Wemos cost me $12 for two) but that’s what I had lying around.
Thank you for your response, you have a creative solution for detection presence!
Fortunately my TV connects to WiFi when it is on so I get that out of the box.
Did you ever figure out a way of smushing the state and switch together?
Could always just stick both the switch and the boolean state in a card together; however, I don’t see why it couldn’t be combined like it is for other switches.
Assuming you have a device_tracker set up fro your TV, does it only show up as ‘home’ when it’s actually turned on, or in stand-by also?
If there’s a distinction you have your state-tracker right away.
If there isn’t this disttinction, my only suggestion is measure the TV’s power consumption via e.g. a Sonoff S31 and get the state that way - way more expensive than a Wemos, though.
BTW:
I solve the toggle-only restriction with a condition in an automation, i.e. I only really fire the command_on when the TV’s presence state is not_home and vice versa.
I’m actually using a “command line sensor” to ping a webpage the TV makes when it is on and it seems to work pretty well.
I feel like I’m not following you when you are saying that you solved the toggle restriction with an automation. Can you elaborate on that a bit further?
I feel like worst case I’m looking for a UI solution to smush the sensor and switch together, but if automations could somehow fix this I’m all game!
Hi @WeldFire - I just tried to look it up to give you a real-life example with the automation and all, but I guess I must have replaced it a little while ago and forgot about it.
But here is what I have working now:
I have a WOL Switch for the Wemos - maybe you can set one up for your TV MAC and monitor the status of this ‘switch’:
Adding a template switch allowed me to do what I wanted!
There is a slight delay after changing it where it flips back before finally deciding on the next state update; however, I can live with this. Theoretically I can shorten the scan_interval; however, I’m not sure how much stress this would put on the system for little benefit.