Set state without calling service

Hi all.
Im a little lost on something, and i hope it has an easy solution.

I have 2 AC units in my living rooms. My wife and i use HA exclusively to control them, but when we have vistors or family they use the remotes.

I have CT clamps on both the units, so i can use the power value to determine if they are on or off. I would like to use this state to update the HA UI, ie set the state, but ideally without calling the service.

Ideally in Node Red, as the workflow to determine on off, which season etc is complicated and ive already got that working in NR.

I did sort of get something working using NR and an API node, but that seemed to blow away all the attributes of the climate entity.

TIA!

Solved.
I stumbled across this python script, set_state, which does exactly what i want!

1 Like

I have a similar issue with my TV. I control it with a Broadlink IR device, but “on” and “off” are the same code. I wanted to know if the TV is actually on or off. There is a USB port on the TV- it’s labeled a “Service” port, but I have determined that it has 5V on it when the TV is on, so my solution will probably be to put an ESP8266 or Wemos D1 Mini there to be powered by the 5V on the USB port to provide an “on”/“off” status to Home Assistant.

I just haven’t figured out yet how I am going to provide that status. Let me know if you figure that part out. (Maybe a helper entity?)

I had solved that bit already — i have an iotawatt and the AC units are on their own dedicated power circuits, so i use power draw to determine on/off state, along with the time of year to work out if i want to set to heat or cool.

But how do you tell HA the status?

using the python script, and then calling it via an automation.

See the github link i posted earlier, and search it for set_state. Follow the setup/install instructions.

A simple use case;

I have a binary sensor to work out if my TV is on or off.
It goes from off to on

call python_script.set_state with an entity_id of remote.my_tv and a state of on.

LEGEND! Thanks for sharing @sh00t2kill !! This is by far the most straightforward approach!

For other people who are not that familiar with NodeRed, APIs, “GET”, REST, “POST” commands that were shared in other posts, look no further and follow the provided link with the instructions.

FYI: this is how the HA Automation looks like for me when the contact sensor on the aircon’s flaps opens, it updates the aircon state to “cool”

In YAML mode:

Yeah it works quite well.

I did have one use case where the integration itself would set the entity state back to the old one, but for every other use case i had it works as expected.