# Hive no battery status

**URL:** <https://forum.phoscon.de/t/hive-no-battery-status/4874>\
**Category:** Dresden-Elektronik Hardware\
**Created:** [May 13, 2024, 7:33pm UTC](https://forum.phoscon.de/t/hive-no-battery-status/4874 "2024-05-13T19:33:51Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![ich](https://forum.phoscon.de/user_avatar/forum.phoscon.de/ich/32/19_2.png) [@ich](https://forum.phoscon.de/u/ich)\
**Post date:** [June 11, 2024, 12:50pm UTC](https://forum.phoscon.de/t/hive-no-battery-status/4874/21 "2024-06-11T12:50:18Z")

</div>

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](https://phoscon.de/en/hive/software) can also be used (for Android, iOS is in progress). The charge status can also be seen there.

---

<div class="post-metadata">

**Author:** ![AlexW75](https://forum.phoscon.de/user_avatar/forum.phoscon.de/alexw75/32/4470_2.png) [@AlexW75](https://forum.phoscon.de/u/AlexW75)\
**Post date:** [June 11, 2024, 1:45pm UTC](https://forum.phoscon.de/t/hive-no-battery-status/4874/22 "2024-06-11T13:45:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ich](https://forum.phoscon.de/user_avatar/forum.phoscon.de/ich/32/19_2.png) [@ich](https://forum.phoscon.de/u/ich)\
**Post date:** [June 13, 2024, 2:51pm UTC](https://forum.phoscon.de/t/hive-no-battery-status/4874/23 "2024-06-13T14:51:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AlexW75](https://forum.phoscon.de/user_avatar/forum.phoscon.de/alexw75/32/4470_2.png) [@AlexW75](https://forum.phoscon.de/u/AlexW75)\
**Post date:** [June 13, 2024, 7:42pm UTC](https://forum.phoscon.de/t/hive-no-battery-status/4874/24 "2024-06-13T19:42:19Z")

</div>

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.

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

```

 ![HIVE_WITH_BAT](https://forum.phoscon.de/uploads/default/original/2X/e/e54c38cff3748ab813c1f13ac81a11162bf227dd.png)

---

<div class="post-metadata">

**Author:** ![AlexW75](https://forum.phoscon.de/user_avatar/forum.phoscon.de/alexw75/32/4470_2.png) [@AlexW75](https://forum.phoscon.de/u/AlexW75)\
**Post date:** [February 8, 2025, 9:32am UTC](https://forum.phoscon.de/t/hive-no-battery-status/4874/25 "2025-02-08T09:32:43Z")

</div>

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:

```auto
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`:

```auto
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.

---

<div class="post-metadata">

**Author:** ![7knips](https://forum.phoscon.de/user_avatar/forum.phoscon.de/7knips/32/5405_2.png) [@7knips](https://forum.phoscon.de/u/7knips)\
**Post date:** [February 8, 2025, 10:08am UTC](https://forum.phoscon.de/t/hive-no-battery-status/4874/26 "2025-02-08T10:08:58Z")

</div>

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](https://www.home-assistant.io/integrations/zha/), there’s a configuration entry called “enable\_quirks”. Seems to work - as in your instructions - even without it.

[Previous page](https://forum.phoscon.de/t/hive-no-battery-status/4874.md?page=1)
