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.48k stars 349 forks source link

Bluetooth mesh does not get the status correctly #1335

Closed hzonz closed 7 months ago

hzonz commented 7 months ago

The light controller of the Bluetooth mesh does not get the status correctly. The light is turned off using a switch or app, or turned on or off in the Home Assistant. The device can control the switch normally. However, the obtained device status is incorrect.

Affected devices: Mesh: 090615.light.mlig02 Mesh: lemesh.light.wy0c08 Mesh: lemesh.light.wy0c15

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2024.4.3",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.12.2",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Asia/Shanghai",
    "os_name": "Linux",
    "os_version": "6.6.25-haos",
    "supervisor": "2024.04.0",
    "host_os": "Home Assistant OS 12.2",
    "docker_version": "25.0.5",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "ikuai": {
      "version": "1.3",
      "requirements": []
    },
    "webrtc": {
      "version": "v3.5.2",
      "requirements": []
    },
    "adaptive_lighting": {
      "version": "1.21.1",
      "requirements": [
        "ulid-transform"
      ]
    },
    "frigate": {
      "version": "5.1.0",
      "requirements": [
        "pytz"
      ]
    },
    "ipmi": {
      "version": "1.6.0",
      "requirements": [
        "python-ipmi"
      ]
    },
    "ha_file_explorer": {
      "version": "2023.4.20",
      "requirements": []
    },
    "browser_mod": {
      "version": "2.3.0",
      "requirements": []
    },
    "nodered": {
      "version": "3.1.5",
      "requirements": []
    },
    "bemfa": {
      "version": "1.4.0",
      "requirements": [
        "paho-mqtt==1.6.1"
      ]
    },
    "qweather": {
      "version": "2023.10.6",
      "requirements": [
        "requests",
        "beautifulsoup4"
      ]
    },
    "ha_cloud_music": {
      "version": "2024.1.17",
      "requirements": [
        "beautifulsoup4>=4.11.1",
        "lxml>=4.9.1"
      ]
    },
    "dahua": {
      "version": "0.5.0",
      "requirements": []
    },
    "openwrt": {
      "version": "1.3",
      "requirements": []
    },
    "ui_lovelace_minimalist": {
      "version": "v1.3.9",
      "requirements": [
        "aiofiles==0.8.0",
        "aiogithubapi>=22.2.4"
      ]
    },
    "xiaomi_miot": {
      "version": "0.7.17",
      "requirements": [
        "construct>=2.10.68",
        "python-miio>=0.5.12",
        "micloud>=0.5"
      ]
    },
    "xiaomi_gateway3": {
      "version": "4.0.4",
      "requirements": [
        "zigpy>=0.52.3"
      ]
    },
    "hacs": {
      "version": "1.34.0",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "ble_monitor": {
      "version": "12.10.4",
      "requirements": [
        "pycryptodomex>=3.18.0",
        "janus>=1.0.0",
        "aioblescan>=0.2.14",
        "btsocket>=0.2.0",
        "pyric>=0.1.6.3"
      ]
    },
    "zha_toolkit": {
      "version": "v1.1.10",
      "requirements": [
        "pytz"
      ]
    }
  },
  "integration_manifest": {
    "domain": "xiaomi_gateway3",
    "name": "Xiaomi Gateway 3",
    "codeowners": [
      "@AlexxIT"
    ],
    "config_flow": true,
    "dependencies": [],
    "documentation": "https://github.com/AlexxIT/XiaomiGateway3",
    "iot_class": "local_push",
    "issue_tracker": "https://github.com/AlexxIT/XiaomiGateway3/issues",
    "requirements": [
      "zigpy>=0.52.3"
    ],
    "version": "4.0.4",
    "is_built_in": false
  },
  "data": {
    "version": "43295bf",
    "options": {
      "host": "10.10.12.15",
      "token": "78733752727a3962676a654434487970",
      "key": "****************",
      "ble": true,
      "stats": true,
      "debug": []
    },
    "errors": [],
    "device": {
      "available": true,
      "extra": {
        "did": "1094045885",
        "mac": "cc:b5:d1:e0:97:db",
        "type": "mesh",
        "cloud_name": "\u9910\u5385\u5c04\u706f",
        "cloud_fw": "2.1.1_4174",
        "market_brand": "PTX",
        "market_name": "Mesh Downlight",
        "market_model": "090615.light.mlig02",
        "rssi_54ef4440705c": -88
      },
      "last_seen": {
        "54ef4440705c": "6m34s"
      },
      "listeners": 3,
      "model": 4924,
      "params": {
        "brightness": 0.0,
        "color_temp": 185,
        "light": false
      },
      "ttl": "50m",
      "uid": "ccb5d1e097db",
      "last_report": {
        "light": false,
        "brightness": 0.0,
        "color_temp": 185
      },
      "last_report_gw": {
        "host": "10.10.12.15",
        "mac": "54:ef:44:40:70:5c",
        "name": "\u5c0f\u7c73\u591a\u6a21\u7f51\u5173",
        "model": "lumi.gateway.mcn001",
        "fw_ver": "1.0.7_0021"
      },
      "last_report_ts": "4m17s",
      "last_request_ts": "4m16s"
    }
  }
}
AlexxIT commented 7 months ago

