Problem with sensor set

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.

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

A bullet point is not valid yaml, so that will never work.

Please format your yaml code so you can get help here. Instructions were linked in a previous post.

1 Like

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?

Then post what you actually have in your code. See point 11