chen462
(Chen Arman)
June 19, 2019, 9:15pm
1
Hi all.
I try to do this code for waze sensor
sensor:
platform: waze_travel_time
origin: 31.932526, 35.022497
destination: 31.986549, 34.911743
region: “IL”
name: To Work
platform: waze_travel_time
origin: 31.986549, 34.911743
destination: 31.932526, 35.022497
region: “IL”
name: Back Home
platform: template
sensors:
to_wotk_distance:
unit_of_measurement: “KM”
value_template: “{{ states.sensor.to_work.attributes.distance }}”
friendly_name: “Distance”
icon_template: mdi:map-marker-distance
platform: template
sensors:
to_wotk_route:
value_template: “{{ states.sensor.to_work.attributes.route }}”
friendly_name: “Route”
icon_template: mdi:routes
platform: template
sensors:
back_home_distance:
unit_of_measurement: “KM”
value_template: “{{ states.sensor.back_home.attributes.distance }}”
friendly_name: “Distance”
icon_template: mdi:map-marker-distance
platform: template
sensors:
back_home_route:
value_template: “{{ states.sensor.back_home.attributes.route }}”
friendly_name: “Route”
icon_template: mdi:routes
i get this error message:
Invalid config for [sensor.template]: expected dictionary for dictionary value @ data[‘sensors’]. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.template/
What i do wrong?
Thank you!
Take a look at the link the error shows.
You need the - platform: template
only once and then define all your sensors under sensors
.
See this example
And then you should read here , point number 11, how to format your code properly.
So we can see that the indentation is correct.
chen462
(Chen Arman)
June 20, 2019, 8:14pm
3
Thank you.
i fix my code to this:
and i still get the same error…i cant understand why?
platform: template
sensors:
to_wotk_distance:
unit_of_measurement: “KM”
value_template: “{{ states.sensor.to_work.attributes.distance }}”
friendly_name: “Distance”
icon_template: mdi:map-marker-distance
to_wotk_route:
value_template: “{{ states.sensor.to_work.attributes.route }}”
friendly_name: “Route”
icon_template: mdi:routes
back_home_distance:
unit_of_measurement: “KM”
value_template: “{{ states.sensor.back_home.attributes.distance }}”
friendly_name: “Distance”
icon_template: mdi:map-marker-distance
back_home_route:
value_template: “{{ states.sensor.back_home.attributes.route }}”
friendly_name: “Route”
icon_template: mdi:routes
nickrout
(Nick Rout)
June 21, 2019, 4:30am
4
A bullet point is not valid yaml, so that will never work.
Emphyrio
(Roelof)
June 21, 2019, 3:23pm
5
Please format your yaml code so you can get help here. Instructions were linked in a previous post.
1 Like
chen462
(Chen Arman)
June 22, 2019, 8:45pm
6
i haven’t bullet point in my code. i have the sign “-” before “platform”.
in the code i don’t get errors in yaml.
any another idea?
nickrout
(Nick Rout)
June 22, 2019, 9:01pm
7
Then post what you actually have in your code. See point 11
Before we begin…
This forum is not a helpdesk
The people here don’t work for Home Assistant, that’s an open source project. We are volunteering our free time to help others. Not all topics may get an answer, never mind one that helps you solve your problem.
[image]
This also isn’t a general home automation forum, this is a forum for Home Assistant and things related to it. Any question about Home Assistant, and about using things with Home Assistant, is welcome here. We can’t help you with e…