Search found 16 matches

by marine_hm
Tue Dec 28, 2021 2:10 pm
Forum: ESP8266 boards
Topic: How to subscribe to multiple MQTT topics?
Replies: 7
Views: 24897

Re: How to subscribe to multiple MQTT topics?

Yeah, I think that was a senior moment. I clicked on the link. Then I copied the mqtt_as.py, saved it both on my pc and the microcontroller. Now, How to incorporate that into my script....? Don't answer that just yet, I'm thinking out loud. If you don't hear from me for a week or two, then, I may ne...
by marine_hm
Tue Dec 28, 2021 2:02 pm
Forum: ESP8266 boards
Topic: How to subscribe to multiple MQTT topics?
Replies: 7
Views: 24897

Re: How to subscribe to multiple MQTT topics?

I and Kevin Köck developed mqtt_as. This does support multiple subscriptions. Please excuse my ignorance. But, is mqtt_as a module? I am using Thonny. How do I get mqtt_as onto my microcontroller as part of Micropython? Does that just import on THAT microcontroller and I have to import it on every ...
by marine_hm
Sat Dec 25, 2021 7:01 pm
Forum: ESP8266 boards
Topic: I would like some MORE assistance with Micropython/MQTT.
Replies: 6
Views: 25725

Re: I would like some MORE assistance with Micropython/MQTT.

I'm pretty sure I don't have to re-write to the entire screen just to update the temp data. How would I go about keeping the top line "Playroom" and just refresh the temperature? Ideally, I shouldn't need to update the temp as frequently as I have here. Probably every 15 minutes would be more realis...
by marine_hm
Thu Dec 23, 2021 4:46 am
Forum: ESP8266 boards
Topic: I would like some MORE assistance with Micropython/MQTT.
Replies: 6
Views: 25725

Re: I would like some MORE assistance with Micropython/MQTT.

Peter; Thank you so very much. That was what I was looking for. Without my Wifi login, here's the final script. I just got in an OLED display that plugs right on top of the ESP8266. Header pins soldered, a little bit of fiddling to get the code just right... Came out pretty nice. ###################...
by marine_hm
Fri Dec 17, 2021 3:37 pm
Forum: ESP8266 boards
Topic: I would like some MORE assistance with Micropython/MQTT.
Replies: 6
Views: 25725

I would like some MORE assistance with Micropython/MQTT.

Everything is working well. BUT, Id like to learn how to format the decimal places when "publishing" to MQTT. Or should I worry about that on the subscribing/working end? As in my sensor script, (with help) I got it to display the temp with just one decimal space in the REPL 87.7 But, when it publis...
by marine_hm
Fri Dec 10, 2021 2:49 pm
Forum: ESP8266 boards
Topic: How to subscribe to multiple MQTT topics?
Replies: 7
Views: 24897

Re: How to subscribe to multiple MQTT topics?

Hmmmm.
Another option is to have one topic and signal your intent with different messages.
You mean something like?:
Topic = Relay

Messages =
  • Relay1OFF
    Relay1ON
    Relay2ON
    Relay2OFF
I would then need 4 "IF msg==:" statements?
by marine_hm
Fri Dec 10, 2021 2:42 pm
Forum: ESP8266 boards
Topic: How to subscribe to multiple MQTT topics?
Replies: 7
Views: 24897

Re: How to subscribe to multiple MQTT topics?

To show you how it was done using Arduino IDE: Once subscribed to both topics, then activate each Relay separately. // ******************* RELAY 1 ***************************** if (strcmp(topic, "Relay1") == 0) { for (int i = 0; i < length; i++) { char receivedChar = (char)payload[i]; if (receivedCh...
by marine_hm
Thu Dec 09, 2021 3:39 pm
Forum: ESP8266 boards
Topic: How to subscribe to multiple MQTT topics?
Replies: 7
Views: 24897

Re: How to subscribe to multiple MQTT topics?

When I do that, it says it's subscribed to Relay2. Maybe I did it right with this and it's only saying subscribed to relay2 but actually subscribing to both? client.subscribe("Relay1"), ("Relay2") I was too focused on just the REPL and not the outcome when run, sending messages to the MQTT server. I...
by marine_hm
Thu Dec 09, 2021 2:37 am
Forum: ESP8266 boards
Topic: How to subscribe to multiple MQTT topics?
Replies: 7
Views: 24897

How to subscribe to multiple MQTT topics?

I'm struggling. I'm going to keep at it until I get there! Here's my code so far: # *****ASSIGN VARIABLES*****************# # RELAY 1 rel1 = machine.Pin(05, machine.Pin.OUT) # ASSIGN OBJECT NAME TO GPIO PIN 05(D1), OBJECT IS AN OUTPUT. rel1(0) # TURN OFF RELAY AT STARTUP topic = "Relay1" # MQTT TOPI...
by marine_hm
Tue Dec 07, 2021 5:36 am
Forum: ESP8266 boards
Topic: MQTT Subscribe WORKING SCRIPT
Replies: 0
Views: 4824

MQTT Subscribe WORKING SCRIPT

# MQTT Subscribe # By: Nick Sebring # 11-20-2021 # *****IMPORT NECESSARY MODULES******** # import machine import network import time from umqtt.simple import MQTTClient # *****CONNECT TO NETWORK************** # wlan = network.WLAN(network.STA_IF) wlan.connect('YOUR_SSID', 'YOUR_PASSWORD') wlan.acti...