I’m thinking to do something in Home Assistant with my old tv (not smart), Logitech Harmony and a power reading switch but i don’t know if it’s possible and if it is possible where to begin!
Maybe someone can point me in the right direction.
What i am trying to archieve:
A switch in Home Assistant that changes state by looking at the power readings from the switch.
Above 100watt: set switch to “on” state
Below 1watt: set switch to “off” state
Turn tv “on” in HA: fire the PowerToggle command from Harmony to the tv.
Turn tv “off” in HA: same as above
Is this even possible?
If this works i can still use the tv remote, and use the state of the tv switch in my other automations…
I would opt for a MCU (ESP, Arduino or the like).
The simplest thing might be to sense the current consumption by a current transformer which will indicate that the TVset is turned on. Another way, if not together, to capture the IR commands and inform HA about which operation is taking place.
With the help of MCU library, I presume the matter might be solved in a couple of days.
Exactly, the Harmony and the power reading switch is enough isn’t it?
I think it is possible with a template switch?
Something like this?
How do i define the state at the value_template?
That has to be: above 100w…
You’ll need to set up the HS110 via integration or configuration.yaml as described in the docs, and use a template on your TV switch to set the state of the TV switch. I use the same method to detect if my IR controlled AC unit is on or off.
With the settings above the harmony is shooting commands to the tv to turn it on and off via IR.
The only problem is the value_template.
It’s nog working, when i check the configuration it says:
Invalid config for [automation]: [value_template] is an invalid option for [automation]. Check: automation->trigger->0->value_template. (See /config/configuration.yaml, line 194). Please check the docs at https://home-assistant.io/components/automation/
It says value_template is invalid on automations, but on this page:
they are using the value_template to in an automation…
The state of the switch does not change when the watt consumption changes.
This is how it switch has to act:
80 to 120w is on
another wattage is off (below 1 watt is oke)
When i press the switch when the tv is on (±100w) the switch is responding, the Logitec is shooting the IR command to turn the tv off.
The switch is nog working when the tv is off (below 1w), there isn’t happening anything then, the harmony does no respond…
Sorry, i only corrected the automation from your last post and didn’t read the whole topic.
Your switch from post 6 should work with the right template.
It’s “almost” working perfectly.
There is still one thing not working wel, i’ll explain:
When the tv is already off and i use the switch.turn_off option in an automation, my tv is turned on.
So the automation is fireing the turn off command again, even if the switch is already off.
How do i disable that?
The turn_off command for this switch is the same command as the turn_on command, the PowerToggle command from the harmony…
Hello Roelofk85,
does your TV happen to have a free USB port? You could program and connect a Wemos D1 mini, or something similar. If the TV is on, announces the D1 in the Wi-Fi, you can then query the status via “Ping” and then know if the TV is “on” or “off” …
Have you looked at “Smart IR” ?