Hey, can’t figure out why this simple automation won’t work.
- id: '1586808364588'
alias: Set Alarm
description: ''
trigger:
- platform: mqtt
topic: hass/alarm/set
condition: []
action:
- service: timer.start
entity_id: timer.alarm_clock
data_template:
duration: '{{trigger.payload_json.value}}'
At first I tried to use data
instead of data_template
, because that’s what automation editor does, but that also doesn’t work.
Error message
Set Alarm: Error executing script. Invalid data for call_service at pos 1: offset {{trigger.payload_json.value}} should be format 'HH:MM' or 'HH:MM:SS' for dictionary value @ data['duration']
Payload example
{
"value": 34853,
"name": "BeforeAlarm",
"count": 1
}
So it doesn’t parse '{{trigger.payload_json.value}}'
into a numerical value? Can’t figure out why