Sensors/healtcheck for a remote raspberry

for he first time i have bought an raspberry pi :slight_smile:
i dont use it for HA, but i want to create a sensor to see if my raspberry is online
i cant find an sensor/integration for that, only for remote gpio

so how can i create a sensor or healtcheck sensors for my remote raspberry?

thnx

Perhaps you could use the Ssh Sensor available in HACS to gather some info from the CLI. CPU temp is useful but you can format your own command if need be.

thx , i dont have hacs yet :slight_smile:
is it this one you mean?

I believe that is the one. It will perhaps do what you are looking for.

ok, thnx for tips, think i need a command line sensor for that stuff

That is what the sensor is for. perhaps you should do ‘apt install sensors’ and grep the output from that! But the choice is yours?
I am of course assuming that you are using raspian or another linux distro on the Pi?

Yes indeed, using raspian

But it’s strange that no one else did this before… :wink: Can’t find it on community here

Another alternative is to use the ping integration.


This will tell you if your Pi is online or not.

thats indeed easer for online/offline

thnx

if you need more information about the PI’s status you can also install glances on your pi and use the glances integration in HA to show different sensors. Glances itself exposes lots of information about the system in its API but HA component only monitor few of them but they are already enough.

Aha, really interesting, thnx for this

Well I had not even looked at glances but having done so now I have installed it on a few nodes and found it far better than my previous suggestions. Each of course has its own use case. Thank you for putting that forward.

Does it also got an uptime sensor?

No it doesn’t. At the end of the integration page that @serkank posted is a list of available resources from glances and below it a remark, that not all of these might be available on every system.

Maybe you can use the ssh sensor to send the command

uptime | sed 's/.*up \([^,]*\), .*/\1/'

Indeed ,thx gonna try it

@pergola.fabio so as a suggestion, here is what I did to overcome shortcomings of the HA integration.
if you do an API call with GET to this url, http://{glances server IP@}:61208/api/3/all you can get all the available information back in JSON format. for my Pi, i have the uptime information there.
have a look at the API documentation https://github.com/nicolargo/glances/wiki/The-Glances-RESTFULL-JSON-API
then you can use a rest sensor to monitor this missing metrics.

here is my card:

but another thing, the value you get from uptime sensor is just text. if you are going to use it in an automation then there needs to be away to convert it to minutes or hours.

Interesting stuff, plain text is more then enough!