How Can I display these information in my openhab?? Sorry I started today with openhab and i can’t program
Have you installed the GPIO binding and added the script to /etc/openhab2/scripts? You will also need to create an item in the items file for the temp, humid, and pressure. A transformation addon such as JSON or REGEX may also be needed for OH to display the reading.
GPIO binding is installed and how do O process further on??
Make sure openhab is a member of gpio group. If not add the group using
sudo adduser openhab gpio
Here’s tutorial for setting up the RPI and using GPIO for one wire sensors. Their using a different sensor but the BME280 is one wire also.https://community.openhab.org/t/gpio-1-wire-temp-sensors-on-raspberry-pi-with-openhabian/20941?u=h102
I just posted on this over on another thread Exec binding PaperUI Thing with Parameter.
That folder is intended for openHAB Scripts, not external shell or python or such scripts. There used to be a problem when you put your external scripts in that folder that has long since been fixed, but the fact still remains that folder is not really intended for these sorts of scripts.
The bme280 ist a i2c device…Just to make clear
The bme280 can use either I2C or SPI…Just to make it clear. If you need further info regarding documentation just Google it.
Hello yeah i know this that IT can handle spi and i2c… And I connected the bme280 to my i2c bus. So can you please help me how do I setup this device in my openhab to display the values via i2c?
@milo have you looked at the link I posted above. if so, what part are you having issues with?
Lots of good advice here, but if you have a running python script, then I guess there are two ways:
both would require adding some lines to your program and if you use MQTT you would need to install and configure the MQTT broker as well, so maybe in your case REST API is the easiest.
In this post I explained how to do it for a DHT, but for the BME280 the part of the REST API works similar.
You would need 3 lines like:
requests.put('http://192.168.xxx.yyy:8080/rest/items/<YOUR TEMPERATUREITEM>/state',value) .
and you might need to install the ‘requests’ module in Python by
pip install requests
In your items file you then define an item like
Number YOURHUMIDITYITEM "Humidity [%d] <youricon> etc for temperature and pressure. Use
‘f’ rather than ‘d’ if you want decimals.
Okay perfect thanks for the best helping but I got an error
Traceback (most recent call last):
File "./bme280.py", line 173, in <module>
File "./bme280.py", line 171, in main
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 131, in put
return request('put', url, data=data, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 524, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 637, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 469, in send
for i in request.body:
TypeError: 'float' object is not iterable
Number Sensor_BME280_humidity "Systemhumidity" [%f]
can you help ones more??
solved it with
humidity_string = "%.2f" % humidity
great! so everything working now?
If so can you indicate this post as ‘Solved’
Need some help here. The tutorial show how to read value by command line
cat /sys/devices/platform/dht11@0/iio:device0/in_temp_input but this does not exist for i2c.
What is the way to call the values of the bme280 over i2c?