Are you using mesh groups for controlling this devices or not?

hzonz commented 7 months ago

您是否使用网状组来控制此设备?

Thanks for your attention! No, it's a separate device. I can call the service to turn off this Bluetooth mesh light controller, although the status is off.

AlexxIT commented 7 months ago

Enable debug logs and check if you can see any related messages for problem devices

hzonz commented 7 months ago

Enable debug logs and check if you can see any related messages for problem devices

This is the only segment in the debug logs:

2024-04-22 21:03:11.774 DEBUG (MainThread) [custom_components.xiaomi_gateway3.gate.10.10.12.15] {'uid': 'ccb5d1e097db', 'did': '1094045885', 'msg': 'init_device', 'data': {'did': '1094045885', 'mac': 'cc:b5:d1:e0:97:db', 'type': 'mesh', 'cloud_name': '餐厅射灯', 'cloud_fw': '2.1.1_4174', 'market_brand': 'PTX', 'market_name': 'Mesh Downlight', 'market_model': '090615.light.mlig02'}}

No error information was found about this device.

Sorry, it's my question, here's the error message: I can call the service to turn off this Bluetooth mesh light controller, although the status is off.

This website contains information about the properties of these devices. Hope it helps. https://[home.miot-spec.com](https://home.miot-spec.com/s/090615.light.mlig02)/s/090615.light.mlig02

This log message home-assistant_xiaomi_gateway3_2024-04-22T13-05-53.425Z.log

AlexxIT commented 7 months ago

I can see reports about brightness and color_temp, but can't see reports about on/off state. Maybe it's a problem

hzonz commented 7 months ago

I can see reports about brightness and color_temp, but can't see reports about on/off state. Maybe it's a problem

Looking forward to you fixing this, thanks! This URL is unreachable for unknown reasons:https://[home.miot-spec.com](https://home.miot-spec.com/)/ Maybe visit tomorrow.

This is an issue that I found someone else to file https://github.com/AlexxIT/XiaomiGateway3/issues/1064

lhpsq commented 7 months ago

Yes, I am experiencing the same issue. Home Assistant can control the switching on and off of the Yeelight spotlight, but it cannot automatically retrieve and update the status. The status can be manually updated through the ‘update’ command within the device. It is worth noting that not all models of YLTS02YL lights are affected by this issue, and there is no discernible pattern from the firmware of the lights either. Thank you

AlexxIT commented 7 months ago

The problem is simple. Some lamps don't return "on" status when the brightness or color temperature are changed.

hzonz commented 7 months ago

The problem is simple. Some lamps don't return "on" status when the brightness or color temperature are changed.

I'm using the adaptive-lighting integration. I turned off adaptive lighting on 090615.light.mlig02 and the device is in the correct state.

Problems with Adaptiv Leting?

AlexxIT commented 7 months ago

https://github.com/AlexxIT/XiaomiGateway3/releases/tag/v4.0.5