Hi Community!
Can anyone help me? I don‘t know what I‘m doing wrong. I try to setup three binary sensors for tracking my ISP and Gateway, but only one binary_sensor („cloudflare“) can be found in the entity list or state list in the developer tools.
Ping to Cloudflare, Google & Gateway every second (5 packets)
- platform: ping
host: 1.1.1.1
name: "Cloudflare"
count: 5
scan_interval: 1
- platform: ping
host: 8.8.8.8
name: "Google"
count: 5
scan_interval: 1
- platform: ping
host: 192.168.1.1
name: "Gateway"
count: 5
scan_interval: 1
template:
- sensor:
- name: "Cloudflare"
unit_of_measurement: "ms"
state: "{{state_attr('binary_sensor.cloudflare', 'round_trip_time_max') }}"
- sensor:
- name: "Google"
unit_of_measurement: "ms"
state: "{{state_attr('binary_sensor.google', 'round_trip_time_max') }}"
- sensor:
- name: "Gateway"
unit_of_measurement: "ms"
state: "{{state_attr('binary_sensor.gateway', 'round_trip_time_max') }}"
Thank you in advance!
tom_l
July 18, 2022, 10:32pm
2
This:
Ping to Cloudflare, Google & Gateway every second (5 packets)
Needs to be a comment (put a # in front) :
# Ping to Cloudflare, Google & Gateway every second (5 packets)
Also where are you putting this?
Under binary_sensors:
is where it should go.
I’d also recommend NOT pinging Google and Cloudflare every second, apart from being a lot of useless network traffic, they really won’t appreciate it.
rossk
July 19, 2022, 6:08am
4
xXkr13g3rXx:
template:
- sensor:
- name: "Cloudflare"
unit_of_measurement: "ms"
state: "{{state_attr('binary_sensor.cloudflare', 'round_trip_time_max') }}"
- sensor:
- name: "Google"
unit_of_measurement: "ms"
state: "{{state_attr('binary_sensor.google', 'round_trip_time_max') }}"
- sensor:
- name: "Gateway"
unit_of_measurement: "ms"
state: "{{state_attr('binary_sensor.gateway', 'round_trip_time_max') }}"
All these sensors should be under one heading, like this:
template:
- sensor
- name: abc
….
- name: xyz
….
1 Like
That was an copy error from my side. There was a # already. I have created a own file binary_sensor.yaml and this is the whole yaml in it. In the configuration.yaml i included this file. But still no google or gateway sensors
Do you really think it is a problem to ping them in this interval?
tom_l
July 19, 2022, 8:20am
7
Rossk has shown what your problem is. And yes pining public servers every second is not a good idea.
In future it helps if you show all your relevant config accurately, otherwise you’re just wasting everybody’s time.