Push button and relay

Hello everyone.
I am quite new to HA and electronics and this question is surely easy to solve, but I would like to do it right.
I want to control the ON/OFF of an air conditioner through its digital controller, activating and deactivating the start and stop button using a Shelly1 relay.
The problem is that it is necessary to activate and deactivate the relay for each change in the state of the button or the device, so the state of the relay cannot be identified with that of the device.
I suspect that a fictitious entity can be created that changes state each activation/deactivation of the relay, but I don’t know how this should be programmed.
I would appreciate help.
Greetings.

First, this is not at all blueprint related, so I would remove that part of the topic and add a tag for automation. It will get more eyes on your problem.

Now, your problem. You could put a temp sensor in the plenum to sense if it is actively cooling. You could put a vibration sensor to tell if the fan is on. You could put a power sensor to tell how much power it is drawing and make assumptions as to the state. Then take whatever sensors you have decided to use and create a template sensor using the logic to tell you the unit’s state.

Thanks so much for your answer.
I thought it could be solved with a blueprint, creating an entity that changed state every two activations of the relay, thats why I tagged for blueprints.
The problem with monitoring the air conditioning unit is that it is located outside and the wifi signal does not reach (the indoor unit is controlled by the thermostats) hence you need to activate or deactivate the unit through the digital controller.

A blueprint is just an automation or script, depending on which type you make, that has variables. Meant to reuse for multiple similar tasks or to share with others.
None of that applies here. Pretty sure I haven’t heard of anyone else with the same problem.

I assume that since you control the power to the device, a power monitor in the line could tell you what you want. Also that if it is controlling the air’s temp in your space that the vent could be monitored.

But if you have all the answers, there’s probably nothing more I can help with.

I only need to turn on and off the chiller (outside the house) not the fancoil, that is inside.
I don’t need to control the temperature of the water (settled manually) or the room, (this is controled by HA automations and wifi thermostats).

That’s why I’m asking.

I can control the Shelly1 relay. If I turn ON the relay and the machine is turned ON too, and when I turn OFF the relay, the machine is turned OFF too, there is no problem.

The problem is that when I turn ON the relay, the machine is turned ON but if I turn OFF the relay the machine remains ON, so this is a problem for the next command, because I can’t make a condition like “if the relay is off, turn it on” or viceversa.

A code solution for this is what I’m asking, probably I’m not explaining myself quite good.
Sorry and thanks for your efforts.