Hello y’all,
i’ve been trying this intedations now for a while but still can’t figure out whats wrong witch that code snip.
Located in /config/binary_sensor.yaml.
I am getting these errors:
Invalid config for [binary_sensor.template]: expected dictionary for dictionary value @ data[‘sensors’][‘icon’]. Got ‘mdi:speedometer’
expected dictionary for dictionary value @ data[‘sensors’][‘name’]. Got ‘LAN Ping’
expected dictionary for dictionary value @ data[‘sensors’][‘state’]. Got “{{ state_attr(‘binary_sensor.Router_Ping’, ‘round_trip_time_avg’)|round(2) }}”
expected dictionary for dictionary value @ data[‘sensors’][‘unit_of_measurement’]. Got ‘ms’. (See ?, line ?).
Invalid config for [binary_sensor.template]: expected dictionary for dictionary value @ data[‘sensors’][‘icon’]. Got ‘mdi:speedometer’
expected dictionary for dictionary value @ data[‘sensors’][‘name’]. Got ‘WAN Ping’
expected dictionary for dictionary value @ data[‘sensors’][‘state’]. Got “{{ state_attr(‘binary_sensor.google_dns_ping’, ‘round_trip_time_avg’)|round(2) }}”
expected dictionary for dictionary value @ data[‘sensors’][‘unit_of_measurement’]. Got ‘ms’. (See ?, line ?).
Cann you assist me what is wrong?
- platform: template
sensors:
name: "LAN Ping"
icon: "mdi:speedometer"
unit_of_measurement: "ms"
state: "{{ state_attr('binary_sensor.Router_Ping', 'round_trip_time_avg')|round(2) }}"
- platform: template
sensors:
name: "WAN Ping"
icon: "mdi:speedometer"
unit_of_measurement: "ms"
state: "{{ state_attr('binary_sensor.google_dns_ping', 'round_trip_time_avg')|round(2) }}"
Thanks in advance
EDIT:
even with this code it’ showing another error:
- platform: template
sensors:
- name: "LAN Ping"
icon: "mdi:speedometer"
unit_of_measurement: "ms"
state: "{{ state_attr('binary_sensor.Router_Ping', 'round_trip_time_avg')|round(2) }}"
- platform: template
sensors:
- name: "WAN Ping"
icon: "mdi:speedometer"
unit_of_measurement: "ms"
state: "{{ state_attr('binary_sensor.google_dns_ping', 'round_trip_time_avg')|round(2) }}"
Invalid config for [binary_sensor.template]: expected dictionary for dictionary value @ data[‘sensors’]. Got [OrderedDict([(‘name’, ‘LAN Ping’), (‘icon’, ‘mdi:speedometer’), (‘unit_of_measurement’, ‘ms’), (‘state’, “{{ state_attr(‘binary_sensor.Router_Ping’, ‘round_trip_time_avg’)|round(2) }}”)])]. (See ?, line ?).
Invalid config for [binary_sensor.template]: expected dictionary for dictionary value @ data[‘sensors’]. Got [OrderedDict([(‘name’, ‘WAN Ping’), (‘icon’, ‘mdi:speedometer’), (‘unit_of_measurement’, ‘ms’), (‘state’, “{{ state_attr(‘binary_sensor.google_dns_ping’, ‘round_trip_time_avg’)|round(2) }}”)])]. (See ?, line ?).