Closed palmtreefrb closed 4 years ago
I see 2 problems here: 1) How did you make your sensors be registered this early in the program schedule? This is not the correct way. You are not using "components.py" I presume? 2) I should have made that error message a debug message because it is not actually an error. If the connection is lost, the subscription will automatically be attempted again once the connection is available again. So in the following log lines after the ones you posted, there should be lines like "_subscribing breweryaiss/4c11ae713994/GPIO/15"
Yes, I edited my above post to show my component.py
component.py is not loaded by pysmartnode, only components.py but that is probably what you have. I just checked that again and it's correct, the components.py is loaded this early. but as I was mainly using the esp8266 until recently, I had no connection issues because the esp8266 is typically already connected to the wifi at that point.
But there really is a bug, it doesn't subscribe the topics after connecting. I will fix that asap. Thanks for the report.
Sorry, typo it is components.py
I fixed the issue. Was a simple oversight. I updated the mpy archive in the release with the new mqtt.mpy that fixes the issue. However, that module doesn't use variable annotations so it should work as a .py file too.
Ok, it is working now. Thanks!!!
I'm using the gpio component and it looks like it is subscribing to the topic before mqtt is connected.
component.py
MPY: soft reboot 109952 104784 PySmartNode version 610 started free ram 59232 [2020-04-10 12:16:27] [DS18] [info] Sensor DS18 will publish readings for temperature to topic breweryaiss/4c11ae713994/DS18 free ram 40304 Starting uasyncio loop [2020-04-10 12:16:27] [config] [info] Added module STATS version 1.71 as component STATS [2020-04-10 12:16:27] [MQTT] [error] Error subscribing, lost connection: breweryaiss/4c11ae713994/GPIO/15 [2020-04-10 12:16:27] [DS18] [info] Found new ds18: 28F58C4592030282 [2020-04-10 12:16:32] [STATS0] [info] 37216 [2020-04-10 12:16:32] [MQTT] [info] mqtt connected [2020-04-10 12:16:32] [MQTT] [info] WIFI state True FTP-Server active Connected, local ip '192.168.1.231' Synchronize time from NTP server ... FTP Server started on 192.168.1.231 Set time to (2020, 4, 10, 12, 16, 33, 4, 101) [2020-04-10 12:16:33] [config] [info] Added module DS18 version 3.4 as component ds18 [2020-04-10 12:16:33] [MQTT] [info] (sysname='esp32', nodename='esp32', release='1.12.0', version='v1.12-351-gbd5633778-dirty on 2020-04-08', machine='ESP32 module with ESP32') [2020-04-10 12:16:33] [config] [info] Added module GPIO version 1.11 as component relay [2020-04-10 12:16:33] [MQTT] [info] Client version: 610 [2020-04-10 12:16:53] [STATS0] [info] 32144