I have two scripts one sets a threshold and then calls the other. I’m getting an error in the second one that I can’t seem to get fixed, I’ve tried a few things I’ve seen on the forums here but nothing has worked yet.
Here’s the error message in the log:
Logger: homeassistant.components.script.humcontrolstep2
Source: helpers/script.py:1138
Integration: Script (documentation, issues)
First occurred: 4:09:58 PM (24 occurrences)
Last logged: 8:27:26 PM
HumControlStep2: Error executing script. Invalid data for choose at pos 1: expected float for dictionary value @ data[‘above’]
Here are both the scripts that:
humidifier_control_logic:
alias: Humidifier Control Logic
sequence:
- variables:
th: '{% set t = state_attr(''weather.wingate'', ''temperature'') | float %}
{% if t < 0 %} [30, 20] {% elif t < 10 %} [35, 25] {% elif t < 20 %} [40,
30] {% elif t < 40 %} [45, 35] {% else %} [65, 50] {% endif %}
'
- service: script.turn_on
entity_id: script.humcontrolstep2
data:
variables:
maxhumidity: '{{ th[0] }}'
minhumidity: '{{ th[1] }}'
mode: single
humcontrolstep2:
alias: HumControlStep2
fields:
maxhumidity:
description: Maximum humidity level that will be tolerated in any active zone
example: 65
minhumidity:
description: Minimum humidity level that will trigger humidifier in any active
zone
example: 55
sequence:
- choose:
- conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: device
device_id: 798e40f56aa4cfc8560fb105935b7aef
domain: climate
entity_id: climate.downstairs
type: is_hvac_mode
hvac_mode: heat
- type: is_humidity
condition: device
device_id: 798e40f56aa4cfc8560fb105935b7aef
entity_id: sensor.downstairs_humidity
domain: sensor
above: '{{ maxhumidity | float }}'
below: 150
- condition: and
conditions:
- condition: device
device_id: 4348095d4f3d75c83b9a7676850fa6ba
domain: climate
entity_id: climate.living_room
type: is_hvac_mode
hvac_mode: heat
- type: is_humidity
condition: device
device_id: 4348095d4f3d75c83b9a7676850fa6ba
entity_id: sensor.living_room_humidity
domain: sensor
above: '{{ maxhumidity | float }}'
below: 150
- condition: and
conditions:
- condition: device
device_id: 4171867aea6553495a18c621f27bb894
domain: climate
entity_id: climate.master_bedroom
type: is_hvac_mode
hvac_mode: heat
- type: is_humidity
condition: device
device_id: 4171867aea6553495a18c621f27bb894
entity_id: sensor.master_bedroom_humidity
domain: sensor
above: '{{ maxhumidity | float }}'
below: 150
sequence:
- type: turn_off
device_id: 1f45c77b73dcbaeb59895017affe7225
entity_id: switch.humidifier_control
domain: switch
- conditions:
- condition: or
conditions:
- condition: and
conditions:
- condition: device
device_id: 798e40f56aa4cfc8560fb105935b7aef
domain: climate
entity_id: climate.downstairs
type: is_hvac_mode
hvac_mode: heat
- type: is_humidity
condition: device
device_id: 798e40f56aa4cfc8560fb105935b7aef
entity_id: sensor.downstairs_humidity
domain: sensor
below: '{{ minhumidity | float }}'
- condition: and
conditions:
- condition: device
device_id: 4348095d4f3d75c83b9a7676850fa6ba
domain: climate
entity_id: climate.living_room
type: is_hvac_mode
hvac_mode: heat
- type: is_humidity
condition: device
device_id: 4348095d4f3d75c83b9a7676850fa6ba
entity_id: sensor.living_room_humidity
domain: sensor
below: '{{ minhumidity | float }}'
- condition: and
conditions:
- condition: device
device_id: 4171867aea6553495a18c621f27bb894
domain: climate
entity_id: climate.master_bedroom
type: is_hvac_mode
hvac_mode: heat
- type: is_humidity
condition: device
device_id: 4171867aea6553495a18c621f27bb894
entity_id: sensor.master_bedroom_humidity
domain: sensor
below: '{{ minhumidity | float }}'
sequence:
- type: turn_on
device_id: 1f45c77b73dcbaeb59895017affe7225
entity_id: switch.humidifier_control
domain: switch
default:
- type: turn_off
device_id: 1f45c77b73dcbaeb59895017affe7225
entity_id: switch.humidifier_control
domain: switch
mode: single