I have a number of automations running that send HA data to my home automation system via Restful Command. Works perfectly fine.
This is an example of a working Restful Command Yaml in an automation:
No matter what I try, I keep getting error message:
“Error running action
Error rendering data template: Result is not a Dictionary”
and I notice that where my automations with Restful Command that are working, show as
RESTful Command ‘rest_command.fc_miniserver’
in the automation editor, the ‘new’ Restful Command shows as
RESTful Command ‘rest_command.geo_miniserver’ on templated target
I’m totally lost as for where the ‘templated target’ suddenly comes from, what I’m doing wrong here or what may have changed in very recent updates…
Note: the template executes perfectly fine in the developer tools template editor.
Thanks in advance for shedding some light on this…
Here’s why I’m confused… although I don’t use restful commands myself, the example here shows that the data field to a rest_command entity should be a dictionary. But the >- makes the data field a multi-line string.
The attempt above is to correctly use quote marks… maybe the problem is that the GUI sees your {{ }} without quotations and assumes that you somehow want a multi-line string, not a dictionary.
If that doesn’t work… perhaps someone else who’s more familiar with restful commands and/or the GUI editor can figure out what’s going on.
Hi Dominic,
Thank you for your help.
I have been trying numerous variations on your suggestion, but could not get it to work.
Finally, I made a duplicate of one of the similar automations that were working correctly and I replaced all the variables for my new purpose.
That automation then worked fine…
So to find out the difference between my new, failing automation and the old working automations I took a look at the yaml file for the whole automation and saw that for the working (older) automations, the call to the restful command is repeated in the data section:
action: rest_command.geo_miniserver
metadata: {}
data:
action: rest_command.geo_miniserver
metadata: {}
data: >-
Patrick Home:
{{(states('device_tracker.iphone_patrick')=='home')|int|string}}, Patrick
Arriving Home:
{{(states('sensor.home_iphone_patrick_direction_of_travel')=='arrived')|int|string}},
Patrick Leaving Home:
{{(states('sensor.home_iphone_patrick_direction_of_travel')=='away_from')|int|string}}
I have no clue whether or not this is supposed to be the case (would think not), but anyway, with this this syntax it’s working like a charm.
It also makes me think that with the most recent HA updates something has changed in the processing of the automation editor when one creates a new automation…
So, my problem is solved for now, but I’m not sure where to take this if it potentially could be a bug.