Skip to content

integration with Adafruit_CircuitPython_MiniMQTT is too fragile #98

Closed
adafruit/Adafruit_CircuitPython_MiniMQTT
#55
@flavio-fernandes

Description

@flavio-fernandes

When using pyportal's get_local_time() (and likely fetch()), there
seems to be incompatibilities with MiniMQTT. In the example code.py:

https://github.com/flavio-fernandes/pyportal_station/blob/41af3587d39d01f4ccfd93b41ed8c7ab9ec8986c/code.py#L240-L264

I see that calling pyportal.get_local_time() after client.loop() causes
the error below. My current suspicion is that when pyportal code
does "self._connect_esp()", it rubs MiniMQTT in a bad way. Any attempts
MQTT make to write (ping or publish) after pyportal.get_local_time() no
longer work.

48129.0: DEBUG - Sending PINGREQ
48129.1: DEBUG - Checking PINGRESP
.Sun, 3/Jan/2021 8:50 pm
...Sun, 3/Jan/2021 8:50 pm
..48189.3: DEBUG - KeepAlive period elapsed -                                    requesting a PINGRESP from the server...
48189.3: DEBUG - Sending PINGREQ
48189.3: DEBUG - Checking PINGRESP
.Sun, 3/Jan/2021 8:51 pm
...Sun, 3/Jan/2021 8:51 pm
.20:51:46 Interval localtime triggered
Getting time for timezone America/New_York
struct_time(tm_year=2021, tm_mon=1, tm_mday=3, tm_hour=20, tm_min=51, tm_sec=55, tm_wday=7, tm_yday=3, tm_isdst=None)
.48249.6: DEBUG - KeepAlive period elapsed -                                    requesting a PINGRESP from the server...
48249.6: DEBUG - Sending PINGREQ
48249.6: DEBUG - Checking PINGRESP
.Sun, 3/Jan/2021 8:52 pm
.Failed mqtt client loop: Error response to command
Failed mqtt client loop: Error response to command
Failed mqtt client loop: Error response to command
.Failed mqtt client loop: Error response to command
Failed mqtt client loop: Error response to command
Failed mqtt client loop: Error response to command
Failed mqtt client loop: Error response to command
.Sun, 3/Jan/2021 8:52 pm
Failed mqtt client loop: Error response to command
.Failed mqtt client loop: Error response to command
Failed mqtt client loop: Error response to command
Failed mqtt client loop: Error response to command
Failed mqtt client loop: Error response to command
Failed mqtt client loop: Error response to command
.Failed mqtt client loop: Error response to command
48312.3: DEBUG - KeepAlive period elapsed -                                    requesting a PINGRESP from the server...
48312.3: DEBUG - Sending PINGREQ
Failed mqtt client loop: Error response to command
20:53:6 Interval send_status triggered
48321.3: DEBUG - Sending PUBLISH
Topic: /pyportalkitchen/temperature
Msg: b'74.8062'                                
QoS: 0
Retain? False
Error in send_status, retrying in 10s - Failed to send 2 bytes (sent 0)
48321.3: DEBUG - KeepAlive period elapsed -                                    requesting a PINGRESP from the server...
48321.3: DEBUG - Sending PINGREQ
Failed mqtt client loop: Failed to send 2 bytes (sent 0)
.Sun, 3/Jan/2021 8:53 pm
.48324.3: DEBUG - KeepAlive period elapsed -                                    requesting a PINGRESP from the server...
48324.3: DEBUG - Sending PINGREQ
Failed mqtt client loop: Failed to send 2 bytes (sent 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions