AlexxIT / XiaomiGateway3

Home Assistant custom component for control Xiaomi Multimode Gateway (aka Gateway 3), Xiaomi Multimode Gateway 2, Aqara Hub E1 on default firmwares over LAN
https://github.com/AlexxIT/Blog
MIT License
2.33k stars 322 forks source link

Errors in logs 'msg': 'dispatch_event: mqtt_publish...' after updating from v3.3.6 to v4.0.x #1325

Open xkansler opened 1 month ago

xkansler commented 1 month ago

After upgrade from v3.3.6 to v4.0.0/v4.0.1/v4.0.2

After upgrade upgrade from v3.3.6 to v4.0.0/v4.0.1/v4.0.2 there are constant messages in the logs


Log details (ERROR):
This error originated from a custom integration.

Logger: custom_components.xiaomi_gateway3.gate.192.168.10.23
Source: custom_components/xiaomi_gateway3/core/gate/base.py:91
integration: Xiaomi Gateway 3 (documentation, issues)
First occurred: 16:19:58 (12 occurrences)
Last logged: 16:24:58

    {'msg': 'dispatch_event: mqtt_publish (<custom_components.xiaomi_gateway3.core.mini_mqtt.MQTTMessage object at 0x7f0bd095d3a0>,) {}'}
    {'msg': 'dispatch_event: mqtt_publish (<custom_components.xiaomi_gateway3.core.mini_mqtt.MQTTMessage object at 0x7f0bef3831a0>,) {}'}
    {'msg': 'dispatch_event: mqtt_publish (<custom_components.xiaomi_gateway3.core.mini_mqtt.MQTTMessage object at 0x7f0bf2a00500>,) {}'}
    {'msg': 'dispatch_event: mqtt_publish (<custom_components.xiaomi_gateway3.core.mini_mqtt.MQTTMessage object at 0x7f0bec09c0e0>,) {}'}
    {'msg': 'dispatch_event: mqtt_publish (<custom_components.xiaomi_gateway3.core.mini_mqtt.MQTTMessage object at 0x7f0bbfdd4440>,) {}'}

Traceback (most recent call last):
  File "/config/custom_components/xiaomi_gateway3/core/gate/base.py", line 91, in dispatch_event
    handler(*args, **kwargs)
  File "/config/custom_components/xiaomi_gateway3/core/gate/miot.py", line 26, in miot_on_mqtt_publish
    self.miot_process_properties(result, from_cache=True)
  File "/config/custom_components/xiaomi_gateway3/core/gate/miot.py", line 60, in miot_process_properties
    device.dispatch({device.type: ts})
  File "/config/custom_components/xiaomi_gateway3/core/device.py", line 211, in dispatch
    handler(data)
asyncio.exceptions.InvalidStateError: invalid state

System composition:

AlexxIT commented 1 month ago

I think this is fixed in latest master version. Do you have Mesh groups?

xkansler commented 1 month ago

Yes. I am using a Gateway ZNDMWG03LM only for BT-Mesh and BLE. Zigbee not used. For zigbee i'm use SLZB-06p-PoE Mesh Group are visible in HA and they are controlled normally.

3pcs. Mesh Downlight M2 YLTS02YL

extra:
  childs:
  - '1042024241'
  - '1042020721'
  - '1041898691'
  did: group.1714582109592899584
  market_brand: Xiaomi
  market_model: mijia.light.group3
  market_name: Light Group
  type: group
last_request_ts: 1m3s
last_seen: {}
listeners: 2
model: 68286
params: {}
ttl: 0s

9pcs. Mesh Bulb MJDP09YL

extra:
  childs:
  - '1041713326'
  - '1040940836'
  - '1041709199'
  - '1040875274'
  - '1041639973'
  - '1040888111'
  - '1040909449'
  - '1041640027'
  - '1041826648'
  did: group.1714576400012693504
  market_brand: Xiaomi
  market_model: mijia.light.group3
  market_name: Light Group
  type: group
last_request_ts: 16s
last_seen: {}
listeners: 2
model: 68286
AlexxIT commented 1 month ago

For log, my issues:

Traceback (most recent call last):
  File "/config/custom_components/xiaomi_gateway3/core/gate/base.py", line 91, in dispatch_event
    handler(*args, **kwargs)
  File "/config/custom_components/xiaomi_gateway3/core/gate/miot.py", line 15, in miot_on_mqtt_publish
    self.miot_process_properties(msg.json["params"], from_cache=False)
  File "/config/custom_components/xiaomi_gateway3/core/gate/miot.py", line 60, in miot_process_properties
    device.dispatch({device.type: ts})
  File "/config/custom_components/xiaomi_gateway3/core/device.py", line 211, in dispatch
    handler(data)
  File "/config/custom_components/xiaomi_gateway3/light.py", line 151, in forward_child_update
    self.device.dispatch(data)
  File "/config/custom_components/xiaomi_gateway3/core/device.py", line 211, in dispatch
    handler(data)
asyncio.exceptions.InvalidStateError: invalid state
Traceback (most recent call last):
  File "/config/custom_components/xiaomi_gateway3/core/gate/base.py", line 91, in dispatch_event
    handler(*args, **kwargs)
  File "/config/custom_components/xiaomi_gateway3/core/gate/miot.py", line 26, in miot_on_mqtt_publish
    self.miot_process_properties(result, from_cache=True)
  File "/config/custom_components/xiaomi_gateway3/core/gate/miot.py", line 60, in miot_process_properties
    device.dispatch({device.type: ts})
  File "/config/custom_components/xiaomi_gateway3/core/device.py", line 211, in dispatch
    handler(data)
asyncio.exceptions.InvalidStateError: invalid state
AlexxIT commented 1 month ago

Do you have enabled statistics sensors?

xkansler commented 1 month ago

Yes enabled statistics sensors. The configuration is the same on all five gateways. config_gateway

P.S. With the help of XiaomiGateway3, is it possible to turn off zigbee and not clog channels? Maybe there is a way to disable the onboard zigbee chip?

AlexxIT commented 1 month ago

Maybe there is a way to disable the onboard zigbee chip?

I don't see any sense in it

SpawnBkAngel commented 1 month ago

Same errors with v4.0.3. Errors disappear when statistics sensors are disabled.