OH 3 Temperatures of all Raspberry Pis in Network

Hello,
I have some Raspberry Pis in my network (Players, Kodi, OH 3 etc.)

Now I want to show the CPU temperatures of Pis in my Habpanel.
Any solutions to manage this?

Thank you

I was thinking about something similar.
I‘ve found something called psmqtt, but I’ve no clue how to trigger message from remote RPi using mosquito :frowning:

Maybe somebody will help us :wink:

How about install a openHAB on all systems and publish the temperature via systeminfo binding to a MQTT broker?

Either use MQTT or openHAB on remote systems (I’d choose MQTT because an OH instance consumes a lot more memory than the alternatives).
But if you go OH use the remote OH binding rather than MQTT to connect to your central OH instance.

See this link Monitoring CPU temperatures on a Raspberry Pi with MQTT – Thingsmatic

You basically have a script that runs in the background to publish the temperature to the MQTT server. Openhab then sees this messages as it should be subscribed to the same topic and hence would set an Item to the value.

2 Likes

Thanks a lot!
This is nice.

In the meantime I also psmqtt forced to work :slight_smile:

Maybe SNMP is an option?
https://www.seei.biz/cpu-temperature-of-a-raspberry-pi-via-snmp/

Observium uses a similar solution

1 Like

Hello,

nice to know. Do have an tutorial for your solution?

Thank you

You can just send a POST from the clients to the OH REST API updating an item.

Honk if you want examples… :relaxed:

Actually I did nothing special, but… let me try to write down the steps:

  1. instalation psmqtt as it is explained here: https://github.com/eschava/psmqtt/issues

  2. I had some compilation issues so I needed to update some Python libraries:
    sudo apt-get install python-dev
    sudo apt-get install python3-dev

  3. after that I’ve changed psmqtt.conf to send messages to remote Mosquitto host:
    mqtt_broker = "192.168.1.4"

  4. I run psmqtt in the background:
    nohup python3 ./psmqtt.py </dev/null &>/dev/null &

  5. to see messages sent by psmqtt I run on Mosquitto host the command:
    docker exec mosquitto mosquitto_sub -d -t \#
    (I have OH, influxdb and mosquitto in dockers)

  6. if everything works fine you should see something like this:
    Client mosq-lvs91ccYqkpct5mghA received PUBLISH (d0, q0, r0, m0, 'psmqtt/rasp-1/virtual_memory/free/{{x|MB}}', ... (6 bytes)) 213 MB
    Client mosq-lvs91ccYqkpct5mghA received PUBLISH (d0, q0, r0, m0, 'psmqtt/rasp-1/virtual_memory/used/{{x|MB}}', ... (7 bytes)) 1060 MB
    Client mosq-lvs91ccYqkpct5mghA received PUBLISH (d0, q0, r0, m0, 'psmqtt/rasp-1/virtual_memory/total/{{x|MB}}', ... (7 bytes)) 3827 MB

    Client mosq-lvs91ccYqkpct5mghA received PUBLISH (d0, q0, r0, m0, 'psmqtt/rasp-2/virtual_memory/free/{{x|MB}}', ... (5 bytes)) 78 MB
    Client mosq-lvs91ccYqkpct5mghA received PUBLISH (d0, q0, r0, m0, 'psmqtt/rasp-2/virtual_memory/used/{{x|MB}}', ... (5 bytes)) 47 MB
    Client mosq-lvs91ccYqkpct5mghA received PUBLISH (d0, q0, r0, m0, 'psmqtt/rasp-2/virtual_memory/total/{{x|MB}}', ... (6 bytes)) 431 MB

  7. I have run it on 2 RPis (and mosquitto is on 3rd), so in this case also mqtt_clientid = 'psmqtt-2' in psmqtt.conf should be different on each sender

  8. rest in managed in OH3 in MQTT binding:
    image

Thank you

Now after hours of trying I managed it with a litte Python-Skript, that the Temperature of the CPU ist published at MQTT:
Like you see. But I´m not able to bring it to OH 3. When I´m making a Generic MQTT Thing the result is NULL.
My state topic is stat/home/RPIVPN/Temp - is that true?

Could you please show MQTT setup in OH?

Hope that works

Looking at the image you posted the topic should be

Home/RPIVPN/Temp

Note: case sensitive (you could click the copy icon and paste it into OpenHab)

Perfect thank you it´s working now.

Oh ha - now I´m not able to start the script every minute via cromtab.
I don´t know why

Try ‘/home…’ as this ensures the correct location for the script.

It’s still not working - tried home and home/pi

Anybody knows how to run a python-script via cronjob or where to put the script?

Thanks for help

Just to check, you tried it with the leading / ?

/home/pi/....