Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on startup #359

Closed
1 task
openstep opened this issue Mar 22, 2024 · 6 comments
Closed
1 task

Crash on startup #359

openstep opened this issue Mar 22, 2024 · 6 comments

Comments

@openstep
Copy link

openstep commented Mar 22, 2024

Describe the bug
When starting with the config below, there is an error that prevents the mqtt-io from working

Expected behavior
A working code

Error messages and traceback
ERROR:
python3 -m mqtt_io config.yml 2024-03-22 19:07:15 mqtt_io.server [INFO] Digital output 'rele1' current value is False (raw: False) 2024-03-22 19:07:15 mqtt_io.server [INFO] Digital output 'rele2' current value is False (raw: False) 2024-03-22 19:07:16 mqtt_io.server [INFO] Digital output 'rele3' current value is False (raw: False) 2024-03-22 19:07:17 mqtt_io.server [INFO] Digital output 'rele4' current value is False (raw: False) 2024-03-22 19:07:17 mqtt_io.server [INFO] Digital output 'rele5' current value is False (raw: False) 2024-03-22 19:07:18 mqtt_io.server [INFO] Digital output 'rele6' current value is False (raw: False) 2024-03-22 19:07:19 mqtt_io.server [INFO] Digital output 'rele7' current value is False (raw: False) 2024-03-22 19:07:20 mqtt_io.server [INFO] Digital output 'rele8' current value is False (raw: False) Exception ignored in: <function Client.__del__ at 0x75d3b198> Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 874, in __del__ self._reset_sockets() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1133, in _reset_sockets self._sock_close() File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1119, in _sock_close if not self._sock: AttributeError: 'Client' object has no attribute '_sock' 2024-03-22 19:07:20 mqtt_io.server [ERROR] Exception in critical task: Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/mqtt_io/server.py", line 1380, in _main_loop await self._connect_mqtt() File "/home/pi/.local/lib/python3.7/site-packages/mqtt_io/server.py", line 703, in _connect_mqtt self.mqtt_client_options File "/home/pi/.local/lib/python3.7/site-packages/mqtt_io/mqtt/asyncio_mqtt.py", line 101, in __init__ clean_session=options.clean_session, File "/home/pi/.local/lib/python3.7/site-packages/asyncio_mqtt/client.py", line 34, in __init__ self._client = mqtt.Client(client_id=client_id, protocol=protocol, clean_session=clean_session, transport=transport) TypeError: __init__() missing 1 required positional argument: 'callback_api_version' 2024-03-22 19:07:22 mqtt_io.server [INFO] Reconnecting to MQTT broker (infinite retries remaining)

Config

mqtt:
  host: 192.168.x.x
  port: 1883
  topic_prefix: home
  ha_discovery:
    enabled: yes

# GPIO
gpio_modules:
  # Use the Raspberry Pi built-in GPIO
  - name: rpi
    module: raspberrypi

digital_outputs:
  - name: rele1
    module: rpi
    pin: 18

  - name: rele2
    module: rpi
    pin: 23

Hardware
Raspberry pi 3b+ and the mqtt server is on another host

System:

  • Raspbian GNU/Linux 10,
  • Python version: Python 3.7.3
  • User you're running as: pi
  • Using a virtualenv?: no
@chrislp
Copy link

chrislp commented Mar 25, 2024

Hi have the same issue, same system and the following configuration:

mqtt:
  host: 192.168.xx
  port: 1883
  topic_prefix: mqtt_io
  ha_discovery:
    enabled: yes

sensor_modules:
  - name: dht22_sensor
    module: dht22
    type: DHT22
    pin: 2

sensor_inputs:
  - name: temperature
    module: dht22_sensor
    interval: 10
    digits: 4
    type: temperature

  - name: humidity
    module: dht22_sensor
    interval: 10
    digits: 4
    type: humidity

@alext
Copy link

alext commented Mar 29, 2024

This looks like #348 - downgrading paho-mqtt to the latest 1.x version should solve it.

@CoherentLogic
Copy link

how do you do that?

@alext
Copy link

alext commented Apr 13, 2024

how do you do that?

If you installed it using pip, then you can downgrade with pip install 'paho-mqtt<2', which will get you the latest 1.x version.

@chrislp
Copy link

chrislp commented Apr 15, 2024

Downgrading paho-mqtt did the trick for me. But I had to upgrade my ancient OS to Raspbian 11 first.

@BenjiU
Copy link
Collaborator

BenjiU commented Jun 2, 2024

will be fixed with PR: #364

@BenjiU BenjiU closed this as completed Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants