I thought this was pretty straightforward, but templating is something I really struggle with.
I’m trying to use notifications service to tell me the number of coronavirus deaths in the last 24h (yeah, I know, I like being anxious I guess).
This is what I have right now:
action:
- data_template:
message: Tivemos {{ trigger.to_state - trigger.from_state }} mortes em 24h.
title: Atualização COVID-19!
service: notify.mobile_app_mi_9
I tried a few other formats, but none worked. I even tried setting the state through dev tools, since I realised clicking EXECUTE in automations page would skip trigger, so no from_state and to_state would exist.
The error I got:
Covid: Error executing script. Unexpected error for call_service at pos 1: unsupported operand type(s) for -: 'State' and 'State'
Any help is appreciated.