Bme680-mqtt

Hi all
I modified the Pimoroni example code to publish the BME680 data over MQTT, so it is easy to integrate into your favourite home automation platforms. Let me know if this is useful :-)

2 Likes

I’m now using the BME680 with a micropython board, and combining it with a leak sensor. Write up on Hackster:

Dear Robin or other reader, as so often I’m having trouble again.
After getting my BME680 working, I tried your code. Sadly after I execute the code with:

python bme680-air-quality-RC.py

I get the following message:

Estimate indoor air quality

Runs the sensor for a burn-in period, then uses a
combination of relative humidity and gas resistance
to estimate indoor air quality as a percentage.

Press Ctrl+C to exit

Traceback (most recent call last):
File “bme680-air-quality-RC.py”, line 24, in
client.connect(broker)
File “/home/pi/.local/lib/python2.7/site-packages/paho/mqtt/client.py”, line 941, in connect
return self.reconnect()
File “/home/pi/.local/lib/python2.7/site-packages/paho/mqtt/client.py”, line 1075, in reconnect
sock = self._create_socket_connection()
File “/home/pi/.local/lib/python2.7/site-packages/paho/mqtt/client.py”, line 3546, in _create_socket_connection
return socket.create_connection(addr, source_address=source, timeout=self._keepalive)
File “/usr/lib/python2.7/socket.py”, line 557, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known

I searched the internet but the error mainly has something to do with no Internet/DNS problems, which shouldn’t be possible because the Pi is connected to the internet, and the MQTT server is hosted on http://192.168.1.6:8123/ (My Home Assistant Pi).

Any ideas?

You are using python 2.7, but 3+ is required

1 Like

Thank you! I already found it out by myself (and anyways switched to Cayenne).