quickstart with MQTT help needed - Page 1
Forum section: electronics / general

author: free_electron
author_rank: Super Contributor
timestamp: August 09, 2021, 04:11:30 pm
content: So , i have a board ( esp32) and an entire stack that can subscribe an MQTT broker, login , password, encryption and send / receive. so i am good on that end.the other end is the trouble. i do not want to run my own server.- are there any free mqtt broker services where i can create a userspace, set a username and password and enroll my device- do they have a simple user interface where i can basically open a webpage , login and have a 'console' so i can type in a something and hit 'send' , and see what comes back ? basically a serial port over mqtt...- how do i create an application , on a windows pc, in visual basic (running inside excel) , where i can send a message to my device somewhere on the internet. again , the only thing i need is raw transport. here, send this string to my target. and if something comes back, give me the string. basically i want to make a small spreadsheet in excel where i can enter some numbers in a grid and have a button that sends them over.i don't need multiple targets , my device does not send something unless asked. and it is a one off thing ( sprinkler controller ) the grid is basically valve number, start time and durationso to 'upload' a timer program i just send a list where each mqtt message is <command><programnumber><linenumber>,<valvenumber>,<starttime>,<runtime>for example :PA00109220002 : Program A line 001 valve 09 starts at 22:00 and runs for 2 minutesPA00208220209 : program a line 002 valve 8 starts at 22:02 and rus for 9 minutesPA00301220401 : program a line 3 valve 1 starts at 22:04 and runs 1 minutes , so this valve opens 2 minutes after 8 is on for one minute and then closes. valve 8 keeps going (valve 1 is a fertilizer injector. we water 2 minuts, inject fertilizer in the line for a minute then keep regular water for the remainder.and so oni have room for 10 programs ( abcdefghij ) each with 100 linesthereis another commandRA8F Run program A monday thru sunday ( 8F ) is hex notation whre each bit in the 7 bit word is a day of the week (0SMTWTFS). so mondayt and friday would be 00100010 -> RA22third command TTDHHMMSS : D = day of week , hours minutes seconds. this sets the internal clock. date is irellevant. it only needs ot know what day of the week we areLx : List program XOxx : open valve xxC xx close valve xxS : show schedule for the 10 programsD0 : debug offD1 debug on : sends mqtt message every time a valve toggles.NVV<16chars> name valve VV with name <name>so my mqtt commands are very shorts strings and they are only used to send the programs and schedule. during operation there is no messages being sent. i can have a debug mode. in debug mode it tells you<timestamp> <valve name> <new state>22:02 Fruittrees off22:02 Palmtrees on22:04 Fertilizer on22:04 Fertilizer off22:11 Palmtrees offAny leads how to jumpstart this ?i basically need a very simple send and receive routine.send this stringif something comes back : invoke a callback so i can print it to a debug textbox.something along the lines ofhandle = MQTTconnect(username,password,device)MQTTsend(handle, string)event MQTTreceive()print MQTTresponse

author: gmb42
author_rank: Frequent Contributor
timestamp: August 10, 2021, 09:52:43 am
content: Maybe some helphere.