Hi,
I am trying to create a simple automation to activate my A/C if there is a movement in the room for a period of time. my climate is running with broadlink RM. my configuration is as following:
- id: diningroomac0001
alias: Turn A/C On @ Dining Room when there is movement for 45 sec
trigger:
- entity_id: binary_sensor.glass_room_motion
platform: state
from: 'off'
to: 'on'
for:
seconds: 45
condition:
condition: and
conditions:
- condition: template
value_template: "{{ states.sensor.glass_room_feels_like.state | float > 25 }}"
- condition: state
entity_id: 'sensor.mdv_status'
state: 'off'
action:
- service: climate.set_operation_mode
entity_id: climate.mdv
data:
operation_mode: 'cool'
The problem if I do not test the status of the climate (off/cool), the automation keep triggering and sending a command to the A/C and you can here the A/C getting a command from the remote. so I created a sensor for the state of the climate and it reports correct if off/cool but the automation will not run as all conditions are not met.
I can’t see anything wrong with what you have done. This does not mean there isn’t anything wrong (I’'m still learning a lot about HA). The only thing I can suggest is that you try adding the entity id to your template sensor.
I am also new to HA, and managed to accomplish alot, but this issue is driving me crazy looking around and trying.
adding the entity_id did not help, same issue.
If I try
{{ states.sensor.mdv_status.attributes }}
it will return: {'homebridge_hidden': True, 'friendly_name': 'MDV Status'}
condition:
condition: template
value_template: >
{{ states('sensor.glass_room_feels_like') | float > 25 and
is_state('climate.mdv', 'Off') and
is_state('switch.glassroom_ac_control', 'off') }}
There are two reasons. First, this collapses three individual templates to one equivalent template, which is more efficient. Second, it’s always recommended to use the states() function when possible to avoid errors. Consider this more “fine tuning.”
The state you had for your AC in the first post was ‘off’. The state I told you to try was 'Off". There is a difference. Capitalization (or not) is important! One will work and the other won’t. As you’ve experienced.
And what’s funny is that was what you eventually got to work in the template that you posted.
@finity
I did not notice that, because couple of post earlier one solution suggested that and I doubled check the the capitalization and fixed that but it was still not working. This is why I did not notice that.