I am unable to find how to use air conditioner (MIDEA) “on” or “off” as a trigger for automation. Help is appreciated.
You could use the power value of the a/c as indicator if it is running or not?
Probably something like this:
triggers:
- trigger: state
entity_id: climate.your_midea_ac
from: 'off'
not_to:
- unavailable
- unknown
This will trigger whenever your AC changes from off to another valid state. If it only has one or two valid states you can also do it this way:
triggers:
- trigger: state
entity_id: climate.your_midea_ac
from: 'off'
to:
- cool
- heat
- condition: state
entity_id: climate.midea_ac_150633093978404
from: ‘off’
not_to:
“unavailable”
“unknown”
This is not working. I want to use it as a condition
Then why did you ask for a trigger?
See: Conditions - Home Assistant
conditions:
- condition: not
conditions:
- condition: state
entity_id: climate.midea_ac_150633093978404
state: "off"
Also please format your pasted config for the forum in the future. Use the </>
button in the post toolbar.
Thank you very much! I First thought on using it as trigger, but then realized its better as condition with time as a trigger.
what power value? I cannot get that data
Also I´ve tried:
- condition: state
entity_id: climate.midea_ac_150633093978404
state: "on"
And it didn´t work for some reason. I´m not sure why detecting device as ON is unavailable.
Look in Developer Tools → States. Find your climate entity. Look in the right hand column. There will be an attribute called HVAC modes and it will list things like, heat, cool and off. There is no “on” state, just heat, cool, etc…
That is why I used “not off”.
Yes, very clever, but it seems to me that this is something to improve (“on” state)
There is no single “on’” state for a climate entity there are multiple. It could be heating, it could be cooling, heck there is even a “fan only” state. These are all “on” states. Checking for “not off” is how you deal with entities that have multiple on states.
The media player is the same. When on it could be idle, playing or paused. How do you check if it is on?
By checking it is “not off”.
Came to another problem. How to read air conditioner current “set temperature” ?
Use the numeric state trigger or condition attribute
option. The attribute you want is listed in Developer Tools → States in the right hand column of the climate entity. Most likely temperature
.
thanks! worked very well
Actually it´s not working, i think its a bug!
As you can see the image it does have the temperature, but when I test if it´s below 24 it´s failing.
If that is a trigger it has to go from above 24 to below 24 to trigger.
If it is already below 24 when you created the trigger it won’t fire immediately.
not a trigger, it´s a condition
Did you use the correct attribute?
There are two, current_temperature (room temp) and temperature (set point).
yes, 2nd one
condition: numeric_state
entity_id: climate.midea_ac_150633093978404_temperature
below: 24
enabled: true