Control "external" Raspberry


First short about my setup.
I’m having Openhab (latest version 2 released to Ubuntu) running on a virtual machine.
I’m also having a Raspberry with a screen used for Habpanel right now.

Now I’m considering if I can make a little more use of that Raspberry.

  • Is it possible to somehow control a rgb LED connected to the Raspberry - eg for showing a status (green = good etc)?
  • Would it be possible to get audio out on the Raspberry - eg “text to speak”?
  • Can I put a sensor on the Raspberry, and then read the data in Openhab?

I hope my questions make sense what I wish to do. :slight_smile:


Answering the third question - yes. My RPi posts MQTT payload to the other one and it’s read in OH2

Hi Pawel,
Could you describe the setup a little more, please? :slight_smile:
Do you have OH on both Raspberries? How do you forward data to the OH?

OH on one RPi, on the second one raspbian (OSMC precisely speaking).

RPi with OH:

  • install MQTT binding
  • install mosquitto
  • configure both, add items etc.

second RPi:

  • install mosquitto-clients
  • make a proper enviornment for the particular sensor you would like to use (in my case it’s DHT22 so I used pigpio with DHTXXD library patched with this file )
  • in my case, install cron and make a cron job (I guess there is another way to make something happen periodically but this suited my requirements)
  • DHTXXD library allow me to type dht22 in the command line and receive response in the format: [STATUS] [TEMP] C [HUMI] %, so to get temperature or humidity as decimals I had to type a command in this way: dht22 | awk ‘{print $2}’ (for TEMP; $4 for HUMI).
  • so to send temperature to the mosquitto broker, I use a command: dht22 | awk ‘{print $2}’ | mosquitto_pub -d -h [BROKER-IP] -t [MQTT-TOPIC] -l
  • then, you need to add a cron job (use command: crontab -e) with either the last command or executing a script (if you want to make some additional operations on the values and/or add some status checking to avoid adding 0.0 values if there are some connectivity problems with sensor)

I know it’s not a step by step tutorial but it’s not meant to be. I guess it’s clear enough to find any answers in docs (OpenHAB or mosquitto one). Of course if there will be problems, I’ll try help :wink:

@PawelGrzembka Thanks a lot for your input - I will try try that out later. :slight_smile: