Automation control of clients in my network

Hello to all,

this is my first post in the Community, if there is something wrong, please tell me :slight_smile:

I Try to check the presence of Pi-Pico-Clients in my network. They have several functions like gathering temperatures etc. Unfortunately some of them have hangup’s sometimes.

I have implemented a “ClientID.LifeCounter” in the software of the clients. The Counter starts with value 10000 at startup of the Pico and then increment this Counter at least all 30 seconds. The Counters are published on a running MQTT-DB on my HA.

Now I try to check on my HA with an automation every 2 minutes, if this counters are increasing. There I have a second value for each client “ClientID.LifeCounterOld”, that is set everytime the automation runs. So I can compare the “ClientID.LifeCounterOld” with “ClientID.LifeCounter”. If they are equal, the client has a hangup and I want to restart it by a Shell PM that controls the powersupply for the client.

  • The Counter on the client is running and will be published to the MQTT-DB
  • I have a automation that runs every 2 minutes
  • I can reset the power for the Pico-clients
  • I can access the entities of the MQTT-DB, so I can use the Counters

My problem is to code the comparison of the two counters (“ClientID.LifeCounter” and “ClientID.LifeCounterOld”)

I have tried to use the editor for the automation as well as YAML but I didn’t succeded :frowning:

Best regards and I will be happy for every idea !!!
Holger

Why not just ping the picos?

Is there watchdog timer functionality on the Pico’s you could implement instead?

That is some impressive logic you built, might be a tad bit over-engineered, however if it works, it works.
If the PI’s are hanging, it is likely that whatever they are running is limited somewhere. Perhaps memory limits being hit?

Hey tom_I,
You made my day (or better “night”)! I have tried and it’s already working in a first prototype version :slight_smile:
THX a lot, Holger

Hopefully when the picos hang up the network stack also stops responding.

@IOT7712
I will check that also!

@ afsy_d
I’m still hunting for the hangups, so this is a “quick & dirty” solution to have a running system. Actually there is one of the Pico’s running in Debug Mode with saved protocol to find out what cause the hangup. I have programmed industrial controllers for some 10 years, so I’m trying to adjust my experiences to my HomeAssistant :slight_smile: That might be “over-engineered” somtimes.
THX, Holger

I will doublecheck that

Better over than under :smiley:
And as stated: impressive.