Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:42 29 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 alphas a14+, now with added Telnet

     Page 5 of 5    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9133
Posted: 07:22pm 18 Feb 2023
Copy link to clipboard 
Print this post

Trivial interlock missing - I made the assumption that if you were using the firmware on a pico_w you would enable wifi
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9133
Posted: 07:49pm 18 Feb 2023
Copy link to clipboard 
Print this post

Question:

If I was to implement a basic MQTT capability, does it need anything other than a publish command?

Sub is much more complicated as MMbasic would have to set up a background watch and trigger yet another interrupt if it sees a message

Thoughts?
 
bigfix
Senior Member

Joined: 20/02/2014
Location: Austria
Posts: 128
Posted: 08:57pm 18 Feb 2023
Copy link to clipboard 
Print this post

Publish with the Retain bit set allows to have the last published topic/message stored at the Broker, even if there are no current subscribers

A new subscriber would then grab the last published topic from the broker

As a minimum implementation I would think that a "onetime" SUB which is only triggered on demand would work, as long as the topic was published with the retain option
Realtime depends then on the repetition rate

I do not know if the default clients use the retain option, but in a controlled environment it could work

i.e. Tasmota as a very common sensor/actor SW has a rather fine granularity for retain usage  
Tasmota MQTT


It is a long time since I played with MQTT - so my knowledge may be outdated...
Edited 2023-02-19 07:02 by bigfix
 
led-bloon

Senior Member

Joined: 21/12/2014
Location: Australia
Posts: 205
Posted: 09:57pm 18 Feb 2023
Copy link to clipboard 
Print this post

@matherp - Peter
  Quote  V5.07.07a17
There are three conditions that are now handled

Additional error when WEB browser disconnects during file transfer.
(TCP server set with/without the timeout value)
Following does not come up immediately, but after another
HTTP request is received, from any source.
  Quote  WEB TRANSMIT FILE a%,"ON.jpg","image/jpeg"
Error : No response to request from connection no. 0

At this point the PicoMiteW has returned to the command prompt,
BUT does not respond to commands over USB. The LED still flashes,
the WiFi is still active. Pings to PicoMiteW ok BUT very slow
(average 760 mSecs ilo 3.2 mSecs).
A power-cycle (or reset?) only avenue to recover.

Also ran over-night. Two WEB browsers, 7000+ pages served. All good.
led
Miss you George
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9133
Posted: 12:08pm 19 Feb 2023
Copy link to clipboard 
Print this post

Quick update

I've now got a MQTT client running and can publish a message.
HOWEVER in order to make it useful I now need to try and get TLS running so we can connect to secure websites (HTTPS port 443 or in the case of MQTT port 8883)
This could take some time and more RAM memory    
 
LucV

Regular Member

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

@ matherp - Peter
@ bigfix

Hi, I am new at this forum, but have been lurking for several months now.
And as a newbee I do not want to be cheeky but I do want to add something to the discussion on MQTT.

Bigfix's idea has some value however that would only be usefull for new subscribers if I am not mistaking. The subscriber will not get new values if the broker gets a new value.
Especially for IOT projects this will limit the value for MQTT. If you would for example build a lamp with a Picomite then you would not be able to put it on and off as the Pico would not get the latest info from the broker.

If it is to complicated leave MQTT out. There are other options.

BTW if testing is required: I have my own local broker running on a Raspberry Pi.

Luc
Luc's tech Blog
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 351
Posted: 01:12pm 19 Feb 2023
Copy link to clipboard 
Print this post

It runs very stable for me!

> option list
PicoMite MMBasic Version 5.07.07a18
OPTION COLOURCODE ON
OPTION WIFI xxx, *****************
OPTION TCP SERVER PORT 80
OPTION TELNET CONSOLE ON
>

Test of a string: mystring is 17-02-2023 21:48:41
Test of a string: mystring is 17-02-2023 22:24:00
Test of a string: mystring is 18-02-2023 08:54:42
Test of a string: mystring is 18-02-2023 15:32:16
Test of a string: mystring is 18-02-2023 17:25:44
Test of a string: mystring is 18-02-2023 17:48:39
Test of a string: mystring is 18-02-2023 18:11:40
Test of a string: mystring is 19-02-2023 01:16:44
Test of a string: mystring is 19-02-2023 09:11:06
Test of a string: mystring is 19-02-2023 14:02:34


  matherp said  Quick update
...
This could take some time and more RAM memory    


Is there a way to add functionality when needed? And otherwise keep the memory as large as possible?
Does the suggestion from the other thread work?



https://www.thebackshed.com/forum/ViewTopic.php?TID=15582&P=2
  robert.rozee said  
  Mixtel90 said  That program space is shrinking....   :(


as far as i am aware, individual program size is limited by the amount of RAM available to the editor in order to edit it. however, while the editor is running there are a number of routines present in RAM, that while needed by the interpreter, are not used by the editor.

therefore, i wonder if there is some way to 'bump' routines declared as "__not_in_flash_func" out or RAM while the editor is running, then reload them upon exiting the editor so that they are again available to the interpreter. to this end, i've posted a question on the pico forums:
https://forums.raspberrypi.com/viewtopic.php?t=347663

i'm picking it would probably be necessary for the set of 'bumped' routines to reside in RAM contiguous with the block of RAM the editor uses for its buffer, but how to achieve this is another question.


cheers,
rob   :-)
 
