mduran80 / pymadoka

A python library to control Daikin BRC1H (Madoka) thermostat
MIT License
26 stars 8 forks source link

Missing reconnection to MQTT broker #14

Open mario-tux opened 1 year ago

mario-tux commented 1 year ago

I looks that pymadoka-mqtt agent disconnects from Mosquito broker but doesn't try to reconnect to it:

...
DEBUG:pymadoka.transport:Message complete. Processing...
DEBUG:pymadoka.feature:SetPoint QUERY response received (61 bytes)
DEBUG:pymadoka.feature:SetPoint status updated, new value:
{"cooling_set_point": 20, "heating_set_point": 19, "range_enabled": 0, "mode": 0, "min_differential": 0, "min_cooling_lowerlimit": 0, "min_heating_lowerlimit": 0, "cooling_lowerlimit": 17, "heating_lowerlimit": 16, "cooling_lowerlimit_symbol": 0, "heating_lowerlimit_symbol": 0, "max_cooling_upperlimit": 0, "max_heating_upperlimit": 0, "cooling_upperlimit": 32, "heating_upperlimit": 31, "cooling_upperlimit_symbol": 0, "heating_upperlimit_symbol": 0}
DEBUG:pymadoka.connection:Sending cmd payload: 0c0001104002000041020000
DEBUG:bleak.backends.bluezdbus.client:Write Characteristic 2141e112-213a-11e6-b67b-9e71128cae77 | /org/bluez/hci0/dev_F4_93_1C_09_**_**/service0200/char0204: bytearray(b'\x00\x0c\x00\x01\x10@\x02\x00\x00A\x02\x00\x00')
DEBUG:pymadoka.connection:CMD 272. Chunk #1/1 sent with size 13 bytes
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C_09_**_**): ['org.bluez.Device1', {'ServicesResolved': <dbus_fast.signature.Variant ('b', False)>}, []]
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C_09_**_**): ['org.bluez.Device1', {'Connected': <dbus_fast.signature.Variant ('b', False)>}, []]
DEBUG:bleak.backends.bluezdbus.client:Device disconnected (/org/bluez/hci0/dev_F4_93_1C_09_**_**)
DEBUG:bleak.backends.bluezdbus.client:_cleanup_all(/org/bluez/hci0/dev_F4_93_1C_09_**_**)
INFO:pymadoka.connection:Disconnected F4:93:1C:09:**:**!
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C_09_**_**/service0200/char0201): ['org.bluez.GattCharacteristic1', {'Notifying': <dbus_fast.signature.Variant ('b', False)>}, []]
DEBUG:pymadoka.connection:Starting connection manager on F4:93:1C:09:**:**
DEBUG:bleak.backends.bluezdbus.client:Connecting to device @ F4:93:1C:09:**:**
DEBUG:bleak.backends.bluezdbus.client:Connecting to BlueZ path /org/bluez/hci0/dev_F4_93_1C_09_**_**
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C_09_**_**): ['org.bluez.Device1', {'Connected': <dbus_fast.signature.Variant ('b', True)>}, []]
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C_09_**_**): ['org.bluez.Device1', {'ServicesResolved': <dbus_fast.signature.Variant ('b', True)>}, []]
INFO:pymadoka.connection:Connected to F4:93:1C:09:**:**
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C_09_**_**/service0200/char0201): ['org.bluez.GattCharacteristic1', {'Notifying': <dbus_fast.signature.Variant ('b', True)>}, []]
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_80_6F_B0_5A_34_6B', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']]
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_6C_55_47_67_5F_7E', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']]
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_58_2D_34_10_56_43', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']]
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_58_2D_34_10_49_26', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']]
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_58_2D_34_11_91_87', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']]
DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_58_2D_34_10_4C_7A', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']]
DEBUG:pymadoka.mqtt:Disconnected from MQTT broker (7)

I can spot the reconnection arming in the code: https://github.com/mduran80/pymadoka/blob/c43adad0c144ea5942c7441bda4baf81d8bf0051/pymadoka/mqtt.py#L269 but it looks to be not working.

mduran80 commented 1 year ago

I will try to find some time this weekend and have a look at this and the other mqtt message to signal HA. I will let you know, I’m afk

El El sáb, 18 feb 2023 a las 16:30, Mario @.***> escribió:

