I want to improve the efficiency of a script that manages a fan, and avoid repeating hard coded values.
So I tried to add variables:
alias: Ventilation SDB New
mode: restart
variables:
max_dew: 14
min_dew: '{{ max_dew - 0.2 }}'
max_ext_dew: '10'
ext_dew_limit: '{{ max_ext_dew - 0.2 }}'
description: Ventilation SDB
trigger:
- platform: numeric_state
entity_id: sensor.sdb_dewpoint
above: '{{ max_dew }}'
for:
hours: 0
minutes: 0
seconds: 0
- platform: numeric_state
entity_id: sensor.sdb_dewpoint
below: '13.8'
for:
hours: 0
minutes: 0
seconds: 0
- platform: numeric_state
entity_id: sensor.exterieur_dewpoint
below: '10'
- platform: numeric_state
entity_id: sensor.exterieur_dewpoint
above: '20'
- platform: event
event_type: homeassistant_start
action: null
In the first ‘above’ parameter in the sample code, I have written above: '{{ max_dew }}'
, but the UI complains with “Message malformed: expected float for dictionary value @ data[‘above’]” . I also tried above: "{% max_dew | float %}"
and other variations without success.
My intent is to reuse these variables in action conditions as well.
Is this possible? If yes, what is the right way to do it?
1 post - 1 participant