Koenkk / Koenkk/zigbee2mqtt

Energymeter PJ-1203A name missing in HomeAssistant config

Open
#33,086 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

problem
Dominant language
TypeScript
Stars
15.7k
Forks
2k
Avg merge
18h 55m
Merged PRs (30d)
35

Description

What happened?

Hi devs,
the energymeter PJ-1203A reports different sensors with the same name (Current, Power and Energy). This makes it really hard to use them in Homeassistant as it is not clear which sensor is which one.

Example:
Image

This is a homeassistant config entry from mqtt for the sensor power_a:

{
  "availability": [
    {
      "topic": "zigbee2mqtt2/bridge/state",
      "value_template": "{{ value_json.state }}"
    },
    {
      "topic": "zigbee2mqtt2/energymeter01/availability",
      "value_template": "{{ value_json.state }}"
    }
  ],
  "availability_mode": "all",
  "default_entity_id": "sensor.energymeter01_power_a",
  "device": {
    "hw_version": 1,
    "identifiers": [
      "zigbee2mqtt_0xa4c1380fed8c5c53"
    ],
    "manufacturer": "Tuya",
    "model": "Bidirectional energy meter with 80A current clamp",
    "model_id": "PJ-1203A",
    "name": "energymeter01",
    "via_device": "zigbee2mqtt_bridge_0x00124b0031def79f"
  },
  "device_class": "power",
  "enabled_by_default": true,
  "object_id": "energymeter01_power_a",
  "origin": {
    "name": "Zigbee2MQTT",
    "sw": "2.14.1",
    "url": "https://www.zigbee2mqtt.io"
  },
  "state_class": "measurement",
  "state_topic": "zigbee2mqtt2/energymeter01",
  "unique_id": "0xa4c1380fed8c5c53_power_a_zigbee2mqtt2",
  "unit_of_measurement": "W",
  "value_template": "{{ value_json[\"power_a\"] }}"
}

While this is from sensor energy_flow_a:

{
  "availability": [
    {
      "topic": "zigbee2mqtt2/bridge/state",
      "value_template": "{{ value_json.state }}"
    },
    {
      "topic": "zigbee2mqtt2/energymeter01/availability",
      "value_template": "{{ value_json.state }}"
    }
  ],
  "availability_mode": "all",
  "default_entity_id": "sensor.energymeter01_energy_flow_a",
  "device": {
    "hw_version": 1,
    "identifiers": [
      "zigbee2mqtt_0xa4c1380fed8c5c53"
    ],
    "manufacturer": "Tuya",
    "model": "Bidirectional energy meter with 80A current clamp",
    "model_id": "PJ-1203A",
    "name": "energymeter01",
    "via_device": "zigbee2mqtt_bridge_0x00124b0031def79f"
  },
  "name": "Energy flow a",
  "object_id": "energymeter01_energy_flow_a",
  "origin": {
    "name": "Zigbee2MQTT",
    "sw": "2.14.1",
    "url": "https://www.zigbee2mqtt.io"
  },
  "state_topic": "zigbee2mqtt2/energymeter01",
  "unique_id": "0xa4c1380fed8c5c53_energy_flow_a_zigbee2mqtt2",
  "value_template": "{{ value_json[\"energy_flow_a\"] }}"
}

It seems, that for the Current, Power and Energy sensors there is missing the name attribute in the config.
Is it possible to add them so that a distinction can be made?

What did you expect to happen?

No response

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

2.14.1

Adapter firmware version

20240710

Adapter

SLZB-06

Setup

Debian 13 virtual maschine

Device database.db entry

No response

Debug log

No response

Notes

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Search the device definitions for PJ-1203A and trace how its Current, Power, and Energy sensors become Home Assistant MQTT discovery entries; verify the generated entries include distinct names and remain valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.