Search found 51 matches

by beetle
Sun Aug 21, 2022 1:16 pm
Forum: Raspberry Pi microcontroller boards
Topic: Pico W Micro Python MQTT of data to a RP4B
Replies: 62
Views: 573379

Re: Pico W Micro Python MQTT of data to a RP4B

Good to hear you have a running solution and I think you have done very well for such a short time working with Python. For when you may feel ready to up your python game I give you a couple of programs, one incomplete example to run on your PicoW that sends mqtt data relating to sensor readings and...
by beetle
Sat Aug 20, 2022 2:49 pm
Forum: Raspberry Pi microcontroller boards
Topic: Pico W Micro Python MQTT of data to a RP4B
Replies: 62
Views: 573379

Re: Pico W Micro Python MQTT of data to a RP4B

"Right , i tried this (at the bottom and inside the if statements). No cigar. Any help" Not even a quick drag on a ciggy for that amendment :D You are assuming, are you not, that your if the global var is set to True then a print will occur, but the code that sets it to True is, again, only in your ...
by beetle
Sat Aug 20, 2022 1:12 pm
Forum: Raspberry Pi microcontroller boards
Topic: Pico W Micro Python MQTT of data to a RP4B
Replies: 62
Views: 573379

Re: Pico W Micro Python MQTT of data to a RP4B

Your global var only gets set when the on_message function is called (when a mqtt message is received) Your program whips through the setting up of the mqtt stuf and find a print statement to print a global variable is knows nothing about until a mqtt message arrives. So it complains :D and rightly ...
by beetle
Sat Aug 20, 2022 11:51 am
Forum: Raspberry Pi microcontroller boards
Topic: Pico W Micro Python MQTT of data to a RP4B
Replies: 62
Views: 573379

Re: Pico W Micro Python MQTT of data to a RP4B

The code will go into your callback function. def MyMQTT_Callback(): ....the function code and you nominate this function as your MQTT callback by client.on_message = MyMQTT_Callback just as you ended up doing with your client.on_message = on_message3 bit of code. Of course name the function to your...
by beetle
Sat Aug 20, 2022 11:40 am
Forum: Raspberry Pi microcontroller boards
Topic: Pico W Micro Python MQTT of data to a RP4B
Replies: 62
Views: 573379

Re: Pico W Micro Python MQTT of data to a RP4B

Regarding imports - study the following

https://realpython.com/python-import/

which should give you a proper understanding of the subject. It may take a while but it will be worth the effort :D
by beetle
Sat Aug 20, 2022 11:09 am
Forum: Raspberry Pi microcontroller boards
Topic: Pico W Micro Python MQTT of data to a RP4B
Replies: 62
Views: 573379

Re: Pico W Micro Python MQTT of data to a RP4B

I think you are assigning the client.on_message callback incorrectly. As far as I know only one callback is assigned and the effect of your code it to reassign the callback function, ending up with the on_message3 as being the callback that will be used for all messages received. The callback functi...
by beetle
Sun May 15, 2022 4:19 pm
Forum: Programs, Libraries and Tools
Topic: mqtt_as
Replies: 4
Views: 3922

Re: mqtt_as

@davef @pythoncoder Thanks to both for the responses. Currently I had been testing by just bringing down the mqtt broker leaving the network and wifi working ok but I will bring the whole shebang down for a final bit of testing and the network suggestions of davef on wifi may well prove to be needed...
by beetle
Sat May 14, 2022 11:59 pm
Forum: Programs, Libraries and Tools
Topic: mqtt_as
Replies: 4
Views: 3922

mqtt_as

I'm using the excellent mqtt_as library by Peter Hinch @pythoncoder. One issue I am trying to solve is when the program running on an ESP32 automatically starts when the power returns after a power cut. My mqtt broker running on a rpi is not immediately available when the ESP bursts into life as it ...
by beetle
Mon Apr 25, 2022 9:49 pm
Forum: Raspberry Pi microcontroller boards
Topic: mqtt_as Arduino RP2040 Connect
Replies: 25
Views: 17441

Re: mqtt_as Arduino RP2040 Connect

The issues raised in the ticket are now fixed. The Arduino RP2040 Connect with NINA firmware 1.4.8 and today's firmware build now works with the official MQTT library. I have pushed an update to mqtt_as which works with this hardware. I've just downloaded your latest mqtt_as.py to the Arduino RP204...
by beetle
Sat Apr 23, 2022 4:04 pm
Forum: Raspberry Pi microcontroller boards
Topic: mqtt_as Arduino RP2040 Connect
Replies: 25
Views: 17441

Re: mqtt_as Arduino RP2040 Connect

The message about "expected 1.4.8" must be referring to the NINA-W102 module firmware. This can be upgraded using this procedure but (see my posts above) I didn't find this easy. It's worth doing, but it won't fix your problem. The difficulties connecting really shouldn't happen. I think there is n...