i am trying to execute the sample code of this guide https://learn.adafruit.com/mqtt-in-circuitpython, i have updated the libraries and circuitpython is the latest stable version (5.2.0).
I have the following problem: the example with adafruit broker works perfectly. The example where I use an internal broker (mosquito on home assistant, which works great with other clients) doesn't work at all. In particular, it gives me the error: Can't convert 'str' object to bytes implicitly. This happens in all the example files that I found for library.
this is like my code:
- Code: Select all | TOGGLE FULL SIZE
.......... # Connect to WiFi
print("Connecting to WiFi...")
wifi.connect()
print("Connected!") #[b]here work great and the pyportal connect[/b]
# Initialize MQTT interface with the esp interface
MQTT.set_socket(socket, esp)
# Set up a MiniMQTT Client
client = MQTT.MQTT(
broker=secrets["broker"],
)
for the broker, in the secrets file i have add
broker : "MY_IP" --- like 192.168.ecc
for the test i dont have user and password
the broker is up and running.
it seems to be related to the interpretation of the IP address, but I am a complete beginner and I can't solve ....
If i use adafruit io , it works perfectly
Thanks for your help