Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Device Support Request] Heiman CO_CTPG Carbon Monoxide sensor #1995

Closed
pfefferle opened this issue Dec 8, 2022 · 12 comments · Fixed by #2001
Closed

[Device Support Request] Heiman CO_CTPG Carbon Monoxide sensor #1995

pfefferle opened this issue Dec 8, 2022 · 12 comments · Fixed by #2001

Comments

@pfefferle
Copy link

Is your feature request related to a problem? Please describe.
Similar to #1826

When Heiman CO_CTPG Monoxide Carbon sensor is added to HA it reports as a "Mains" powerd device and after some hours drops out of the network

Describe the solution you'd like
If possible a custom quirk to correct it.

Device signature
{
  "node_descriptor": "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=4627, maximum_buffer_size=64, maximum_incoming_transfer_size=0, server_mask=0, maximum_outgoing_transfer_size=0, descriptor_capability_field=<DescriptorCapability.ExtendedSimpleDescriptorListAvailable|ExtendedActiveEndpointListAvailable: 3>, *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)",
  "endpoints": {
    "1": {
      "profile_id": 260,
      "device_type": "0x0402",
      "in_clusters": [
        "0x0000",
        "0x0001",
        "0x0003",
        "0x0009",
        "0x0500"
      ],
      "out_clusters": [
        "0x0019"
      ]
    }
  },
  "manufacturer": "Heiman",
  "model": "CO_CTPG",
  "class": "zigpy.device.Device"
}
Diagnostic information
"data": {
    "ieee": "**REDACTED**",
    "nwk": 53862,
    "manufacturer": "Heiman",
    "model": "CO_CTPG",
    "name": "Heiman CO_CTPG",
    "quirk_applied": false,
    "quirk_class": "zigpy.device.Device",
    "manufacturer_code": 4627,
    "power_source": "Mains",
    "lqi": 255,
    "rssi": -74,
    "last_seen": "2022-12-08T00:05:24",
    "available": false,
    "device_type": "EndDevice",
    "signature": {
      "node_descriptor": "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=4627, maximum_buffer_size=64, maximum_incoming_transfer_size=0, server_mask=0, maximum_outgoing_transfer_size=0, descriptor_capability_field=<DescriptorCapability.ExtendedSimpleDescriptorListAvailable|ExtendedActiveEndpointListAvailable: 3>, *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)",
      "endpoints": {
        "1": {
          "profile_id": 260,
          "device_type": "0x0402",
          "in_clusters": [
            "0x0000",
            "0x0001",
            "0x0003",
            "0x0009",
            "0x0500"
          ],
          "out_clusters": [
            "0x0019"
          ]
        }
      }
    },
    "active_coordinator": false,
    "entities": [
      {
        "entity_id": "binary_sensor.carbon_monoxide",
        "name": "Heiman CO_CTPG"
      },
      {
        "entity_id": "button.carbon_monoxide_identify",
        "name": "Heiman CO_CTPG"
      }
    ],
    "neighbors": [],
    "routes": [],
    "endpoint_names": [
      {
        "name": "IAS_ZONE"
      }
    ],
    "user_given_name": "Carbon Monoxide",
    "device_reg_id": "74a1c4e034572067293754c4e47218c7",
    "area_id": "746840d334f149c382e786dca8d15b11",
    "cluster_details": {
      "1": {
        "device_type": {
          "name": "IAS_ZONE",
          "id": 1026
        },
        "profile_id": 260,
        "in_clusters": {
          "0x0000": {
            "endpoint_attribute": "basic",
            "attributes": {
              "0x0004": {
                "attribute_name": "manufacturer",
                "value": "Heiman"
              },
              "0x0005": {
                "attribute_name": "model",
                "value": "CO_CTPG"
              }
            },
            "unsupported_attributes": {}
          },
          "0x0003": {
            "endpoint_attribute": "identify",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0500": {
            "endpoint_attribute": "ias_zone",
            "attributes": {
              "0x0000": {
                "attribute_name": "zone_state",
                "value": 1
              },
              "0x0001": {
                "attribute_name": "zone_type",
                "value": 43
              },
              "0x0002": {
                "attribute_name": "zone_status",
                "value": 32
              },
              "0x0010": {
                "attribute_name": "cie_addr",
                "value": [
                  175,
                  231,
                  4,
                  255,
                  255,
                  46,
                  33,
                  0
                ]
              }
            },
            "unsupported_attributes": {}
          },
          "0x0001": {
            "endpoint_attribute": "power",
            "attributes": {},
            "unsupported_attributes": {}
          },
          "0x0009": {
            "endpoint_attribute": "alarms",
            "attributes": {},
            "unsupported_attributes": {}
          }
        },
        "out_clusters": {
          "0x0019": {
            "endpoint_attribute": "ota",
            "attributes": {},
            "unsupported_attributes": {}
          }
        }
      }
    }
  }
Additional logs
Paste any additional debug logs here.
Don't remove the extra line breaks outside the ``` marks.

Additional context

Bildschirm­foto 2022-12-08 um 11 57 40

@javicalle
Copy link
Collaborator

