Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:49 28 Nov 2024 Privacy Policy
Jump to

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 Kingdom
Posts: 9129
Posted: 07:46pm 21 Feb 2023
Copy link to clipboard 
Print this post

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: Finland
Posts: 359
Posted: 08:16pm 21 Feb 2023
Copy link to clipboard 
Print this post

Just started to learn about MQTT. QOS=Quality Of Service.
  Quote  MQTT can send messages with different so-called "Quality of Service" levels.
This means the publisher and subscriber can choose how reliably a message will be sent.
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 359
Posted: 08:19pm 21 Feb 2023
Copy link to clipboard 
Print this post

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: Spain
Posts: 12
Posted: 01:07pm 22 Feb 2023
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 9129
Posted: 01:22pm 22 Feb 2023
Copy link to clipboard 
Print this post

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: Finland
Posts: 359
Posted: 01:54pm 22 Feb 2023
Copy link to clipboard 
Print this post

BME280
 
RonnS
Senior Member

Joined: 16/07/2015
Location: Germany
Posts: 120
Posted: 05:52pm 22 Feb 2023
Copy link to clipboard 
Print this post

and it works fine
  Pluto said  BME280
 
Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 359
Posted: 07:12pm 22 Feb 2023
Copy link to clipboard 
Print this post

I am also using it since a few years back. Thanks to Peter!
 
LucV

Regular Member

Joined: 19/02/2023
Location: Netherlands
Posts: 62
Posted: 07:45pm 22 Feb 2023
Copy link to clipboard 
Print this post

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: Finland
Posts: 359
Posted: 09:00pm 22 Feb 2023
Copy link to clipboard 
Print this post

  matherp said  My question about QOS is what setting it in Subscribe does. I. Understand its use in publish.


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: Germany
Posts: 351
Posted: 06:16pm 29 Jul 2023
Copy link to clipboard 
Print this post

  LucV said  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



Hi Luc,

Can you have a look here? Thanks.
https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=16080

Matthias
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024