I looks that pymadoka-mqtt agent disconnects from Mosquito broker but doesn't try to reconnect to it:

... DEBUG:pymadoka.transport:Message complete. Processing... DEBUG:pymadoka.feature:SetPoint QUERY response received (61 bytes) DEBUG:pymadoka.feature:SetPoint status updated, new value: {"cooling_set_point": 20, "heating_set_point": 19, "range_enabled": 0, "mode": 0, "min_differential": 0, "min_cooling_lowerlimit": 0, "min_heating_lowerlimit": 0, "cooling_lowerlimit": 17, "heating_lowerlimit": 16, "cooling_lowerlimit_symbol": 0, "heating_lowerlimit_symbol": 0, "max_cooling_upperlimit": 0, "max_heating_upperlimit": 0, "cooling_upperlimit": 32, "heating_upperlimit": 31, "cooling_upperlimit_symbol": 0, "heating_upperlimit_symbol": 0} DEBUG:pymadoka.connection:Sending cmd payload: 0c0001104002000041020000 DEBUG:bleak.backends.bluezdbus.client:Write Characteristic 2141e112-213a-11e6-b67b-9e71128cae77 | /org/bluez/hci0/dev_F4_93_1C09_/service0200/char0204: bytearray(b'\x00\x0c\x00\x01\x10@\x02\x00\x00A\x02\x00\x00') DEBUG:pymadoka.connection:CMD 272. Chunk #1/1 sent with size 13 bytes DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C09_): ['org.bluez.Device1', {'ServicesResolved': <dbus_fast.signature.Variant ('b', False)>}, []] DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C09_): ['org.bluez.Device1', {'Connected': <dbus_fast.signature.Variant ('b', False)>}, []] DEBUG:bleak.backends.bluezdbus.client:Device disconnected (/org/bluez/hci0/dev_F4_93_1C09_) DEBUG:bleak.backends.bluezdbus.client:_cleanup_all(/org/bluez/hci0/dev_F4_93_1C09_) INFO:pymadoka.connection:Disconnected F4:93:1C:09::! DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C09_/service0200/char0201): ['org.bluez.GattCharacteristic1', {'Notifying': <dbus_fast.signature.Variant ('b', False)>}, []] DEBUG:pymadoka.connection:Starting connection manager on F4:93:1C:09:: DEBUG:bleak.backends.bluezdbus.client:Connecting to device @ F4:93:1C:09:: DEBUG:bleak.backends.bluezdbus.client:Connecting to BlueZ path /org/bluez/hci0/dev_F4_93_1C09_ DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C09_): ['org.bluez.Device1', {'Connected': <dbus_fast.signature.Variant ('b', True)>}, []] DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C09_): ['org.bluez.Device1', {'ServicesResolved': <dbus_fast.signature.Variant ('b', True)>}, []] INFO:pymadoka.connection:Connected to F4:93:1C:09:: DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.Properties.PropertiesChanged (/org/bluez/hci0/dev_F4_93_1C09_/service0200/char0201): ['org.bluez.GattCharacteristic1', {'Notifying': <dbus_fast.signature.Variant ('b', True)>}, []] DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_80_6F_B0_5A_34_6B', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']] DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_6C_55_47_67_5F_7E', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']] DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_58_2D_34_10_56_43', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']] DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_58_2D_34_10_49_26', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']] DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_58_2D_34_11_91_87', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']] DEBUG:bleak.backends.bluezdbus.manager:received D-Bus signal: org.freedesktop.DBus.ObjectManager.InterfacesRemoved (/): ['/org/bluez/hci0/dev_58_2D_34_10_4C_7A', ['org.freedesktop.DBus.Properties', 'org.freedesktop.DBus.Introspectable', 'org.bluez.Device1']] DEBUG:pymadoka.mqtt:Disconnected from MQTT broker (7)

I can spot the reconnection arming in the code:

https://github.com/mduran80/pymadoka/blob/c43adad0c144ea5942c7441bda4baf81d8bf0051/pymadoka/mqtt.py#L269 but it looks to be not working.

— Reply to this email directly, view it on GitHub https://github.com/mduran80/pymadoka/issues/14, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFK3CT2EV74LUPNKJ5CYWXLWYDTJVANCNFSM6AAAAAAVANDTFU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mduran80 commented 1 year ago

Fixed in pymadoka 0.2.10