merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
383 stars 62 forks source link

How to add lumi.curtain.hmcn02 (Xiaomi BLE Curtain Driver E1) #428

Closed joyzainzy closed 1 year ago

joyzainzy commented 1 year ago

How to add lumi.curtain.hmcn02 (Xiaomi BLE Curtain Driver E1)

merdok commented 1 year ago

Since it seems that this is a BLE device, you would need to add it through a gateway. You need to specify the ip and token of your gateway, and the deviceid and model from your device, that should make it work.

mrmaximas commented 1 year ago

Since it seems that this is a BLE device, you would need to add it through a gateway. You need to specify the ip and token of your gateway, and the deviceid and model from your device, that should make it work.

what about reading from Mi Flora / HHCC sensors hhcc.plantmonitor.v1 via Xiaomi Smart Home Gateway 3 gateway?

[2/28/2023, 3:00:19 AM] [homebridge-miot] [MIOT FLORA] Initializing device services [2/28/2023, 3:00:19 AM] [homebridge-miot] [MIOT FLORA] Device services: [ "plant-monitor", "environment" ] [2/28/2023, 3:00:19 AM] [homebridge-miot] [MIOT FLORA] Initializing device properties [2/28/2023, 3:00:19 AM] [homebridge-miot] [MIOT FLORA] Device properties: [ "plant-monitor:relative-humidity", "plant-monitor:soil-ec", "plant-monitor:illumination", "environment:temperature" ] [2/28/2023, 3:00:19 AM] [homebridge-miot] [MIOT FLORA] Initializing device actions [2/28/2023, 3:00:19 AM] [homebridge-miot] [MIOT FLORA] Successfully created a custom accessory device! It is a Plant Monitor. Make sure to configure the properties and actions! [2/28/2023, 3:00:19 AM] [homebridge-miot] [MIOT FLORA] Initializing accessory! [2/28/2023, 3:00:19 AM] [homebridge-miot] [MIOT FLORA] Accessory successfully initialized! [2/28/2023, 3:00:19 AM] [homebridge-miot] [MIOT FLORA] Registering 1 accessories! [2/28/2023, 3:00:19 AM] [homebridge-miot] [MIOT FLORA] Everything looks good! Initiating property polling! [2/28/2023, 3:00:19 AM] [homebridge-miot] [MIOT FLORA] Log in to MiCloud!

merdok commented 1 year ago

Seems to work, but you would need to configure yourself the properties manually since there is no plant monitor module yet.

mrmaximas commented 1 year ago

Seems to work, but you would need to configure yourself the properties manually since there is no plant monitor module yet.

thanks

it is possible to add? but i don't see battery level here https://miot-spec.org/miot-spec-v2/spec/service?type=urn:miot-spec-v2:service:plant-monitor:0000784B

{"type":"urn:miot-spec-v2:service:plant-monitor:0000784B","description":"Plant Monitor","optional-properties":["urn:miot-spec-v2:property:status:00000007","urn:miot-spec-v2:property:fault:00000009","urn:miot-spec-v2:property:temperature:00000020","urn:miot-spec-v2:property:relative-humidity:0000000C","urn:miot-spec-v2:property:soil-ec:00000084","urn:miot-spec-v2:property:illumination:0000004E"]}

merdok commented 1 year ago

If there is no battery level in the spec then it means that the device does not support that. You should try to use propertyControl and propertyMonitor to expose which data you want to see.

mrmaximas commented 1 year ago

this device definitely reports the battery status via bluetooth. now i'm using this plugin https://github.com/oretman/homebridge-mi-flora-care but my sensors are too far away from the my ble dongle. it's enough for me to get data through the mi cloud a couple of times a day. [2/28/2023, 10:02:43 AM] [Asparagus L] Lux: 509, Temperature: 26.5, Moisture: 31, Fertility: 674 [2/28/2023, 10:02:43 AM] [Asparagus L] Firmware: 3.3.5, Battery level: 100

merdok commented 1 year ago

It might be that it reports battery but not using the miot spec!

mrmaximas commented 1 year ago

strange things it's my config for plant monitor { "name": "MIOT Monstera", "ip": "ххххх", "token": "ххххх", "deviceId": "blt.3.1bl3btnhc5g00", "model": "hhcc.plantmonitor.v1", "pollingInterval": 600, "deepDebugLog": false, "micloud": { "username": "ххххх", "password": "ххххх", "country": "cn", "forceMiCloud": true }, "buzzerControl": false, "ledControl": false, "childLockControl": false, "modeControl": false, "propertyMonitor": [ { "property": "plant-monitor:relative-humidity", "name": "Hum" }, { "property": "plant-monitor:soil-ec", "name": "Soil" }, { "property": "environment:temperature", "name": "Temp" } ] } ], but Num & Soil seems like light sensors. what am I doing wrong?

merdok commented 1 year ago

There is no humidity or soil accessory in HomeKit, hence the plugin uses a light sensor to display the raw values from the device.

mrmaximas commented 1 year ago

There is no humidity or soil accessory in HomeKit, hence the plugin uses a light sensor to display the raw values from the device.

yes, how to display/convert soil moisture as an air humidity sensor?

mrmaximas commented 1 year ago

and if there is a way, for example, when the soil moisture is less than a set value (e.g. 20%) to display this as an door sensor in open state, as my current plugin does.

merdok commented 1 year ago

You can do that by specifying a value in the propertyMonitor. That will create a sensor which will trigger when the value is reached.

mrmaximas commented 1 year ago

Please help me, I don't fully understand how to do it correctly. Thanks!

merdok commented 1 year ago

Just go check out the examples in the README.

mrmaximas commented 1 year ago

i don't understand how to create air humidity sensor linked to plant-monitor:relative-humidity property instead of light sensor

merdok commented 1 year ago

You cannot do that! I just explained you that there is no plant monitor module yet!

mrmaximas commented 1 year ago

thank you. can this be added in future releases?

merdok commented 1 year ago

Probably. Might have a look at it when I have some time.

mrmaximas commented 1 year ago

Probably. Might have a look at it when I have some time.

Thanks! It will be very good! Have a good day!