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?
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