how? You produce python code or use Blockly? At least in Blockly, I don't find a block. I'm trying to use this for a workshop with people who are not fluent in coding -> Blockly.
Posts made by chr1g1
-
RE: MQTT and AWS IoT Support in UiFlow 2.0
-
RE: Atom Matrix with FW 1.13.1 not connecting to AWS
and for completness here my working setup with M5StickC / Plus
Will also followup with AWS details.
-
RE: Atom Matrix with FW 1.13.1 not connecting to AWS
okay some more learnings...
All S3 devices are supported by UIFlow 2.0 only. And UIFlow 2.0 is not yet supporting AWS IoT unless I missed something.
M5StickC Plus is working as a charm. Like M5StickC. I guess I stick with those.My summary as of Feb 2024 and Firmware 1.13.2 and UIFlow 2.0 (Alpha 29):
Forget all new devices that are supported by UIFlow 2.0 only (e.g. *S3) and the small ATOMs if you wanna do AWS IoT stuff. Hope you find this before you bought too many devices...
-
MQTT and AWS IoT Support in UiFlow 2.0
I just did a very nice learning. All S3 devices are supported by UiFlow 2.0 only.
But UiFlow 2.0 doesn't seem to have support for MQTT (even it seemed to be in some Alpha releases I don't find it in v29) and AWS IoT is not supported at all yet.
So, I basically bought useless devices for me without clearly knowing it as at least in the shop I bought it is it not stated that the S3 devices support UiFlow 2.0 only. Do I miss something? -
RE: Atom Matrix with FW 1.13.1 not connecting to AWS
added it as directed above. Still weird behaviour of the Atom Matrix on FW 1.13.2.
Here is the log:
I print out "submitted to aws" after the publish block in the loop.APIKEY: xxx
submitted to aws
[17797] MQTTException -> 128
reconnect start ...
reconnect finish ...
submitted to aws
submitted to aws
submitted to aws
submitted to aws
submitted to aws -
RE: Atom Matrix with FW 1.13.1 not connecting to AWS
Okay - testet the very same code with an MStickC. Runs very smooth without issues. Either there are bugs in the code of the Atom Matrix or the device has just too less resources to handle an external sensor along with an IoT connection.
-
RE: Atom Matrix with FW 1.13.1 not connecting to AWS
Still have the problem. I rebuilt the whole program to make sure there are no "old" blocks in there. Don't even see a connection attempt on AWS (IoT Core with enabled debug logging)
ATOM Matrix
Firmware: 1.13.2Both in Internet and App mode
-- Code --
from m5stack import *
from m5ui import *
from uiflow import *
import wifiCfg
import time
from IoTcloud.AWS import AWS
from libs.json_py import *
import unitrgb.set_screen([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
tvoc_0 = unit.get(unit.TVOC, unit.PORTA)CO2 = None
TVOC = None
H2 = None
Ethanol = NonewifiCfg.doConnect('Guest', 'xxx')
wifiCfg.autoConnect(lcdShow=False)
wait(5)
aws = AWS(things_name='CO2SENSOR', host='xxx.iot.eu-central-1.amazonaws.com', port=8883, keepalive=500, cert_file_path="/flash/res/certificate.pem.crt", private_key_path="/flash/res/private.pem.key")
aws.start()
while True:
CO2 = tvoc_0.eCO2
TVOC = tvoc_0.TVOC
H2 = tvoc_0.H2
Ethanol = tvoc_0.Ethanol
aws.publish(str('m5stack/bla'),str((py_2_json({'CO2':CO2,'TVOC':TVOC,'H2':H2,'Ethanol':Ethanol}))))
print('submitted to AWS')
wait(5)— Serial Log --
submitted to AWS
[10490] MQTTException -> [Errno 9] EBADF
reconnect start ...
reconnect finish ...
[14075] MQTTException -> [Errno 9] EBADF
reconnect start ...
reconnect finish ...
submitted to AWS
[17541] MQTTException -> [Errno 9] EBADF
reconnect start ...
reconnect finish ...
submitted to AWS
[20998] MQTTException -> [Errno 9] EBADF
reconnect start ...
reconnect finish ...
[24577] MQTTException -> [Errno 9] EBADF
reconnect start ...
reconnect finish ...
submitted to AWS -
RE: Atom Matrix with FW 1.13.1 not connecting to AWS
It is still not working... Due to the fact that I'm not receiving anything on AWS, I believe it is connected to the networking on the device.
I see a number of contradicting information and unclear guidance. Here the current approach and questions:
1/ Internet Mode vs. App Mode. Is MQTT/IOT supposed to work in both modes?
2/ How I'm supposed to configure networking on the new firmwares? I see the following options:
wifiCfg.autoConnect(lcdShow=False)
wifiCfg.reconnect()
wifiCfg.doConnect('', '')
wlan.connect('', '')
3/ Playing with different firmwares because I believe this is buggy. -
RE: Atom Matrix with FW 1.13.1 not connecting to AWS
Meanwhile I upgraded to 1.13.2 and still got the same error.
I then added the AWS subscribe block to subscribe to some topic and the error is gone...
However, I don't get any data on AWS IoT Core.
I enabled CloudWatch Log for IoT Core (Settings) and set the log level to debug. I do not see my device connecting?! -
Atom Matrix with FW 1.13.1 not connecting to AWS
Hi all,
I struggle to get my m5stack Atom Matrix to connect to AWS. I double checked the AWS setup including the policy etc. There seem to be a problem with the connection I always get the following error when trying to publish something:
[45944] MQTTException -> [Errno 9] EBADF
reconnect start ...
reconnect finish ...
[48536] MQTTException -> [Errno 9] EBADF
reconnect start ...
reconnect finish ...It also seems there changed some things recently. All examples I find are with a block called "dump to json" but this is no longer available. I work with "create JSON (string) and keys. See the picture.
Code is here:
from m5stack import *
from m5ui import *
from uiflow import *
from IoTcloud.AWS import AWS
from libs.json_py import *
import time
import unitrgb.set_screen([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
tvoc_0 = unit.get(unit.TVOC, unit.PORTA)eCO2 = None
TVOC = None
H2 = None
Ethanol = Noneaws = AWS(things_name='CO2Sensor', host='xxxxxxxxxxx-ats.iot.eu-central-1.amazonaws.com', port=8883, keepalive=60, cert_file_path="/flash/res/co22-certificate.pem.crt", private_key_path="/flash/res/co22-private.pem.key")
aws.start()
print('AWS started')
while True:
eCO2 = tvoc_0.eCO2
TVOC = tvoc_0.TVOC
H2 = tvoc_0.H2
Ethanol = tvoc_0.Ethanol
aws.publish(str('$aws/things/CO2Sensor/co2'),str((py_2_json({'eCO2':eCO2,'TVOC':TVOC,'H2':H2,'Ethanol':Ethanol}))))