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 : WebMite MQTT
Page 2 of 2 | |||||
Author | Message | ||||
gghh Newbie Joined: 07/03/2023 Location: United StatesPosts: 13 |
Matthias & Peter I removed my "resubscribe" statements and the connection to my broker has worked without problems for the last 1-1/2 hours. I take sensor readings every 15 minutes and then update my broker every two hours with min, max and current readings for the period. Beebotte is a broker but can be set up to retain data for plotting as well. So far all the functions have worked using the Webmite's built-in "KeepAlive" function. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9128 |
Please could you post an example program for talking to beebotte thanks |
||||
gghh Newbie Joined: 07/03/2023 Location: United StatesPosts: 13 |
Sure. Work calls right now but I'll compose an example this weekend. |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Hi Greg, First of all, thanks for your feedback! Yes, an example program would be great. Is it possible for you to record the communication with WireShark? I despair why the WebMite does not seem to send KeepAlive or I do not see it in WireShark on the network. Matthias |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9128 |
We'll look forward to it Greg - thanks The bit I can't get my head around is the extra layer of Channels and resources. What are the correct fields for connect? APIkey,secret key ? What is the topic for publish and subscribe? Channel token? I've tried various combinations and nothing has worked so far |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 351 |
Peter, I don't understand your questions. Does this help? Are you familiar with this description of MQTT? Or am I completely misunderstanding you? Sometimes this language thing gets on my nerves. Speak German ;-) https://www.hivemq.com/blog/announcing-mqtt-ebook/ Or here directly as PDF without e-mail registration: http://telpar.altervista.org/Arduino/hivemq-ebook-mqtt-essentials.pdf Matthias |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9128 |
Create an account on beebotte then you will |
||||
MikeO Senior Member Joined: 11/09/2011 Location: AustraliaPosts: 275 |
@matherp Hi I have found this will work, I have not been able to get the dashboard within Beebotte to work as yet (not sure I need it anyway). Would prefer to use my HiveMQ but its needs ssl and cert to work, so for the moment beebotte is ok. 'beebotte test post WEB mqtt close pause 100 WEB MQTT Connect "mqtt.beebotte.com",1883, ,"channel_token","channel_token" SetTick 5000,mymqtt Dim test$ ' Do Loop ' Sub mymqtt test$=Time$ Print "sende:";test$, value$=str$(rnd()*100) WEB mqtt publish "test/res",value$,1,1 Print value$ End Sub Codenquilts |
||||
gghh Newbie Joined: 07/03/2023 Location: United StatesPosts: 13 |
@matherp Over the weekend I pared down my working MQTT project to a minimal example. It shows how to connect and use MQTT on the Beebotte broker. I remembered how difficult it was for me to get different brokers and software clients to work. I think I've figured out why. I want to answer the questions you asked about Beebotte. I'll try to do so in a way that helps newbies as well (like myself). If you think a 90 line example of both publishing and subscribing would be useful, I'll post it. MQTT is actually a very simple and elegant messaging protocol. But it doesn't specify how a broker manages their user accounts and logins. That is one source of confusion as you try different brokers. 1) Beebotte has four different credentials for account authorization - API KEY, CHANNEL TOKEN, SECRET KEY and AM TOKEN. The Webmite's "Connect to Broker" command is: WEB MQTT CONNECT ip_address$,port, username$, password$ [, interrupt] I've found that using your account's "Secret Key" for both username$ and password$ works. For example: WEB MQTT CONNECT "mqtt.beebotte.com",1883,secretKey,secretKey,myInterrupt 2) MQTT wants you to supply a "topic" and a value for the topic when you publish a message. The structure of a topic is well defined: "topic/subtopic/subtopic ..." This structure lets one person subscribe to every message in a topic while another receives only a subset of the messages (by subscribing to "topic/subtopic", etc). But Beebotte has "channels" and "resources". If you look at examples, it appears that they specify the subject of a message as "channel/resource". In other words, they use their own terms for the standard MQTT "topic" structure. "Channel" is the first level of the topic. "Resource" is the second level. 3) The MQTT protocol describes a basic method to leave messages on a server (broker) so anyone with an account can subscribe to receive all messages of a topic that they are interested in. If I am correct, that is its full purpose, and little if any data from messages are retained. Also, if you publish a message, you may assign it any topic on the fly. The broker does not need to know the topic in advance. Some brokers offer enhanced capabilities, such as retaining the data you send. Some offer charting capabilities as well. Of the three brokers I have tried that do this, they all do it differently. This adds another level of confusion. I believe this is why Beebotte has "channels" and "resources". You must define in advance topics whose data is to be saved. To get started using MQTT with the Webmite, I recommend using just the basic MQTT functions for publishing messages and/or subscribing and receiving them. - MQTT has just a few variables that you can specify to modify its function. - Get to know these basics using Webmite's MQTT commands. - Later, if you want to use a broker that retains and charts your data, you will know the difference between the core MQTT functions and the broker's enhanced functions and commands. I hope this helps and feel free to correct me where I've been wrong. |
||||
Page 2 of 2 |
Print this page |