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.46k stars 343 forks source link

Mi Smart Door Lock with Face Unlock X cannot access homeassistant system #776

Closed gx19970920 closed 1 year ago

gx19970920 commented 2 years ago

the Firmware version is 1.5.0_0026 Only the battery and bluetooth connection status can be viewed image

micturkey commented 2 years ago

Try writing your own coverters like this? It is directly copied from current migateway3 code and I just added the spec infomation and it may work.

{
    "lumi.lock.bmcn05": ["Xiaomi", "Mi Smart Door Lock with Face Unlock X", "XMZNMS06LM"],
    "spec": [
        MiBeacon,
        # sensors:
        Converter("action", "sensor", enabled=None),
        Converter("battery", "sensor", enabled=None),
        Converter("conductivity", "sensor", enabled=None),
        Converter("formaldehyde", "sensor", enabled=None),
        Converter("humidity", "sensor", enabled=None),
        Converter("idle_time", "sensor", enabled=None),
        Converter("illuminance", "sensor", enabled=None),
        Converter("moisture", "sensor", enabled=None),
        Converter("rssi", "sensor", enabled=None),
        Converter("supply", "sensor", enabled=None),
        Converter("temperature", "sensor", enabled=None),
        # binary_sensors:
        Converter("contact", "binary_sensor", enabled=None),
        Converter("gas", "binary_sensor", enabled=None),
        Converter("light", "binary_sensor", enabled=None),
        Converter("lock", "binary_sensor", enabled=None),
        Converter("motion", "binary_sensor", enabled=None),
        Converter("opening", "binary_sensor", enabled=None),
        Converter("sleep", "binary_sensor", enabled=None),
        Converter("smoke", "binary_sensor", enabled=None),
        Converter("water_leak", "binary_sensor", enabled=None),
    ],
}]
AlexxIT commented 2 years ago

@gx19970920 try to make some actions with lock. Sensors may appear later.

gx19970920 commented 2 years ago

Try writing your own coverters like this? It is directly copied from current migateway3 code and I just added the spec infomation and it may work.

{
    "lumi.lock.bmcn05": ["Xiaomi", "Mi Smart Door Lock with Face Unlock X", "XMZNMS06LM"],
    "spec": [
        MiBeacon,
        # sensors:
        Converter("action", "sensor", enabled=None),
        Converter("battery", "sensor", enabled=None),
        Converter("conductivity", "sensor", enabled=None),
        Converter("formaldehyde", "sensor", enabled=None),
        Converter("humidity", "sensor", enabled=None),
        Converter("idle_time", "sensor", enabled=None),
        Converter("illuminance", "sensor", enabled=None),
        Converter("moisture", "sensor", enabled=None),
        Converter("rssi", "sensor", enabled=None),
        Converter("supply", "sensor", enabled=None),
        Converter("temperature", "sensor", enabled=None),
        # binary_sensors:
        Converter("contact", "binary_sensor", enabled=None),
        Converter("gas", "binary_sensor", enabled=None),
        Converter("light", "binary_sensor", enabled=None),
        Converter("lock", "binary_sensor", enabled=None),
        Converter("motion", "binary_sensor", enabled=None),
        Converter("opening", "binary_sensor", enabled=None),
        Converter("sleep", "binary_sensor", enabled=None),
        Converter("smoke", "binary_sensor", enabled=None),
        Converter("water_leak", "binary_sensor", enabled=None),
    ],
}]

Thanks,I had solved this problem,the state of lock and door are in the attribute of entity.

gx19970920 commented 2 years ago

@gx19970920 try to make some actions with lock. Sensors may appear later.

Thanks, after I open and close the door several times, the states of lock and door show in the attribute of entity.

AlexxIT commented 2 years ago

Ok. Anyway I need to add this model to component. So all entity will appear instantly

gx19970920 commented 2 years ago

还行。无论如何,我需要将此模型添加到组件中。因此,所有实体都将立即出现

thanks, if you need some information of this lock please e-mail me at gx19970920@gmail.com

AlexxIT commented 2 years ago

I can see its model on your screen. How many sensors do you have? BLE, Battery and Action?

gx19970920 commented 2 years ago

I can see its model on your screen. How many sensors do you have? BLE, Battery and Action?

image

it has BLE, Battery and Action,the main information are in the attribute of action

image

AlexxIT commented 2 years ago

I don't understand. BLE model is always number. (3685) on your first screen. It can't be string (lumi.lock.bmcn05)

gx19970920 commented 2 years ago

I don't understand. BLE model is always number. (3685) on your first screen. It can't be string (lumi.lock.bmcn05)

You are right. The reason why my interface displays the name of the door lock is that I manually wrote the file xaomigateway3.py

AlexxIT commented 2 years ago

Can you attach the file here?

gx19970920 commented 2 years ago

image

from custom_components.xiaomi_gateway3.core.converters.devices import *

DEVICES = [{
    3685: ["lumi", "Mi Smart Door Lock with Face Unlock X", "lumi.lock.bmcn05"],
    "spec": [
        MiBeacon,
        # sensors:
        Converter("action", "sensor", enabled=None),
        Converter("battery", "sensor", enabled=None),
        # binary_sensors:
        Converter("contact", "binary_sensor", enabled=None),
        Converter("lock", "binary_sensor", enabled=None),
    ],
}] + DEVICES
AlexxIT commented 2 years ago

Oh. Now is all clear. Thanks. Works as should be.

gx19970920 commented 2 years ago

But can these attributes such as lock status, door status, and unlock method be independent entities? In this way, it is more convenient to set up automations. If you have time and are interested, I hope you can refer to my suggestion

AlexxIT commented 2 years ago

You can make template entities if you want. But you can use them in automations without any modifications. Just learn more about Hass automations https://github.com/AlexxIT/XiaomiGateway3/wiki/Handle-BLE-Locks

gx19970920 commented 2 years ago

THANKS!!!!