#Pass temperature to sensor

1 messages · Page 1 of 1 (latest)

charred sorrel
#

Hi everyone,
I am trying to pass a value from a webhook to a sensor (helper template with °C as unit). Everything seems to work fine except passing the value to the sensor.

I am using the GUI for automations and using the following YAML for passing the value:

action: number.set_value data: value: "{{trigger.json.temperature}}" target: entity_id: sensor.living_temperatur

Unfortunately, the trace of the automation shows the following, including an error:
Error: expected float for dictionary value @ data['value'] Result: params: domain: number service: set_value service_data: value: 23,2 °C entity_id: - sensor.living_temperatur target: entity_id: - sensor.living_temperatur running_script: false

I am not really sure how to fix this but I suspect the error occurs from the transmitted value containing " °C"?

Thanks for helping me out 😄

odd crag
tawny hearth
#

The comma as decimal seperator will also cause issues

#
data:
  value: "{{trigger.json.temperature | select('in', '1234567890,') | join | replace(',', '.') }}"
charred sorrel
#

Thank you guys, this fixed the error. You are amazing!

charred sorrel
odd crag