After trying some things with the DHT22 in openhab3 (openHAB 3.0.2), I turn to you.
I tried to bring the output value from my bash script, which is stored in /etc/openhab/scripts, with items and things into my openhab.
I also used the EXEC binding, but it only gives me strings, which is of little use for a temperature sensor, because I want to display the values in a diagram.
Unfortunately all without success.
That’s why I ask myself the question:
“How can I include the temperature sensor DHT22 or DHT11 in Openhab3 without much trouble?”.
No, you need to apply this to the Exec binding Channel.
That’s the OH 1.x exec binding config. It will not work with the 2.x/3.x version of the binding and it will not work in OH 3 at all. Review the Exec binding’s docs. You will see in that the example Items in the doc do not resemble that Item’s config in any way.
Bindings connect to technologies. In this case it’s connecting to a command line script and external programs.
A Transformation is used to transform the states of Items. The Exec transformation lets you pass the value to an external script or program to transform it to something else. You are not using an external script to transform the Item’s state.
Hey @rlkoshak it works, or at least pretends to work.
When I have the thing like this I only get 0 out and not the numerical value of my script.
I think it’s because of REGEX unfortunately I have no idea about it because I’m a beginner.
I hope you can also help me in this case to get the dht22 running.
Make sure the REGEX transform is installed. I don’t think it’s required though.
I don’t mess with.things files so if you have an error there I can’t really help beyond saying almost all syntax errors are impossible when using the UI.
When things don’t work simplify. Keep the Item as String without any transformation. If that works add the transformation. If that works only then change to a Number:Temperature. If that doesn’t work then you’ll need to use a rule.
Sounds like they also run openHAB on the Pi, and are interested in the ambient temperature in the same area. Sounds appropriate - I’m doing the same as my Pi lives in the loft, but also runs other services.
@hafniumzinc yes that’s exactly how it is! i’m running openhab on the Raspberry Pi with the dht22 sensor connected to it.
If I want to use more DHT22 in the house in the future this is certainly a good idea @Marian_Grigore, I’ll keep that in mind.