How do I send a float to a script?
Here’s my code:
sensor:
- platform: dallas_temp
id: livingroomtemp
name: "Livingroom Temperature"
update_interval: 10sec
on_value:
then:
- logger.log:
format: "Sensor component - %f"
args: id(livingroomtemp).state
- script.execute:
id: settemp
tm: id(livingroomtemp).state
script:
- id: settemp
parameters:
tm: float
then:
- logger.log:
format: "Script - %f"
args: tm
The logger output is:
[15:50:01][D][dallas.temp.sensor:054]: 'Livingroom Temperature': Got Temperature=20.8°C
[15:50:01][D][sensor:093]: 'Livingroom Temperature': Sending state 20.75000 °C with 1 decimals of accuracy
[15:50:01][D][main:344]: Sensor component - 20.750000
[15:50:01][D][main:367]: Script - nan
The temperature is reported correctly from the sensor component code. Why is the temperature reported as “nan” from the script? Thank you.