Closed maxgrafik closed 3 years ago
@maxgrafik you are correct, this is a bug at the moment. Is this a big issue for you? We will try to fix this in future but I'm buried in work atm so it might take some time
No problem. I'll wait. Just take your time.
Just a question: do you see any state reported when restarting homebridge? It could be a bug in the herdsman lib
This is what I get when restarting homebridge in Debug Mode:
[2/9/2021, 5:52:32 PM] [ZigBee] Initializing ZigbeeHomebridgeNTPlatform platform...
[2/9/2021, 5:52:32 PM] [ZigBee] Initializing platform: ZigBee - v2.0.3 (API v2.6)
[2/9/2021, 5:52:32 PM] [ZigBee] Loading accessory from cache: zigbee:permit-join
[2/9/2021, 5:52:32 PM] [ZigBee] Loading accessory from cache: zigbee:touchlink
[2/9/2021, 5:52:32 PM] [ZigBee] Loading accessory from cache: 0x00158d000588b213
[2/9/2021, 5:52:32 PM] [ZigBee] Creating copy of existing database
[2/9/2021, 5:52:32 PM] [ZigBee] Configured port for ZigBee dongle is /dev/tty.usbmodemFA121
[2/9/2021, 5:52:32 PM] [ZigBee] Initializing ZigBee controller on port /dev/tty.usbmodemFA121 and channels 11, 25 (pan ID 6754)
[2/9/2021, 5:52:35 PM] [ZigBee] Successfully started ZigBee service
[2/9/2021, 5:52:35 PM] [ZigBee] ZigBee platform initialized @ 0x00124b0014d9af1d
[2/9/2021, 5:52:35 PM] [ZigBee] Reuse accessory from cache with uuid 6895c160-ba25-497f-b805-38071c751c56 and name zigbee:permit-join
[2/9/2021, 5:52:35 PM] [ZigBee] Zigbee: disabling joining new devices.
[2/9/2021, 5:52:35 PM] [ZigBee] PermitJoin accessory successfully registered
[2/9/2021, 5:52:35 PM] [ZigBee] Reuse accessory from cache with uuid 4994893c-ea77-4292-a4ad-09e1f36f7099 and name zigbee:touchlink
[2/9/2021, 5:52:35 PM] [ZigBee] TouchLink accessory successfully registered
[2/9/2021, 5:52:35 PM] [ZigBee] Found ZigBee device: Device {
ID: 2,
_type: 'EndDevice',
_ieeeAddr: '0x00158d000588b213',
_networkAddress: 21949,
_manufacturerID: 4151,
_endpoints: [
Endpoint {
ID: 1,
profileID: undefined,
deviceID: undefined,
inputClusters: [],
outputClusters: [],
deviceNetworkAddress: 21949,
deviceIeeeAddress: '0x00158d000588b213',
clusters: [Object],
_binds: [],
_configuredReportings: [],
meta: {}
}
],
_manufacturerName: 'LUMI',
_powerSource: 'Battery',
_modelID: 'lumi.sensor_magnet',
_applicationVersion: 10,
_stackVersion: undefined,
_zclVersion: undefined,
_hardwareVersion: undefined,
_dateCode: undefined,
_softwareBuildID: undefined,
_interviewCompleted: true,
_interviewing: false,
meta: {},
_lastSeen: 1612888617745
}
[2/9/2021, 5:52:35 PM] [ZigBee] Reuse accessory from cache with uuid 6548aa7b-0943-4504-9cff-aceef93cb46d and name 0x00158d000588b213
[2/9/2021, 5:52:35 PM] [ZigBee] Registered device: 0x00158d000588b213 LUMI lumi.sensor_magnet
[2/9/2021, 5:52:35 PM] [ZigBee] Mounting device MiJia door & window contact sensor...
If I then open/close the door, the state is reported:
[2/9/2021, 5:54:20 PM] [ZigBee] Zigbee message from 0x00158d000588b213 attributeReport
[2/9/2021, 5:54:20 PM] [ZigBee] Decoded state from incoming message { contact: false }
[2/9/2021, 5:54:20 PM] [ZigBee] Updating state of device MiJia door & window contact sensor with { contact: false }
[2/9/2021, 5:54:20 PM] [ZigBee] Updated state for device MiJia door & window contact sensor is now { state: 'OFF', contact: false }
[2/9/2021, 5:54:20 PM] [ZigBee] Updating service (UUID: 00000080-0000-1000-8000-0026BB765291)
[2/9/2021, 5:54:20 PM] [ZigBee] Updating service (UUID: 00000096-0000-1000-8000-0026BB765291)
[2/9/2021, 5:54:21 PM] [ZigBee] Zigbee message from 0x00158d000588b213 attributeReport
[2/9/2021, 5:54:21 PM] [ZigBee] Decoded state from incoming message { contact: true }
[2/9/2021, 5:54:21 PM] [ZigBee] Updating state of device MiJia door & window contact sensor with { contact: true }
[2/9/2021, 5:54:21 PM] [ZigBee] Updated state for device MiJia door & window contact sensor is now { state: 'OFF', contact: true }
[2/9/2021, 5:54:21 PM] [ZigBee] Updating service (UUID: 00000080-0000-1000-8000-0026BB765291)
[2/9/2021, 5:54:21 PM] [ZigBee] Updating service (UUID: 00000096-0000-1000-8000-0026BB765291)
Does this help?
I also noticed that after restarting it takes 2-3 seconds in Homebridge UI before the sensor actually (wrongly) reports open.
So, contact
is false by default, that means open in your case. It stays false until something is reported from the device. Let me see if the state can be read at mounting time...
I solved this problem in my latest build by setting the default value to true
(contact closed). I'll release it in the upcoming v2.1.0
@maxgrafik can you try 2.1.0 unstable. Install it using this command:
npm i homebridge-zigbee-nt@unstable -g --unsafe-perm
@madchicken I tried today with v2.1.0-unstable.3. The sensor is now closed when restarting homebridge. Which is probably fine for me now. However, if the door is open while restarting hb, the sensor is now wrongly closed. It looks like the sensor reports its state only when the state actually changes.
@maxgrafik Yes, this is what I was saying in my previous comment. I don't know how to solve this problem ATM. I need to dig more in the herdsman lib and the way it integrates this device
Do other sensors report their state when mounted? I guess then that's why Xiaomi sensors are cheap ;)
Hi, so my Xiaomi Mijia door sensor (lumi.sensor_magnet) shows "open" after each homebridge restart. I always need to open and close the door to get the correct state again (although this opening and closing is logged correctly). Other than that the plugin works perfectly fine for me. Is this a limitation of this particular sensor, or am I doing anything wrong?
I'm running homebridge on a Mac mini and a CC2531 USB dongle. No other zigbee devices so far.