Closed wishie closed 1 year ago
Can you tell us what is working and what isn't?
I believe that basic detection can be done but make all the Z2M sensors available will require a lot of code:
The smoke detector only shows as 2 entities by default.. an IASZone and a Button.
The IASZone shows 'clear' and I was hoping it would update on smoke detected, but in my testing it does not. The 'Identify' button makes the LED on the unit flash once.
For the IASZone I believe that can be done with that quirk:
class SmokeDetector(XiaomiQuickInitDevice):
"""Aqara smoke detector custom device."""
def __init__(self, *args, **kwargs):
"""Init method."""
# self.battery_size = 8 # CR123a
super().__init__(*args, **kwargs)
signature = {
# NodeDescriptor(
# logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0,
# frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress|MainsPowered: 132>,
# manufacturer_code=4447, maximum_buffer_size=127, maximum_incoming_transfer_size=100, server_mask=11264, maximum_outgoing_transfer_size=100,
# descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False,
# *is_end_device=True, *is_full_function_device=False, *is_mains_powered=True, *is_receiver_on_when_idle=False, *is_router=False,
# *is_security_capable=False
# )
NODE_DESCRIPTOR: XIAOMI_NODE_DESC, # not sure if needed, also don't match the device one
MODELS_INFO: ((LUMI, "lumi.sensor_smoke.acn03"),),
ENDPOINTS: {
# input_clusters=["0x0000", "0x0001", "0x0003", "0x0500"]
# output_clusters=["0x0019"]>
1: {
PROFILE_ID: zha.PROFILE_ID,
DEVICE_TYPE: zha.DeviceType.IAS_ZONE,
INPUT_CLUSTERS: [
BasicCluster.cluster_id,
PowerConfiguration.cluster_id,
Identify.cluster_id,
IasZone.cluster_id,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
}
},
}
replacement = {
SKIP_CONFIGURATION: True,
ENDPOINTS: {
1: {
INPUT_CLUSTERS: [
BasicCluster,
XiaomiPowerConfiguration,
Identify.cluster_id,
XiaomiSmokeIASCluster,
DeviceTemperatureCluster,
XiaomiAqaraE1Cluster,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
}
},
}
You will need to enable your local quirk configuration. There is a guide about enabling custom quirks:
Copy in your local quirks folder the current quirk:
Edit the file, adding the proposed quirk at the end of the file.
Restart HA, remove and pair you device again. Check that the device is loading the quirk and that the device signatura has changed.
As side comments, the quirk can configure the battery type. Can you tell which type is?
Not sure if the NODE_DESCRIPTOR
is needed here and also don't match. If the device (after a couple of tries) don't load the quirk, try to comment or remove this part.
I will try shortly.
The battery is a CR17450
Quirk appears to have loaded. Have not tested the "IASZone" yet (its loud).
@javicalle The CR17450
is not in ZCL R8 / Zigpy:
https://github.com/zigpy/zigpy/blob/e0faf074f6b26e638003b62180e2854a23e5b092/zigpy/zcl/clusters/general.py#L245-L255
But some "creative" person have adding little extra in ZHA for getting nice Xiaomi sensors displaying other battery formats: https://github.com/home-assistant/core/blob/4abe5aec6cffa174065c4f8865f091aed871eb19/homeassistant/components/zha/sensor.py#L81-L95 (type 9 - 11 is the extras and wold being better have using type number 20X if ZCL is adding new types in the low range)
Possible using 2: "Other"
or patching ZHA with CR17450
as done in the last example.
I guess I will have to set something on fire in the morning to see if the state of the IASZone entity updates when the alarm sounds.
I set off the alarm, but the state of the entity did not seem to update.
Any logs related? Is the temperature updating?
Please, enable debug logs and attach the relevant info.
I have enabled debug logs for 'zigpy' and 'zigpy_znp'.
I have restarted HA. The 'device temperature' entity has always been 'Unknown' and the IASZone has always been 'clear' (as far as I am aware).
I guess I will try to set something on fire again, and see if it updates.
Can I then just use 'Download Diagnostics' or do I have to check in the log file itself and find the relevant parts?
The ID of the smoke detector is 54:ef:44:10:00:48:2d:c1
2022-10-23 17:07:29.022 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=64704, SrcAddr=0x4D7E, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=94, SecurityUse=<Bool.false: 0>, TimeStamp=10459478, TSN=0, Data=b'\x18\x48\x0A\x3A\x01\x21\x01\x00\x3B\x01\x20\x0A', MacSrcAddr=0x4D7E, MsgResultRadius=29)
2022-10-23 17:07:29.022 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x4D7E), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=64704, data=Serialized[b'\x18H\n:\x01!\x01\x00;\x01 \n'], tx_options=<TransmitOptions.NONE: 0>, radius=29, non_member_radius=0, lqi=94, rssi=None)
2022-10-23 17:07:29.022 DEBUG (MainThread) [zigpy.device] Ignoring message (b'18480a3a012101003b01200a') on cluster 64704: unknown endpoint or cluster id: 'No cluster ID 0xfcc0 on (54:ef:44:10:00:48:2d:c1, 1)'
2022-10-23 17:07:36.474 DEBUG (MainThread) [zigpy_znp.api] Received command: ZDO.SrcRtgInd.Callback(DstAddr=0x15A6, Relays=[0x487F])
2022-10-23 17:07:36.475 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=1280, SrcAddr=0x15A6, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=43, SecurityUse=<Bool.false: 0>, TimeStamp=10924815, TSN=0, Data=b'\x19\x77\x00\x00\x00\x00\x00\x00\x00', MacSrcAddr=0x487F, MsgResultRadius=28)
2022-10-23 17:07:36.475 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x15A6), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=1280, data=Serialized[b'\x19w\x00\x00\x00\x00\x00\x00\x00'], tx_options=<TransmitOptions.NONE: 0>, radius=28, non_member_radius=0, lqi=43, rssi=None)
2022-10-23 17:07:36.475 DEBUG (MainThread) [zigpy.zcl] [0x15A6:1:0x0500] Received ZCL frame: b'\x19w\x00\x00\x00\x00\x00\x00\x00'
2022-10-23 17:07:36.475 DEBUG (MainThread) [zigpy.zcl] [0x15A6:1:0x0500] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=True, *is_general=False, *is_reply=True), tsn=119, command_id=0, *direction=<Direction.Client_to_Server: 1>, *is_reply=True)
2022-10-23 17:07:36.476 DEBUG (MainThread) [zigpy.zcl] [0x15A6:1:0x0500] Decoded ZCL frame: IasZone:status_change_notification(zone_status=<ZoneStatus.0: 0>, extended_status=<bitmap8.0: 0>, zone_id=0, delay=0)
2022-10-23 17:07:36.476 DEBUG (MainThread) [zigpy.zcl] [0x15A6:1:0x0500] Received command 0x00 (TSN 119): status_change_notification(zone_status=<ZoneStatus.0: 0>, extended_status=<bitmap8.0: 0>, zone_id=0, delay=0)
2022-10-23 17:07:51.902 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=64704, SrcAddr=0x4D7E, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=43, SecurityUse=<Bool.false: 0>, TimeStamp=11889524, TSN=0, Data=b'\x18\x49\x0A\x3B\x01\x20\x05', MacSrcAddr=0x4D7E, MsgResultRadius=29)
2022-10-23 17:07:51.902 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x4D7E), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=64704, data=Serialized[b'\x18I\n;\x01 \x05'], tx_options=<TransmitOptions.NONE: 0>, radius=29, non_member_radius=0, lqi=43, rssi=None)
2022-10-23 17:07:51.902 DEBUG (MainThread) [zigpy.device] Ignoring message (b'18490a3b012005') on cluster 64704: unknown endpoint or cluster id: 'No cluster ID 0xfcc0 on (54:ef:44:10:00:48:2d:c1, 1)'
2022-10-23 17:07:53.083 DEBUG (MainThread) [zigpy_znp.api] Sending request: SYS.Ping.Req()
2022-10-23 17:07:53.088 DEBUG (MainThread) [zigpy_znp.api] Received command: SYS.Ping.Rsp(Capabilities=<MTCapabilities.APP_CNF|GP|UTIL|ZDO|AF|SYS: 1625>)
2022-10-23 17:08:00.143 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=64704, SrcAddr=0x4D7E, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=65, SecurityUse=<Bool.false: 0>, TimeStamp=12404630, TSN=0, Data=b'\x18\x4A\x0A\x3B\x01\x20\x00', MacSrcAddr=0x4D7E, MsgResultRadius=29)
2022-10-23 17:08:00.143 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x4D7E), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=64704, data=Serialized[b'\x18J\n;\x01 \x00'], tx_options=<TransmitOptions.NONE: 0>, radius=29, non_member_radius=0, lqi=65, rssi=None)
2022-10-23 17:08:00.143 DEBUG (MainThread) [zigpy.device] Ignoring message (b'184a0a3b012000') on cluster 64704: unknown endpoint or cluster id: 'No cluster ID 0xfcc0 on (54:ef:44:10:00:48:2d:c1, 1)'
2022-10-23 17:08:03.952 DEBUG (MainThread) [zigpy_znp.api] Received command: ZDO.SrcRtgInd.Callback(DstAddr=0x15A6, Relays=[0x487F])
2022-10-23 17:08:03.969 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=1280, SrcAddr=0x15A6, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=36, SecurityUse=<Bool.false: 0>, TimeStamp=12643707, TSN=0, Data=b'\x19\x78\x00\x01\x00\x00\x00\x00\x00', MacSrcAddr=0x487F, MsgResultRadius=28)
2022-10-23 17:08:03.969 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x15A6), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=1280, data=Serialized[b'\x19x\x00\x01\x00\x00\x00\x00\x00'], tx_options=<TransmitOptions.NONE: 0>, radius=28, non_member_radius=0, lqi=36, rssi=None)
2022-10-23 17:08:03.969 DEBUG (MainThread) [zigpy.zcl] [0x15A6:1:0x0500] Received ZCL frame: b'\x19x\x00\x01\x00\x00\x00\x00\x00'
2022-10-23 17:08:03.969 DEBUG (MainThread) [zigpy.zcl] [0x15A6:1:0x0500] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=True, *is_general=False, *is_reply=True), tsn=120, command_id=0, *direction=<Direction.Client_to_Server: 1>, *is_reply=True)
2022-10-23 17:08:03.970 DEBUG (MainThread) [zigpy.zcl] [0x15A6:1:0x0500] Decoded ZCL frame: IasZone:status_change_notification(zone_status=<ZoneStatus.Alarm_1: 1>, extended_status=<bitmap8.0: 0>, zone_id=0, delay=0)
2022-10-23 17:08:03.970 DEBUG (MainThread) [zigpy.zcl] [0x15A6:1:0x0500] Received command 0x00 (TSN 120): status_change_notification(zone_status=<ZoneStatus.Alarm_1: 1>, extended_status=<bitmap8.0: 0>, zone_id=0, delay=0)
2022-10-23 17:08:13.224 DEBUG (MainThread) [zigpy_znp.api] Received command: ZDO.SrcRtgInd.Callback(DstAddr=0x98BB, Relays=[0x4E2C])
2022-10-23 17:08:13.280 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=1280, SrcAddr=0x98BB, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=98, SecurityUse=<Bool.false: 0>, TimeStamp=13225656, TSN=0, Data=b'\x19\x34\x00\x01\x00\x00\x00\x00\x00', MacSrcAddr=0x4E2C, MsgResultRadius=28)
2022-10-23 17:08:13.280 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x98BB), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=1280, data=Serialized[b'\x194\x00\x01\x00\x00\x00\x00\x00'], tx_options=<TransmitOptions.NONE: 0>, radius=28, non_member_radius=0, lqi=98, rssi=None)
2022-10-23 17:08:13.280 DEBUG (MainThread) [zigpy.zcl] [0x98BB:1:0x0500] Received ZCL frame: b'\x194\x00\x01\x00\x00\x00\x00\x00'
2022-10-23 17:08:13.280 DEBUG (MainThread) [zigpy.zcl] [0x98BB:1:0x0500] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=True, *is_general=False, *is_reply=True), tsn=52, command_id=0, *direction=<Direction.Client_to_Server: 1>, *is_reply=True)
2022-10-23 17:08:13.281 DEBUG (MainThread) [zigpy.zcl] [0x98BB:1:0x0500] Decoded ZCL frame: IasZone:status_change_notification(zone_status=<ZoneStatus.Alarm_1: 1>, extended_status=<bitmap8.0: 0>, zone_id=0, delay=0)
2022-10-23 17:08:13.281 DEBUG (MainThread) [zigpy.zcl] [0x98BB:1:0x0500] Received command 0x00 (TSN 52): status_change_notification(zone_status=<ZoneStatus.Alarm_1: 1>, extended_status=<bitmap8.0: 0>, zone_id=0, delay=0)
2022-10-23 17:08:17.013 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=64704, SrcAddr=0x4D7E, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=160, SecurityUse=<Bool.false: 0>, TimeStamp=13458988, TSN=0, Data=b'\x18\x4B\x0A\x3A\x01\x21\x00\x00\x3B\x01\x20\x00', MacSrcAddr=0x4D7E, MsgResultRadius=29)
2022-10-23 17:08:17.014 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x4D7E), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=64704, data=Serialized[b'\x18K\n:\x01!\x00\x00;\x01 \x00'], tx_options=<TransmitOptions.NONE: 0>, radius=29, non_member_radius=0, lqi=160, rssi=None)
2022-10-23 17:08:17.014 DEBUG (MainThread) [zigpy.device] Ignoring message (b'184b0a3a012100003b012000') on cluster 64704: unknown endpoint or cluster id: 'No cluster ID 0xfcc0 on (54:ef:44:10:00:48:2d:c1, 1)'
2022-10-23 17:08:22.122 DEBUG (MainThread) [zigpy_znp.api] Received command: ZDO.SrcRtgInd.Callback(DstAddr=0x98BB, Relays=[0x4E2C])
2022-10-23 17:08:22.174 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=1280, SrcAddr=0x98BB, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=76, SecurityUse=<Bool.false: 0>, TimeStamp=13781579, TSN=0, Data=b'\x19\x35\x00\x00\x00\x00\x00\x00\x00', MacSrcAddr=0x4E2C, MsgResultRadius=28)
2022-10-23 17:08:22.174 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x98BB), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=1280, data=Serialized[b'\x195\x00\x00\x00\x00\x00\x00\x00'], tx_options=<TransmitOptions.NONE: 0>, radius=28, non_member_radius=0, lqi=76, rssi=None)
2022-10-23 17:08:22.174 DEBUG (MainThread) [zigpy.zcl] [0x98BB:1:0x0500] Received ZCL frame: b'\x195\x00\x00\x00\x00\x00\x00\x00'
2022-10-23 17:08:22.175 DEBUG (MainThread) [zigpy.zcl] [0x98BB:1:0x0500] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=0, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=True, *is_general=False, *is_reply=True), tsn=53, command_id=0, *direction=<Direction.Client_to_Server: 1>, *is_reply=True)
2022-10-23 17:08:22.175 DEBUG (MainThread) [zigpy.zcl] [0x98BB:1:0x0500] Decoded ZCL frame: IasZone:status_change_notification(zone_status=<ZoneStatus.0: 0>, extended_status=<bitmap8.0: 0>, zone_id=0, delay=0)
2022-10-23 17:08:22.175 DEBUG (MainThread) [zigpy.zcl] [0x98BB:1:0x0500] Received command 0x00 (TSN 53): status_change_notification(zone_status=<ZoneStatus.0: 0>, extended_status=<bitmap8.0: 0>, zone_id=0, delay=0)
2022-10-23 17:08:23.088 DEBUG (MainThread) [zigpy_znp.api] Sending request: SYS.Ping.Req()
2022-10-23 17:08:23.093 DEBUG (MainThread) [zigpy_znp.api] Received command: SYS.Ping.Rsp(Capabilities=<MTCapabilities.APP_CNF|GP|UTIL|ZDO|AF|SYS: 1625>)
2022-10-23 17:08:29.779 DEBUG (MainThread) [zigpy.zcl] [0x4D7E:1:0x0003] Sending request header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.CLUSTER_COMMAND: 1>, is_manufacturer_specific=False, direction=<Direction.Server_to_Client: 0>, disable_default_response=0, reserved=0, *is_cluster=True, *is_general=False, *is_reply=False), tsn=66, command_id=0, *direction=<Direction.Server_to_Client: 0>, *is_reply=False)
2022-10-23 17:08:29.779 DEBUG (MainThread) [zigpy.zcl] [0x4D7E:1:0x0003] Sending request: identify(identify_time=5)
2022-10-23 17:08:29.780 DEBUG (MainThread) [zigpy.device] [0x4d7e] Extending timeout for 0x42 request
2022-10-23 17:08:29.780 DEBUG (MainThread) [zigpy_znp.zigbee.application] Sending packet ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x4D7E), dst_ep=1, source_route=None, extended_timeout=True, tsn=66, profile_id=260, cluster_id=3, data=Serialized[b'\x01B\x00\x05\x00'], tx_options=<TransmitOptions.ACK: 1>, radius=0, non_member_radius=0, lqi=None, rssi=None)
2022-10-23 17:08:29.781 DEBUG (MainThread) [zigpy_znp.api] Sending request: AF.DataRequestExt.Req(DstAddrModeAddress=AddrModeAddress(mode=<AddrMode.NWK: 2>, address=0x4D7E), DstEndpoint=1, DstPanId=0x0000, SrcEndpoint=1, ClusterId=3, TSN=66, Options=<TransmitOptions.SUPPRESS_ROUTE_DISC_NETWORK|ACK_REQUEST: 48>, Radius=0, Data=b'\x01\x42\x00\x05\x00')
2022-10-23 17:08:29.787 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.DataRequestExt.Rsp(Status=<Status.SUCCESS: 0>)
2022-10-23 17:08:36.197 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.DataConfirm.Callback(Status=<Status.SUCCESS: 0>, Endpoint=1, TSN=66)
2022-10-23 17:08:36.198 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=3, SrcAddr=0x4D7E, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=149, SecurityUse=<Bool.false: 0>, TimeStamp=14657520, TSN=0, Data=b'\x18\x42\x0B\x00\x00', MacSrcAddr=0x4D7E, MsgResultRadius=29)
2022-10-23 17:08:36.198 DEBUG (MainThread) [zigpy.application] Received a packet: ZigbeePacket(src=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x4D7E), src_ep=1, dst=AddrModeAddress(addr_mode=<AddrMode.NWK: 2>, address=0x0000), dst_ep=1, source_route=None, extended_timeout=False, tsn=0, profile_id=260, cluster_id=3, data=Serialized[b'\x18B\x0b\x00\x00'], tx_options=<TransmitOptions.NONE: 0>, radius=29, non_member_radius=0, lqi=149, rssi=None)
2022-10-23 17:08:36.198 DEBUG (MainThread) [zigpy.zcl] [0x4D7E:1:0x0003] Received ZCL frame: b'\x18B\x0b\x00\x00'
2022-10-23 17:08:36.198 DEBUG (MainThread) [zigpy.zcl] [0x4D7E:1:0x0003] Decoded ZCL frame header: ZCLHeader(frame_control=FrameControl(frame_type=<FrameType.GLOBAL_COMMAND: 0>, is_manufacturer_specific=0, direction=<Direction.Client_to_Server: 1>, disable_default_response=1, reserved=0, *is_cluster=False, *is_general=True, *is_reply=True), tsn=66, command_id=11, *direction=<Direction.Client_to_Server: 1>, *is_reply=True)
2022-10-23 17:08:36.198 DEBUG (MainThread) [zigpy.zcl] [0x4D7E:1:0x0003] Decoded ZCL frame: Identify:Default_Response(command_id=0, status=<Status.SUCCESS: 0>)
2022-10-23 17:08:53.094 DEBUG (MainThread) [zigpy_znp.api] Sending request: SYS.Ping.Req()
2022-10-23 17:08:53.099 DEBUG (MainThread) [zigpy_znp.api] Received command: SYS.Ping.Rsp(Capabilities=<MTCapabilities.APP_CNF|GP|UTIL|ZDO|AF|SYS: 1625>)
A couple of observations.
Logs shows 2 devices: 0x15A6
and 0x98BB
(these are the device Nwk values, you can check it in the device view, 'Zigbee info'). None of them seems to be your device (from the screenshot)
There is at least one device reporting values from the XiaomiAqaraE1Cluster
. We can add it to the quirk and see what is telling to us.
Add the import at the beggining of file:
from zhaquirks.xiaomi import (
LUMI,
XIAOMI_NODE_DESC,
BasicCluster,
DeviceTemperatureCluster,
XiaomiAqaraE1Cluster,
XiaomiPowerConfiguration,
XiaomiQuickInitDevice,
)
And in the replacement part:
replacement = {
SKIP_CONFIGURATION: True,
ENDPOINTS: {
1: {
INPUT_CLUSTERS: [
BasicCluster,
XiaomiPowerConfiguration,
Identify.cluster_id,
XiaomiSmokeIASCluster,
DeviceTemperatureCluster,
XiaomiAqaraE1Cluster,
],
OUTPUT_CLUSTERS: [Ota.cluster_id],
}
},
}
Remove any __pycache__
folder from your local quirk folder, restart HA and re pair the device.
Check the logs to see if there are any regular reports from device. But you will need to repeat the test to see if the quirk is working.
Hi, I have the same problem. I have bought these sensors, I connect them without problem to zigbee2mqtt. It has several sensors and options (alarm, mute) turn the light on or off every minute... it works fine when I change the option in home assistant, the problem happens when I set off the smoke alarm. the alarm sounds but does not send any message to the home assistant. For it to work I have to enter the expose option and update the status so that it detects the alarm!! I have tried to do what you say here, but everything continues the same. how can i check if it is picking up the quirks? Thanks a lot
If you are using zigbee2mqtt, you are not using that code. You must ask for help in the Z2M repository.
Got these smoke detectors to and I am trying to get them to work with ZHA. I got the above quirk to work and show the battery status of one of my detectors. so some progress. Not checked the smoke alarm yet. I removed the temperature cluster as I don't think that the device supports it.
I don't know if it helps. The site explains some of the clusters of he device in detail. https://home.miot-spec.com/spec/lumi.sensor_smoke.acn03
Maybe this information helps to determine the quirks necessary?
Als found this definition with ZHA Toolkit.
I picked up a few of these and am happy to try things out. To summarize so far:
The way forward here is to keep trying to iterate on a quirk until it works right?
Relevant Z2M code:
device definition: https://github.com/Koenkk/zigbee-herdsman-converters/blob/261066095215898c006e7c9c390c677129fae630/devices/xiaomi.js#L2118-L2154
converting messages from the device -> Z2M: https://github.com/Koenkk/zigbee-herdsman-converters/blob/261066095215898c006e7c9c390c677129fae630/lib/xiaomi.js#L377-L414 https://github.com/Koenkk/zigbee-herdsman-converters/blob/261066095215898c006e7c9c390c677129fae630/lib/xiaomi.js#L464-L473 https://github.com/Koenkk/zigbee-herdsman-converters/blob/261066095215898c006e7c9c390c677129fae630/lib/xiaomi.js#L479-L504 https://github.com/Koenkk/zigbee-herdsman-converters/blob/261066095215898c006e7c9c390c677129fae630/lib/xiaomi.js#L539-L548
messages from Z2M -> device: https://github.com/Koenkk/zigbee-herdsman-converters/blob/261066095215898c006e7c9c390c677129fae630/converters/toZigbee.js#L2667-L2738
... so it's quite a bit to do.
The framework in ZHA to parse the special Xiaomi messages is here (example from another device): https://github.com/zigpy/zha-device-handlers/blob/f6ab87e1c48ccb6db262e8732ca6b63d67fb6252/zhaquirks/xiaomi/__init__.py#L355-L365
(Edit: just saw that javicalle already linked this earlier)
All of these transformations should be possible to do in a quirk right?
Yeah. The most important part is probably this: https://github.com/Koenkk/zigbee-herdsman-converters/blob/261066095215898c006e7c9c390c677129fae630/lib/xiaomi.js#L380-L382
elif self.endpoint.device.model == "lumi.sensor_smoke.acn03":
attribute_names.update({160: "smoke_detected"})
The device would need a LocalDataCluster
for smoke
Then, the "smoke_detected" in the Xiaomi message could be used to write to that "fake" LocalDataCluster
endpoint (example from another device):
https://github.com/zigpy/zha-device-handlers/blob/f6ab87e1c48ccb6db262e8732ca6b63d67fb6252/zhaquirks/xiaomi/__init__.py#L288-L291
This is just for basic functionality (smoke detected or not).
If I have some time, I could try to actually implement this, but I don't have a sensor myself. Can anyone who would test this (I'd guess you have to cause some smoke -- not sure the test button is enough) upvote this comment?
I'm definitely in to test this. The other bells and whistles are nice to have someday but getting smoke detection working is certainly the main thing.
I haven't written a quirk before so I asked ChatGPT to take a stab at it and here's what it came up with. Not sure if any of it's useful or not:
Take a look at: https://github.com/TheJulianJES/zha-device-handlers/tree/tjj/aqara_smoke_detector If the entity doesn't appear (when removing + re-pairing device), try to see if something appears in the logs when the sensor detects smoke.
You either need to switch zhaquirks
to debug
level or do the following:
_LOGGER.debug(
"%s - Attribute report. attribute_id: [%s] value: [%s]",
replace debug
with warning
in the above code (in the Xiaomi __init__.py
file. That way, you'll easier see all custom Xiaomi reports (from the smoke sensor)).
To put this in a custom quirk, you have to put the added file and the Xiaomi __init__.py
file in your custom quirk folder and then replace this import in the added smoke quirk file:
from zhaquirks.xiaomi import DeviceTemperatureCluster, XiaomiAqaraE1Cluster
with
from . import DeviceTemperatureCluster, XiaomiAqaraE1Cluster
(If I'm correct)
I'll have another look at this later. No clue if this works at all.
Ok! I'm away from the smoke alarms today but I'll give this a try tomorrow! To confirm, my custom_zha_quirks
dir should look like this:
config/custom_zha_quirks/
∟xiaomi/
∟__init__.py
∟aqara/
∟smoke.py
Using xiaomi/__init__.py
(with the from . import DeviceTemperatureCluster, XiaomiAqaraE1Cluster
change and the _LOGGER.debug...
change) and xiomi/aqara/smoke.py. Is that correct?
With the .
import, both files need to be in the same folder (so no aqara folder).
Rest should be good I think.
Ok great, I'll give it a shot tomorrow. Thank you!
Nope did not have an effect. I removed the device. Re-paired it. Then made some smoke to set the alarm off. I didn't get any change or event in Home Assistant. The Quirk: xiaomi.smoke.LumiSensorSmokeAcn03
line shows that the quirk was loaded correct?
I'm seeing AttributeError: 'LumiSensorSmokeAcn03' object has no attribute 'battery_bus'
in the logs as an obvious potential problem. But not sure if that'd affect the smoke things too. I'm also not seeing any temperature entity show up which looks like it maybe should from reading your quirk.
What should I try next?
Here are my full logs:
I am looking to help add support for this smoke detector into ZHA.
Device signature
```yaml { "node_descriptor": "NodeDescriptor(logical_type=Diagnostic information
```yaml { "home_assistant": { "installation_type": "Home Assistant Container", "version": "2022.10.1", "dev": false, "hassio": false, "virtualenv": false, "python_version": "3.10.5", "docker": true, "arch": "x86_64", "timezone": "Australia/Brisbane", "os_name": "Linux", "os_version": "5.19.9-Unraid", "run_as_root": true }, "custom_components": { "watchman": { "version": "0.5.1", "requirements": [ "prettytable==3.0.0" ] }, "fullykiosk": { "version": "1.1.0", "requirements": [ "python-fullykiosk==0.0.11" ] }, "goodwe": { "version": "1.0.0", "requirements": [ "goodwe==0.2.20" ] }, "iotawatt": { "version": "0.2.1", "requirements": [ "iotawattpy==0.1.0" ] }, "bayislandsguide": { "version": "1.0.0", "requirements": [] }, "smartthinq_sensors": { "version": "0.24.2", "requirements": [ "pycountry>=20.7.3", "xmltodict>=0.12.0", "cchardet>=2.1.7" ] }, "unifigateway": { "version": "0.3.3", "requirements": [ "pyunifi==2.21" ] }, "spotcast": { "version": "v3.6.30", "requirements": [ "spotify_token==1.0.0" ] }, "weatherflow": { "version": "1.0.6", "requirements": [ "pyweatherflowrest==1.0.8" ] }, "sonoff": { "version": "3.3.1", "requirements": [ "pycryptodome>=3.6.6" ] }, "bureau_of_meteorology": { "version": "1.1.18", "requirements": [ "iso8601" ] }, "hacs": { "version": "1.28.0", "requirements": [ "aiogithubapi>=22.2.4" ] }, "garbage_collection": { "version": "4.8.3", "requirements": [ "python-dateutil>=2.8.2" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.34.1", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.82", "zigpy-deconz==0.19.0", "zigpy==0.51.2", "zigpy-xbee==0.16.0", "zigpy-zigate==0.10.0", "zigpy-znp==0.9.0" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "1A86", "pid": "55D4", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus v2" ] }, { "vid": "10C4", "pid": "EA60", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus" ] }, { "vid": "10C4", "pid": "EA60", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*tubeszb*", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "*zigstar*", "known_devices": [ "ZigStar Coordinators" ] }, { "vid": "1CF1", "pid": "0030", "description": "*conbee*", "known_devices": [ "Conbee II" ] }, { "vid": "10C4", "pid": "8A2A", "description": "*zigbee*", "known_devices": [ "Nortek HUSBZB-1" ] }, { "vid": "0403", "pid": "6015", "description": "*zigate*", "known_devices": [ "ZiGate+" ] }, { "vid": "10C4", "pid": "EA60", "description": "*zigate*", "known_devices": [ "ZiGate" ] }, { "vid": "10C4", "pid": "8B34", "description": "*bv 2010/10*", "known_devices": [ "Bitron Video AV2010/10" ] } ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" } ], "dependencies": [ "file_upload" ], "after_dependencies": [ "onboarding", "usb", "zeroconf" ], "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp" ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 55507, "manufacturer": "LUMI", "model": "lumi.sensor_smoke.acn03", "name": "LUMI lumi.sensor_smoke.acn03", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4447, "power_source": "Mains", "lqi": 174, "rssi": null, "last_seen": "2022-10-14T20:29:05", "available": false, "device_type": "EndDevice", "signature": { "node_descriptor": "NodeDescriptor(logical_type=Additional logs
``` Paste any additional debug logs here. Don't remove the extra line breaks outside the ``` marks. ```Additional context The device apparently has full support in Z2M, and the details of that can be seen here: https://www.zigbee2mqtt.io/devices/JY-GZ-01AQ.html