Comments on: MicroPython: MQTT – Publish BME680 Sensor Readings (ESP32/ESP8266) https://randomnerdtutorials.com/micropython-mqtt-publish-bme680-esp32-esp8266/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Tue, 21 Jun 2022 10:31:17 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: dukora53 https://randomnerdtutorials.com/micropython-mqtt-publish-bme680-esp32-esp8266/#comment-763956 Tue, 21 Jun 2022 10:31:17 +0000 https://randomnerdtutorials.com/?p=99498#comment-763956 In reply to Daniel Escasa.

Sir, thanks a lot for your advice and comments, except for the very last sentence, do you think you invented the wheel? Man learns all his life.

]]>
By: Daniel Escasa https://randomnerdtutorials.com/micropython-mqtt-publish-bme680-esp32-esp8266/#comment-714696 Wed, 29 Dec 2021 06:49:16 +0000 https://randomnerdtutorials.com/?p=99498#comment-714696 Hmm…

Lines following the if and except *OSError statements are supposed to be indented
print(pres) and print(gas) were supposed to be commented out.

Look like there’s still a lot to learn about your commenting setup

]]>
By: Daniel Escasa https://randomnerdtutorials.com/micropython-mqtt-publish-bme680-esp32-esp8266/#comment-714695 Wed, 29 Dec 2021 06:48:51 +0000 https://randomnerdtutorials.com/?p=99498#comment-714695 In reply to Daniel Escasa.

Hmm…

Lines following the if and except *OSError statements are supposed to be indented
print(pres) and print(gas) were supposed to be commented out.

Look like there’s still a lot to learn about your commenting setup

]]>
By: Daniel Escasa https://randomnerdtutorials.com/micropython-mqtt-publish-bme680-esp32-esp8266/#comment-714694 Wed, 29 Dec 2021 06:45:00 +0000 https://randomnerdtutorials.com/?p=99498#comment-714694 Just curious about this:
if (time.time() – last_message) > message_interval:
temp, hum = read_dht_sensor() // my mod, using a DHT11
print(temp)
print(hum)

print(pres) // my mod as well, including the next line

print(gas)

client.publish(topic_pub_temp, temp)
client.publish(topic_pub_hum, hum)
last_message = time.time() time.sleep(30)

except OSError as e:
restart_and_reconnect()

Why not use time.sleep() instead of comparing (time.time() – last_message) with message_interval? I used sleep(message_interval) and seem to be getting the same results

]]>
By: Daniel Escasa https://randomnerdtutorials.com/micropython-mqtt-publish-bme680-esp32-esp8266/#comment-708146 Fri, 10 Dec 2021 01:37:38 +0000 https://randomnerdtutorials.com/?p=99498#comment-708146 Here’s a tip, for this and previous and future code:

Click on the [View Raw Code] button. That’ll open up the code in a new tab.
Save the page — Ctrl-S should be the easiest way.
Select the directory where you want to save the file. The filename’s already provided by default, e.g., umqttsimple.py
Open your favorite IDE and load the file

]]>
By: Icons https://randomnerdtutorials.com/micropython-mqtt-publish-bme680-esp32-esp8266/#comment-637657 Tue, 29 Jun 2021 06:53:54 +0000 https://randomnerdtutorials.com/?p=99498#comment-637657 I didn’t figure out how to change the vertical and horizontal layout of icons in the NR Dashboard. Thanks.

]]>
By: Mauro https://randomnerdtutorials.com/micropython-mqtt-publish-bme680-esp32-esp8266/#comment-560184 Sun, 21 Feb 2021 10:52:10 +0000 https://randomnerdtutorials.com/?p=99498#comment-560184 For me occured that my mqtt broker is required username and password, but in explication you appointed:

“If your MQTT broker requires username and password, you should use the following line to pass your broker username and password as arguments.

client = MQTTClient(client_id, mqtt_server, user=your_username, password=your_password)”

Not that simple, have used follow code:

client = MQTTClient(client_id, mqtt_server, user=b’your_username’, password=b’your_password’)

]]>
By: luiz https://randomnerdtutorials.com/micropython-mqtt-publish-bme680-esp32-esp8266/#comment-513664 Tue, 03 Nov 2020 12:53:34 +0000 https://randomnerdtutorials.com/?p=99498#comment-513664 Very clear. Thanks a lot!

]]>
By: Kussoy https://randomnerdtutorials.com/micropython-mqtt-publish-bme680-esp32-esp8266/#comment-513663 Tue, 03 Nov 2020 12:53:27 +0000 https://randomnerdtutorials.com/?p=99498#comment-513663 Thank you for sharing

]]>