it appears sample to me on surface: ping 8.8.8.8 and trigger action in an automation if sensor reports "disconnected". But it looks like google protest they're cloud from constant pings. So I'd like to have Ping sensor setup but trigger the ping in predetermined interval in an automation.
The problem I can not find how to keep the sensor inactive in UI until I want to use it? Looks like one option is to do the sensor in configuration.yaml. Is there a better way?
I've had a Ping sensor pointed at 8.8.8.8 for years without any issues. If your router use Google for DNS, then the Ping from HA would be practically indistinguishable from any normal traffic from your household... But, if you are having issues with Google, have you tried any other DNS server addresses like Cloudflare (1.1.1.1) or Quad9 (9.9.9.9)?
no I did not try. but found this :
and using
- action: homeassistant.update_entity
data:
entity_id:
- binary_sensor.8_8_8_8
will this work?
alias: Internet connection test
description: ""
triggers:
- trigger: time_pattern
minutes: /30
id: Trigger very XX minuts
conditions: []
actions:
- action: homeassistant.update_entity
data:
entity_id:
- binary_sensor.8_8_8_8
- condition: state
state:
- "off"
entity_id: binary_sensor.8_8_8_8
for:
hours: 0
minutes: 1
seconds: 0
- action: switch.turn_off
metadata: {}
target:
entity_id: switch.s31_relay
data: {}
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- action: switch.turn_on
metadata: {}
target:
entity_id: switch.s31_relay
data: {}
mode: single
It'll work, but like @Didgeridrew said, it's unnecessary. Google DNS gets hit with probably millions of ping requests every second. I don't think your ping with the default call every 30s will affect them.
I ping Google once a minute without issues (unless there are issues, of course).
ok, I agree too complicated.
@ parautenbach
Is this how ping configured for custom polling interval?: Ping (ICMP) - Home Assistant
Yes, like that.
This is my more generalised version, based on what others did when the adjustable scan interval option was removed.
And then an entity ID just needs this property set via the customization: block.
All in YAML.
