hjelev / rpi-mqtt-monitor

Raspberry Pi MQTT Monitor gathers system information and sends it to a MQTT server.
GNU General Public License v3.0
155 stars 41 forks source link

DeprecationWarning: Callback API version 1 is deprecated #108

Closed WirthmU closed 2 months ago

WirthmU commented 2 months ago

I get the following error:

(foobar) pi@meteotux:~/rpi-mqtt-monitor $ python3 /home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py -d

:: rpi-mqtt-monitor
   Version: 0.8.9

:: Device Information
   Model Name: Raspberry Pi 4 Model B Rev 1.2
   Manufacturer: Raspberry Pi
   OS: Debian GNU/Linux 12 (bookworm)
   Hostname: meteotux
   IP Address: 192.168.1.182
   MAC Address: DC-A6-32-6B-18-84
   Update Check Interval: 3600 seconds

:: Measured values
   CPU Load: 12.0 %
   CPU Temp: 57 °C
   Used Space: 56 %
   Voltage: False V
   CPU Clock Speed: False MHz
   Swap: False %
   Memory: 16 %
   Uptime: 0 days
   Wifi Signal: False %
   Wifi Signal dBm: False
   RPI5 Fan Speed: False RPM
   Update Available: {"installed_ver": "0.8.9", "new_ver": "0.8.9"}

/home/pi/rpi-mqtt-monitor/src/rpi-cpu2mqtt.py:398: DeprecationWarning: Callback API version 1 is deprecated, update to latest version
  client = paho.Client(client_id="rpi-mqtt-monitor-" + hostname + str(int(time.time())))
MQTT error:  failed to receive on socket: [Errno 104] Connection reset by peer

Any help to this?

And also this makes no sense: Update Available: {"installed_ver": "0.8.9", "new_ver": "0.8.9"}

hjelev commented 2 months ago

Hi, I think that the DeprecationWarning is not related to the connection error. Are you sure you have entered the correct host name and port?

WirthmU commented 2 months ago

This is the setting: in config.py

# MQTT server configuration
mqtt_host = "192.168.1.158"
mqtt_user = "admin"
mqtt_password = "XXX"
mqtt_port = "1883"
mqtt_topic_prefix = "indiMQTT"

It is the same setting that another MQTT client is using that is working: image

Is your script using TLS/SSL? and can certificate validation be disabled?

hjelev commented 2 months ago

No it doesn't use TLS/SSL. How did you installed the script? What is your paho-mqtt version, is it 1.6.1 ? I remember I have pinned version 1.6.1 as others were causing issues.

WarC0zes commented 2 months ago

What is your paho-mqtt version, is it 1.6.1 ? I remember I have pinned version 1.6.1 as others were causing issues.

Hi, thank you, this allowed me to correct errors with paho-mqtt.

pip install paho-mqtt==1.6.1