bigfix
Senior Member

Joined: 20/02/2014
Location: Austria
Posts: 128
Posted: 02:45pm 19 Feb 2023
Copy link to clipboard 
Print this post

  Quote  Especially for IOT projects this will limit the value for MQTT. If you would for example build a lamp with a Picomite then you would not be able to put it on and off as the Pico would not get the latest info from the broker.


Agree, for direct realtime interaction with a client you would need to poll the Broker at relatively short time intervals.

However there are many use cases where every minute or more would be fine
i.e. a local weatherstation or PV/battery Controller which publishes current state to various subscribers in the house

MQTT is often just a standard way to store and retrieve data

If the choice is between no SUB or a polled SUB, I rather go for polled/triggered

About TLS
Many people try to avoid dependence on external (Cloud) services and run everything local on their own network
With a local MQTT Broker I do not care about TLS for typical home useage
A relatively high poll rate would also not matter much in local LANs/Brokers

If it makes any sense from a resource saving view, I could imagine TLS and interrupt driven SUB as configurable options - off by default
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 351
Posted: 07:14pm 19 Feb 2023
Copy link to clipboard 
Print this post

addendum:

here is how i can crash the PicoMite W with the a18.
Launch.
Access with FireFox, so far ok.
Further access via ncat, also still ok.
Then in alternation, works.
BUT then close the TAB in FireFox and in the same FF open a new TAB to the PicoMite WebServer and the Pico gets out:


> option list
PicoMite MMBasic Version 5.07.07a18
OPTION COLOURCODE ON
OPTION WIFI xxx, *****************
OPTION TCP SERVER PORT 80
OPTION TELNET CONSOLE ON
> load "server2"
> run
ntp address 129.70.132.32
got ntp response: 19/02/2023 20:05:21
_________________________________________________
1: GET / HTTP/1.1
Host: 192.168.1.109
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive
Upgrade-Insecure-Requests: 1


_________________________________________________
1      : String is     GET / HTTP
sending page
_________________________________________________
1: POST / HTTP/1.1
Host: 192.168.1.109
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 6
Origin: http://192.168.1.109
Connection: keep-alive
Referer: http://192.168.1.109/
Upgrade-Insecure-Requests: 1

led=on
_________________________________________________
1      :  488  led=on
String is       POST / HTTP
sending page
_________________________________________________
1: small

_________________________________________________
1      : _________________________________________________
2: POST / HTTP/1.1
Host: 192.168.1.109
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 6
Origin: http://192.168.1.109
Connection: keep-alive
Referer: http://192.168.1.109/
Upgrade-Insecure-Requests: 1

led=on
_________________________________________________
2      :  488  led=on
String is       POST / HTTP
sending page
_________________________________________________
1: xxx

_________________________________________________
1      : _________________________________________________
1: xxx

_________________________________________________
1      : _________________________________________________
1: xxx

_________________________________________________
1      : _________________________________________________
2: POST / HTTP/1.1
Host: 192.168.1.109
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 6
Origin: http://192.168.1.109
Connection: keep-alive
Referer: http://192.168.1.109/
Upgrade-Insecure-Requests: 1

led=on
_________________________________________________
2      :  488  led=on
String is       POST / HTTP
sending page
_________________________________________________
1: xxx#

_________________________________________________
1      : _________________________________________________
1: yy

_________________________________________________
1      : _________________________________________________
1:

_________________________________________________
1      : _________________________________________________
2: POST / HTTP/1.1
Host: 192.168.1.109
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: de,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 6
Origin: http://192.168.1.109
Connection: keep-alive
Referer: http://192.168.1.109/
Upgrade-Insecure-Requests: 1

led=on
_________________________________________________
2      :  488  led=on
String is       POST / HTTP
sending page
[35] s$=""
Error : No response to request from connection no. 0
>

 
NPHighview

Senior Member

Joined: 02/09/2020
Location: United States
Posts: 200
Posted: 06:20pm 04 May 2023
Copy link to clipboard 
Print this post

First of all, I am once again floored by the intensity and quality of the work that Peter, LucV, and thwill are doing to advance the MMBasic software for the Pico family. Thank you!

With no luck, I've scoured the forums for a version of a PicoW manual that lists the WEB commands & syntax, and all the new configuration options.  Can anyone point me to such a document or forum topic?

Thank you!
Live in the Future. It's Just Starting Now!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9133
Posted: 06:39pm 04 May 2023
Copy link to clipboard 
Print this post

Full release and manuals should be out in the next couple of days
Edited 2023-05-05 04:39 by matherp
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 722
Posted: 09:11pm 04 May 2023
Copy link to clipboard 
Print this post

     
 
     Page 5 of 5    
Print this page


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

© JAQ Software 2024