Koenkk / Koenkk/zigbee2mqtt

SONOFF BASIC-ZB1GSP: total_energy_consumption removed in 2.14.0, total_energy reads 0 on firmware 1.0.5

Open Beginner friendly
#33,044 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What happened?

#13028 (shipped in 2.14.0) removed the total_energy_consumption expose from BASIC-ZB1GSP. That one read the standard seMetering cluster:

m.numeric<"seMetering">({
    name: "total_energy_consumption",
    cluster: "seMetering",
    attribute: "currentSummDelivered",
    ...

What's left is total_energy, which reads the vendor cluster instead (customClusterEwelink, attribute totalEnergyConsumption, 0x701e). My plugs are on firmware 1.0.5 and never populate that attribute, so total_energy just sits at 0.

The device does report cumulative energy, it's just no longer being read. From database.db, endpoint 1:

"seMetering": {"attributes": {"currentSummDelivered": 88843, "multiplier": 1, "divisor": 1000}}

88843 / 1000 = 88.843 kWh, which is what total_energy_consumption was reporting.

Both exposes were present in 2.13.0, so you can see the difference in a single payload from the same device:

{
  "energy_today": 10.13,
  "energy_month": 34.908,
  "energy_yesterday": 7.633,
  "total_energy_consumption": 88.843,
  "total_energy": 0,
  "power": 0
}

I have 6 of these plugs and all 6 behave the same way. All are on firmware 1.0.5, dateCode 20260627.

One thing worth flagging: this isn't only a rename. When an expose goes away, Z2M publishes an empty payload to homeassistant/sensor/<ieee>/total_energy_consumption/config, which tells Home Assistant to delete the entity. HA deletes its long-term statistics along with it. So upgrading to 2.14.0 wiped months of energy history for all 6 plugs and zeroed my Energy dashboard, and because the replacement entity reads 0 there was nothing to fall back on. I got the history back by restoring the recorder database from a backup and re-importing the rows by hand.

2.14.1 doesn't fix this

#13089 gates the three export exposes (output_energy_today, output_energy_month, total_output_energy) behind firmware >= 1.3.0, which does correctly hide them on older firmware. But it doesn't bring back total_energy_consumption. I checked the pinned v26.105.0/src/devices/sonoff.ts and there's no expose with that name in the BASIC-ZB1GSP block. The PR description says "Preserve the legacy consumption-record exposes for firmware versions below v1.3.0", but the diff only touches the three reverse-energy ones.

There's no firmware route out either. All 6 plugs report installed 4101 / latest 4101, so no OTA is on offer and they can't get to 1.3.0.

What did you expect to happen?

total_energy_consumption to keep reporting from seMetering.currentSummDelivered, like it did up to 2.13.0.

For a fix, the same firmware gating used in #13089 would work: put the seMetering expose back for firmware < 1.3.0 and leave newer firmware on the vendor attribute. Restoring it unconditionally would also be fine as far as I can tell, since seMetering is populated either way, and it would avoid breaking existing Home Assistant statistics a second time.

Happy to test a patch on my devices if that helps.

How to reproduce it (minimal and precise)

  1. Pair a BASIC-ZB1GSP running firmware 1.0.5 (dateCode 20260627).
  2. On 2.13.0, the published state has both total_energy_consumption (correct and rising) and total_energy (0).
  3. Upgrade to 2.14.0 or 2.14.1.
  4. total_energy_consumption is gone from the exposes and from the published state. Only total_energy is left, stuck at 0.
  5. database.db shows seMetering.currentSummDelivered still incrementing normally the whole time.

Zigbee2MQTT version

2.14.1 (also seen on 2.14.0; I've rolled back to 2.13.0, where it works)

Adapter firmware version

7.4.5 [GA]

Adapter

SONOFF Zigbee Dongle Max, ember driver, over TCP

Setup

Plain Zigbee2MQTT in a Debian 13 LXC on Proxmox, x86-64.

Linux zigbee2mqtt 7.0.14-8-pve #1 SMP PREEMPT_DYNAMIC PMX 7.0.14-8 (2026-07-28T10:28Z) x86_64 GNU/Linux
Debian GNU/Linux 13

Device database.db entry

{"id":95,"type":"Router","ieeeAddr":"0xa4c1381c060effff","nwkAddr":37030,"manufId":4742,"manufName":"SONOFF","modelId":"BASIC-ZB1GSP","powerSource":"Mains (single phase)","zclVersion":3,"appVersion":16,"stackVersion":2,"hwVersion":16,"dateCode":"20260627","swBuildId":"1.0.5","epList":[1,242],"interviewCompleted":true}

Endpoint 1 clusters: genBasic, genOnOff, haElectricalMeasurement, seMetering, customClusterEwelink, 64529

Notes

energy_today, energy_month and energy_yesterday all read the same vendor cluster and work fine on this firmware, so it looks specific to totalEnergyConsumption (0x701e) rather than the cluster as a whole.

On 2.14.0 all 6 plugs also logged configReport failures, genOnOff.onOff returning UNSUPPORTED_ATTRIBUTE and the ewelink energy attributes timing out. Re-configuring by hand didn't change anything and didn't affect the 0 value, so I don't think it's the cause. Mentioning it in case it's a hint about what this firmware actually supports.

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

Start in src/devices/sonoff.ts at the BASIC-ZB1GSP definition and compare its current exposes with the firmware gating described in #13089. Verify how seMetering.currentSummDelivered and the vendor energy attribute are selected for firmware 1.0.5 and newer versions. Done means older firmware publishes total_energy_consumption without losing the existing newer-firmware behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.