Hive no battery status

The Hive provides the state of charge via the standard Zigbee cluster, this can be seen in deCONZ and also in the Phoscon app. Unfortunately, we have no way of knowing whether other gateways can read this. Other options on the Hive side are currently being evaluated.

In addition to using the Hive in a Zigbee network, the Hive Bluetooth App can also be used (for Android, iOS is in progress). The charge status can also be seen there.

I’d love to see if someone could ask the developers whether the MACCapabilityFlags for the Power Source are set correctly. I understand that deCONZ doesn’t evaluate this flag, but it seems that both ZHA and HUE do.

By changing this flag to “battery powered or unknown,” which appears to be the correct setting for a battery lamp, your lamp would become fully compatible with widely used Zigbee systems like ZHA and HUE.

The developers take a closer look at the topic. It is possible that a firmware update will be released in the future.

Thank you very much.

I delved into the Custom Quirks of ZHA and wrote my own custom quirk for HIVE.
With this quirk, the HIVE device now displays the battery status correctly.
I have confirmed that the issue was due to an incorrect setting of the MacCapabilityFlag.

This line of code in my Quirk solves the problem.

self.node_desc.mac_capability_flags &= ~0b00000100  # Clear the mains powered bit

1 Like

I had some interest and questions about this topic … there is a step-by-step guide including the code.

Prerequisites

  • Visual Code Server Add-on:
    It is recommended to install and use the Visual Code Server add-on for editing files. This add-on provides an integrated development environment within Home Assistant, making it easier to manage your configuration files.

Step-by-Step Guide

  1. Create the Directory
    In your Home Assistant CONFIG directory, create a new folder named custom_zha_quirks.
    2.Note:* If you already have a folder for custom quirks, you can skip this step and adjust the configuration in the next step accordingly.
  2. Update the Configuration
    Open your configuration.yaml file and add the following lines to tell Home Assistant where to find your custom quirks:
zha:
  custom_quirks_path: /config/custom_zha_quirks/
  1. Initialize the Python Package
    Inside the custom_zha_quirks directory, create a file named __init__.py. This file can remain empty, but it is required to mark the directory as a Python package.
  2. Copy the Quirk Code
    Create a new file named phoscon_hive_quirk.py in the custom_zha_quirks directory and copy the following code into it:

Code phoscon_hive_quirk.py:

from zigpy.profiles import zha
from zigpy.quirks import CustomDevice
from zigpy.zcl.clusters.general import Basic, PowerConfiguration, Identify, Groups, Scenes, OnOff, LevelControl, Ota, GreenPowerProxy
from zigpy.zcl.clusters.lighting import Color

class PhosconHive(CustomDevice):
    """Custom device representing Phoscon Hive."""

    signature = {
        "models_info": [("Phoscon", "Hive")],
        "endpoints": {
            1: {
                "profile_id": 0x0104,
                "device_type": 0x010d,
                "input_clusters": [
                    Basic.cluster_id,
                    PowerConfiguration.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    LevelControl.cluster_id,
                    Color.cluster_id
                ],
                "output_clusters": [
                    Ota.cluster_id,
                ],
            },
            242: {
                "profile_id": 0xA1E0,
                "device_type": 0x0061,
                "input_clusters": [],
                "output_clusters": [
                    GreenPowerProxy.cluster_id,
                ],
            },
        },
    }

    replacement = {
        "endpoints": {
            1: {
                "profile_id": 0x0104,
                "device_type": 0x010d,
                "input_clusters": [
                    Basic.cluster_id,
                    PowerConfiguration.cluster_id,
                    Identify.cluster_id,
                    Groups.cluster_id,
                    Scenes.cluster_id,
                    OnOff.cluster_id,
                    LevelControl.cluster_id,
                    Color.cluster_id
                ],
                "output_clusters": [
                    Ota.cluster_id,
                ],
            },
            242: {
                "profile_id": 0xA1E0,
                "device_type": 0x0061,
                "input_clusters": [],
                "output_clusters": [
                    GreenPowerProxy.cluster_id,
                ],
            },
        },
    }

    def __init__(self, *args, **kwargs):
        """Initialize the device."""
        super().__init__(*args, **kwargs)
        self.node_desc.mac_capability_flags &= ~0b00000100  # Clear the mains powered bit
  1. Restart Home Assistant
    After saving the changes, restart Home Assistant so that the new configuration is loaded and your custom quirk is applied.

Works perfectly!
Hive battery level is now displayed under “Diagnostics”.
I didn’t even have to install the Studio Code Server-Addon.
On ZHA integration page, there’s a configuration entry called “enable_quirks”. Seems to work - as in your instructions - even without it.