I’ve been working on this animation to send me a text with temp data and time every 5 hours between the hours of 7:00a and 5:30p. I keep getting an error though.
16-07-07 07:10:41 homeassistant.bootstrap: Invalid config for [automation]: expected a dictionary for dictionary value @ data['action'][0]['data_template'] (See /home/hass/.homeassistant/automation/text_temp.yaml:2)
my automation looks as follows
## Text temps every 5 hours ##
alias: 'Temp every 5 hours'
trigger:
platform: time
hours: '/5'
condition:
- condition: time
after: '07:00:00'
before: '17:30:00'
action:
service: notify.google_text
data_template:
message:>
The temperature outside is {{state.sensor.weather_temperature.state}} at {{trigger.platform}}
data:
target:
- 1*********8
So question one. How do you tell the difference between a Dictionary value and one that is not.
two) what am I missing here.
Thanks and as always you guys rock, such a great program.
Try putting single quotes around the whole message string and double quotes around the templates. Also I think your templates are somewhat incorrect. Maybe like this:
action:
service: notify.google_text
data_template:
message:>
'The temperature outside is "{{ states.sensor.weather_temperature.state}}" at "{{trigger.now }}"'
A dictionary is in the form 'key': 'value'. Yaml will be converted to python dict(s), if only colons and newlines are used. Dash will make a list item.
Cool! I can be more helpful![quote=“martinhjelmare, post:4, topic:2238”]
A dictionary is in the form ‘key’: ‘value’. Yaml will be converted to python dict(s), if only colons and newlines are used. Dash will make a list item.
dict1:
key1: value1
key2: value2
dict2/key3:
key1: value1
[/quote]
This is very helpful in understanding error messages, thanks!
I figured it out, Thanks guys for the help it was my template was wrong, the suggestion for the single and double quotes didn’t work, however after fixing them it works like a charm. Thanks again for the help and pointing me in the right direction.
## Text temps every 5 hours ##
alias: 'Temp every 5 hours'
trigger:
platform: time
hours: '/5'
condition:
- condition: time
after: '07:00:00'
before: '17:30:00'
action:
service: notify.google_text
data:
message: The temperature outside is {{states('sensor.weather_temperature')}} at {{states('sensor.time')}}
target:
- 1*********8