DHT22 Temperatursensor lässt sich nicht anlernen

Hallo erstmal,
ich bin neu hier in der Community und nutze Openhab seit einiger zeit für die Überwachung eines Serverschrankes. Funktioniert auch alles soweit, nur lässt mich der DHT22 Temperatursensor noch verzweifeln. Openhab läuft auf einem Raspberry. Der Sensor ist direkt mittels GPIO mit dem Raspberry verbunden.

Hier meine Items-Konfiguration:

Number TEMP_WOHNZIMMER "Temperatur Wohnzimmer [%.1f °C]" <temperature> { exec="<[etc/openhab2/scripts/dht22.sh TEMP:60000:REGEX((.*?))]" }
Number LUFT_WOHNZIMMER "Luftf. Wohnzimmer [%.1f %%]" <humidity> { exec="<[etc/openhab2/scripts/dht22.sh HUM:60000:REGEX((.*?))]" }

das erwähnte script dht22.sh:

#!/bin/bash
 
INPUT=$(/etc/openhab2/lol_dht22/loldht 7 |grep "Temperature")
HUM=$(echo $INPUT|cut -d " " -f3)
TEMP=$(echo $INPUT|cut -d " " -f7)
 
if [ "$3" = "HUM" ]; then
   echo $HUM
fi
 
if [ "$3" = "TEMP" ]; then
   echo $TEMP
fi

Einfaches Sitemap:

Text item=TEMP_WOHNZIMMER
Text item=LUFT_WOHNZIMMER

Wenn ich den im Script genannten Pfad(INPUT) per SSH auf dem Raspberry aufrufe werden mir auch schon die gewünschten Werte angezeigt. Nur in Openhab lässt sich nichts erkennen…
Exces und redgex-Transformation Addons habe ich installiert.

Vielleicht kann mir ja hier geholfen werden. Wäre sehr dankbar:)

Please post in English so that everyone can follow.
You may have permission problems, the exec binding is tricky that way. Did you search the forum? Do you have any errors? Also, please post more info about your system (which version, etc).

Welcome to the community!

You probably want to use an absolute path instead of a releative path, so insert a / at the start of the path:

Number TEMP_WOHNZIMMER "Temperatur Wohnzimmer [%.1f °C]" <temperature> { exec="<[/etc/openhab2/scripts/dht22.sh TEMP:60000:REGEX((.*?))]" } 
Number LUFT_WOHNZIMMER "Luftf. Wohnzimmer [%.1f %%]" <humidity> { exec="<[/etc/openhab2/scripts/dht22.sh HUM:60000:REGEX((.*?))]" }

I’m assuming that you either use openHABian or that you installed openHAB using the repository. If so then make sure that the openhab user is allowed to execute your script.

The output of doing an ls -l on the script should look similar to this:

$ ls -l /etc/openhab2/scripts/dht22.sh
-rwxrwxr-- 1 openhab openhab 1527 jan 26 20:28 /etc/openhab2/scripts/dht22.sh