There are strange things going on… Just to make it easier, I reduced a script to makes this test.
Here is the simple script
alias: 'Switch : Airco float'
fields:
temperature:
description: The temperature to set the airco at
default: 19
example: 21
sequence:
- service: climate.set_temperature
data:
temperature: '{{ temperature }}'
target:
entity_id: climate.airco_gang
description: Set airco temperature
mode: single
Calling this script from a button like this works fine
type: button
tap_action:
action: call-service
service: script.switch_airco_float
service_data:
temperature: 20
target: {}
name: Test gang
Replacing the 20 degrees by a helper gives me an error about “float expecting” ?
type: button
tap_action:
action: call-service
service: script.switch_airco_float
service_data:
temperature: '{{ states(''input_number.temperatuur_airco_gang'')|float}}'
target: {}
name: Test gang
No, because this script is in fact larger. It accepts not only the temperature but also the entity-id.
All of a sudden the script doesn’t work anymore and I donn’t know why.
This is the script :
alias: 'Switch : Airco x op y graden'
description: Set airco mode to heat and set temperature
fields:
temperature:
description: The temperature to set the airco at
default: '{{ states(''input_number.temperatuur_airco_gang'')}}'
example: 21
entity_id:
description: The climate entity you want to control
default: climate.airco_gang
example: climate.airco_gang
sequence:
- service: climate.turn_on
target:
entity_id: '{{ entity_id }}'
- service: climate.set_hvac_mode
target:
entity_id: '{{ entity_id }}'
data:
hvac_mode: heat
- service: climate.set_temperature
data:
temperature: '{{ temperature }}'
target:
entity_id: '{{ entity_id }}'
- service: climate.set_fan_mode
data:
fan_mode: auto
target:
entity_id: '{{ entity_id }}'
mode: single
When I click on “Run Script” I get these errors in de log :