javicalle commented Dec 8, 2022

There is a proposed quirk:

HeimanSmokCO_CTPG
class HeimanSmokCO_CTPG(CustomDevice):
    """CO_CTPG quirk."""

    signature = {
        MODELS_INFO: [(HEIMAN, "CO_CTPG")],
        ENDPOINTS: {
            1: {
                # "profile_id": 260,
                # "device_type": "0x0402",
                # "in_clusters": ["0x0000","0x0001","0x0003","0x0009","0x0500"]
                # "out_clusters": ["0x0019"]
                PROFILE_ID: zigpy.profiles.zha.PROFILE_ID,
                DEVICE_TYPE: zigpy.profiles.zha.DeviceType.IAS_ZONE,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    PowerConfiguration.cluster_id,
                    Identify.cluster_id,
                    Alarms.cluster_id,
                    IasZone.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            },
        },
    }

    replacement = {
        NODE_DESCRIPTOR: zigpy.zdo.types.NodeDescriptor(
            logical_type=2,
            complex_descriptor_available=0,
            user_descriptor_available=0,
            reserved=0,
            aps_flags=0,
            frequency_band=8,
            mac_capability_flags=132 & 0b1111_1011,
            manufacturer_code=4627,
            maximum_buffer_size=64,
            maximum_incoming_transfer_size=0,
            server_mask=0,
            maximum_outgoing_transfer_size=0,
            descriptor_capability_field=3,
        ),
        ENDPOINTS: {
            1: {
                PROFILE_ID: zigpy.profiles.zha.PROFILE_ID,
                DEVICE_TYPE: zigpy.profiles.zha.DeviceType.IAS_ZONE,
                INPUT_CLUSTERS: [
                    Basic.cluster_id,
                    PowerConfiguration.cluster_id,
                    Identify.cluster_id,
                    Alarms.cluster_id,
                    IasZone.cluster_id,
                ],
                OUTPUT_CLUSTERS: [
                    Ota.cluster_id,
                ],
            },
        },
    }

There is a guide about enabling custom quirks:

Copy inside the current heidan/smoke.py file:

Add the proposed code in bottom of the file.
Restart HA and pair you device again. Check that the device is loading the quirk and that the device signature has changed.

@pfefferle
Copy link
Author

pfefferle commented Dec 9, 2022

@javicalle thanks a lot for the quirk! I tried it several times, but the local quirk wasn't loaded. Maybe I misconfigured something. Will check again later today.

@javicalle
Copy link
Collaborator

The signature seems OK. Have you tried to remove and pair the device again?
Any error during the startup?
If not working, try to enable the debug logs and look for the device quirk resolution.

@pfefferle
Copy link
Author

pfefferle commented Dec 9, 2022

I had the quirk in the wrong folder! it works like a charm! thanks a lot!

Bildschirm­foto 2022-12-09 um 19 42 50

@javicalle
Copy link
Collaborator

Can you confirm that device isn't dropping with the quirk?

@pfefferle
Copy link
Author

Still available (after nearly an hour). I will check back later today, with an update.

And here is the screenshot with the expanded Zigbee Info (I forgot the in the last screenshot):

Bildschirm­foto 2022-12-09 um 20 20 03

@pfefferle
Copy link
Author

pfefferle commented Dec 9, 2022

Still available! Seems to work as it should!

@pfefferle
Copy link
Author

12h later: still available!

@javicalle
Copy link
Collaborator

Thanks for confirming. 👍🏻
I have created the PR, so I hope that will come with the next version.
Once included, you can delete your local quirk.

@pfefferle
Copy link
Author

pfefferle commented Jul 31, 2023

@javicalle since version 2023.06 or 2023.05 the device is mostly offline again. After reconnecting I see it for about half an hour or an hour and then it disconnects again. The Energysource is "Battery or Unknown".

The signature is

{
  "node_descriptor": "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: 128>, manufacturer_code=4627, maximum_buffer_size=64, maximum_incoming_transfer_size=0, server_mask=0, maximum_outgoing_transfer_size=0, descriptor_capability_field=<DescriptorCapability.ExtendedActiveEndpointListAvailable|ExtendedSimpleDescriptorListAvailable: 3>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)",
  "endpoints": {
    "1": {
      "profile_id": "0x0104",
      "device_type": "0x0402",
      "input_clusters": [
        "0x0000",
        "0x0001",
        "0x0003",
        "0x0009",
        "0x0500"
      ],
      "output_clusters": [
        "0x0019"
      ]
    }
  },
  "manufacturer": "Heiman",
  "model": "CO_CTPG",
  "class": "zhaquirks.heiman.smoke.HeimanSmokCO_CTPG"
}

@javicalle
Copy link
Collaborator

There had not been changes in the applied quirk from the initial version.
Your device signature shows that quirk is applied and that the mac_capability_flags has the desired value.

It would be changes at ZHA level, but would affect several devices for sure (the mac_capability_flags fix is not uncommon). I haven't see any report in ZHA in this way.

Can it be a low battery issue or noise network?

@pfefferle
Copy link
Author

@javicalle I will check that, thanks for your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants