Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PicoMiteWeb V5.07.07a20: Now with added MQTT
Author | Message | ||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
V5.07.07a20 PicoMiteWebV5.07.07a20.zip New commands WEB MQTT CONNECT ip_address$, port, username$, password$ [, interrupt] WEB MQTT PUBLISH topic$, message$, [,qos] [,retain] qos defaults to 1 - valid 0, 1, or 2 retain defaults to 0 - valid 0 or 1 WEB MQTT SUBSCRIBE topic$ [,qos] qos defaults to 0 - valid 0, 1, or 2 - don't ask me what it does WEB MQTT UNSUBSCRIBE topic$ WEB MQTT CLOSE MM.TOPIC$ 'contains the last topic received MM.MESSAGE$ 'contains the last message received example program WEB ntp WEB mqtt close WEB mqtt connect "192.168.1.108", 1883, "mqtt", "*****", myint WEB mqtt subscribe "thermo" Do Bitbang humid gp1,a,b,1 WEB mqtt publish "thermo","The temperature at "+Time$+" is "+Str$(a) Pause 2000 Loop ' Sub myint Print mm.topic$,":",mm.message$ End Sub I've tested it on a MOSQUITTO broker running on my PC (easy to get up and running) At the moment does not support TLS port 8883 Edited 2023-02-22 05:56 by matherp |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
Just started to learn about MQTT. QOS=Quality Of Service. |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
QoS level 0 Quality of Service (QoS) level 0 means messages are sent without any confirmation from the receiver. This means it is possible for a message to get lost, given an unreliable connection. QoS level 1 QoS level 1 means the receiver must send a confirmation to let the sender know that the message was received. However, with QoS 1, the receiver may get a single message multiple times. This QoS level ensures that a message makes it from sender to receiver but fails to ensure that it is received exactly once. QoS level 2 QoS level 2 uses a four-step communication process to ensure a message is sent exactly once only, which can be necessary depending on the use case. Source: https://elearning.easygenerator.com/ |
||||
grroel.tech Newbie Joined: 09/12/2021 Location: SpainPosts: 12 |
Hello, Good job, the MQTT works fine: It is a pity that PicoMite does not have support for the BME280 sensor. Best regards. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9129 |
There is Basic code for the BME280 on this site somewhere. My question about QOS is what setting it in Subscribe does. I. Understand its use in publish. |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
BME280 |
||||
RonnS Senior Member Joined: 16/07/2015 Location: GermanyPosts: 120 |
and it works fine |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
I am also using it since a few years back. Thanks to Peter! |
||||
LucV Regular Member Joined: 19/02/2023 Location: NetherlandsPosts: 62 |
Great job Peter !! Fantastic !!! Runs without a problem. I am using my own Raspberry Pi Zero W as a broker. Publish and subscribe without a problem. I only saw that the username and password are required even if the broker does not use them. So I filled 11 in as username and 11 as password. Thank you Luc's tech Blog |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
If I understand correctly, a subscriber can also demand the level of "QoS" (Quality of Service). If the subscriber demands QoS=1, the subscriber demands that the message will be repeatedly sent until the subscriber sends an Acknowledge (PUBACK,publish acknowledgment) back to the "broker". For QoS=0 no Acknowledgement is required by the subscriber. Not sure if the MQTT-broker can overrun the QoS wishes of the subscriber. |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Hi Luc, Can you have a look here? Thanks. https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=16080 Matthias |
||||
Print this page |