I’ve got a dehumidifier that I want to turn off when it reaches a certain level, but that level is dependent on the humidity of the floor above it. (i.e. if its 33% humidity upstairs, running the dehumidifier 100% will NEVER get it less than 3% above that value).
Here’s what I have for that automation so far, but its reported as invalid.
- alias: basementDryEnough
trigger:
- below: '{{state_attr("climate.downstairs_tstat", "current_humidity")|float+4}}'
entity_id: sensor.basementdehumidifier_am2301_humidity
platform: numeric_state
condition:
condition: and
conditions:
- condition: template
value_template: '{{ states.sensor.basementdehumidifier_am2301_humidity.state
< (state_attr("climate.downstairs_tstat", "current_humidity")|float +4) }}'
action:
- data:
payload: 'OFF'
topic: basementDehumidifier/cmnd/POWER
service: mqtt.publish
- data:
entity_id: climate.downstairs_tstat
fan_mode: auto
service: climate.set_fan_mode
Use a template trigger. You already have the correct template but you’re using it as a cond for some reason. Just move that up in to a template trigger and get rid of the condition block.
Alright, I’ll give that a try. Will report back.
1 Like
So this is what I’ve written, but it still doesn’t seem to be firing.
- alias: basementDryEnough
trigger:
- platform: template
value_template: '{{ states.sensor.basementdehumidifier_am2301_humidity.state
< (state_attr("climate.downstairs_tstat", "current_humidity")|float +4) }}'
condition: []
action:
- data:
payload: 'OFF'
topic: basementDehumidifier/cmnd/POWER
service: mqtt.publish
- data:
entity_id: climate.downstairs_tstat
fan_mode: auto
service: climate.set_fan_mode
id: 5c4e53f3d1f44577841633cc4d85d186
Can’t see the full template in your post, can you re-paste?
Sorry about that. Should be updated now.
I’ve had to reorder it a bit so it makes sense in my brain, but this should be right…
- id: 5c4e53f3d1f44577841633cc4d85d186
alias: basementDryEnough
trigger:
platform: template
value_template: >
{{ states('sensor.basementdehumidifier_am2301_humidity')|int
< (state_attr('climate.downstairs_tstat' , 'current_humidity')|int + 4) }}
action:
- service: mqtt.publish
data:
payload: 'OFF'
topic: basementDehumidifier/cmnd/POWER
- service: climate.set_fan_mode
data:
entity_id: climate.downstairs_tstat
fan_mode: auto
Once you’ve pasted it in and restarted, make sure the automation is on. Let me know
Out of curiosity, why int and not float? considering the values im getting are decimal numbers (i.e. 38.4%)
You can use floats if you want, I just tend to round everything to ints.
Ah ok. I’ve got it working now. Thanks for the help!
1 Like
No worries, please mark as solved