I want to make an automation webhook, with two actions. First, it should ping an IP (let’s say 192.168.0.100), and the second action should find out if the ping was good or without reply… if was good, in any way, I should receive a notification with the result from the ping action.
I don’t want to set a constant frequent ping checking, I just want a ping check only when I trigger the webhook, then to receive the result from ping.
Can someone explain me very good, step by step? I don’t understand very easy
Create a ping binary sensor for the device but give it a very long scan_interval (years), see the example in the link above. This effectively disables the sensor from updating.
Write your automation to trigger on your webhook, then in the actions use the homeassistant.update_entity service to update your ping sensor. Wait a short delay and then check the sensor attributes or use them in a notification.
But this binary sensor for ping… can’t be without update? I mean, with manual update only?
And after I manage how to do this, and I will ping the host in one action, how can I call the variable response in the next action? How can I make something similar with:
If ping_192.168.0.100 = “Good”
do notification
else
do notification
I have 2 command_line sensors with “scan_interval: 3600”.
Usually I need these sensors to be updated every hour.
But - I do not want to run these commands simultaneously.
What I can do is:
Make “scan_interval: 99999999999” or smth.
Create 2 automations: “Run command 1” & “Run command 2”.
First automation must be triggered at XX:50:00, second one - at XX:55:00.
Each automation has “homeassistant.update_entity” service call.
So, every sensor will be updated (i.e.command will be run) at its own time (and every 1 hour).
But - what about HA startup, I believed that every sensor is updated automatically on startup?