OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Does anyone have a working I2C LCD working? Reply To: Does anyone have a working I2C LCD working?

#78978

RonRN18
Participant

I’ve made a baby step forward in getting ospiLCD-mqtt.py to work. It still doesn’t work but I’ve gotten it to move forward to the next problem. The TypeError: a bytes-like object is required, not 'str' issue is related to the variable named mqttPort. On line #32, the script uses quotations around the port number, which makes the value a string-type variable as opposed to a number. so changing line 32 from reading: mqttPort = "1883" to mqttPort = 1883 gets rid of the error. Unfortunately, it still does not work. I now get:

`
/home/bigron/./ospiLCD-mqtt.py:256: DeprecationWarning: Callback API version 1 is deprecated, update to latest version
client = mqtt.Client()
[Connected with result code 5]
[Connected with result code 5]
`

The LCD display has changed from:

`
Connecting to
MQTT broker…
`

to:

`
MQTT Connected
Requesting Info
`

As you can see from the error now seen, [Connected with result code 5], it is a connection refused error. I believe that it is related to it trying to use MQTT version 1, which has been deprecated. I am learning how to fix this issue now. I just thought I’d share the progress I’ve made.