Skip to content

Frequent errors in .loop calls with CircuitPython 8 #124

Open
@brucewinter

Description

@brucewinter

No problems with CircuitPython 7, but with 8 I get frequent errors in .loop calls, about 1 error for 5->10 0calls, done once a second.

This is my code:

def mqtt_connect():
    try:
        print("Connecting to mqtt server ...")
#       mqtt_client.connect()
        mqtt_client.reconnect()
        print('Connected :)')
        mqtt_subscribes()
    except Exception as e:
        print("mqtt connect error")
        print(e)

... in loop ...

       ...
        time.sleep(1.0)
        try: 
            mqtt_client.loop()   
        except (ValueError, RuntimeError) as e:
            print("Failed to get data, retrying\n", e)
            wifi.reset()
            mqtt_client.reconnect()
            continue
        except OSError as e:
            print('mqtt OSError')
            print(e.errno)
            print(e)
            print('reconnecting ...')
            mqtt_connect()
        except Exception as e:
            print('mqtt other error')
            print(e)
            print('reconnecting ...')
            mqtt_connect()

This is the error:

New message on topic sensor/Outside Temperature: 76.8
Temp Out: 76.8
mqtt other error

Connecting to mqtt server ...
Connected to mqtt server
Connected :)
Subscribed to ha/heartbeatM with QOS level 0
Subscribed to sensor/Outside Temperature with QOS level 0

I also tried wifi.reset() but got: 'module' object has no attribute 'reset'

The resulting error structure 'e' is empty. Any suggestions?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions