Need to write a script that outputs to a pair of GPIO pins

I have a solar powered camera enclosure that uses PTP wireless communication for one of my customers. Because this system is solar powered, web PDUs that run off of 110v AC obviously will not work. I would like the system to automatically power cycle itself upon connection loss to the head end router because the enclosure is in an inaccessible location from the ground.

Anyways, I know you can use the GPIO pins for IO inputs and outputs. I would like to make a normally closed loop, that opens after a connection loss, and then closes after 5 seconds. This output would wire to a relay module that would switch the power to the POE switch (but not the Raspberry pi).

The script would basically just auto ping a specific IP and after X amount of time outs, would trigger the output which in turn would be relayed and switch on and off the power to the POE switch.

Is this something that needs to be done through coding or is there some kind of easy to use drag and drop editor that I could use to make such an idea work? I’ve seen something like that here.

Did you have a look at HACS GPIO ?

I looked into that right now. So basically I just need to install that add-on and then write a script to trigger the GPIO output.

Could someone help me translate this basic script into code and provide instructions on how to run it?

Auto ping 192.168.5.1 with 1 byte sized packet, once every minute. After 5 consecutive failures, trigger GPIO pin 40.

I just don’t know how to write code, Im only a security system installer that just has a basic knowledge of IT. Any help would be appreciated and I would even throw in some crypto as a bonus to the first person (or persons) that can help me get this thing working

Try adding a ping sensor to your config Ping (ICMP) - Home Assistant and check the addon documentation on how to do the GPIO action. It’s really not that hard.

If you do not succeed, post your attempt and people will be happy to help :+1: