Koenkk / Koenkk/zigbee2mqtt

S60ZBTPF (fw 2.0.3): current/voltage/power/energy attributes null each other out on every report

Open
#32,927 1 comment 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?

The S60ZBTPF reports current, voltage, power, and the energy_* fields as separate Zigbee attribute reports (one attribute per message, via the customClusterEwelink cluster). The converter builds the published MQTT payload as a full object on every report, explicitly setting every field it did NOT just receive to null.

The result:
Each attribute report immediately overwrites the previously-known-good values for the other attributes with null. current, voltage, and power are essentially never all valid at the same time in the published state — whichever one arrived last is populated, the rest are null. Same pattern for energy_today/energy_month/energy_yesterday.

This is distinct from #29564 and #30173, which describe energy_today/month/yesterday going stale (frozen at old values) while current/power/voltage report correctly and simultaneously - their own debug log even shows one payload with all fields populated together. This issue is the opposite: the fields are individually correct but clobber each other on every report.

This is also not the "freezes at last value when off" issue fixed in firmware 2.0.3 (#28470) - that's a device-firmware behavior; this is a converter-side payload-construction issue. It persists after updating to 2.0.3 and after a full remove/re-pair.

Watched raw MQTT publishes over ~1 minute with the plug under a steady load. Every message contains at most one of current/voltage/power as a real number; the other two are explicitly null in that same message:

{"current":0.18,...,"power":null,...,"voltage":null}
{"power":24.9,...,"current":null,...,"voltage":null}
{"voltage":239.35,...,"current":null,...,"power":null}

What did you expect to happen?

A fromZigbee converter should only return the key(s) actually present in the incoming Zigbee message (or z2m should merge onto previously-published state), not overwrite unrelated fields with null on every report. current, voltage, and power should all remain populated with their last-known-good values between reports of each other.

How to reproduce it (minimal and precise)
  1. Pair a S60ZBTPF (tested on firmware 1.0.2 and 2.0.3, converters 26.90.0).
  2. Apply a steady load to the plug.
  3. Watch raw MQTT publishes on zigbee2mqtt/<friendly_name> for ~1 minute.
  4. Observe that each message populates at most one of current/voltage/power, explicitly nulling the other two.
Zigbee2MQTT version

2.13.0

Adapter firmware version

7.5.1 [GA]

Adapter

Home Assistant SkyConnect, EmberZNet

Setup

Home Assistant OS add-on, Rpi4

Device database.db entry

{"id":22,"type":"Router","ieeeAddr":"0xa4c1380b32f0ffff","nwkAddr":40901,"manufId":4742,"manufName":"SONOFF","powerSource":"Mains (single phase)","modelId":"S60ZBTPF","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,3,4,5,6,1794,2820,2821,64599,64529],"outClusterList":[10,25],"clusters":{"genBasic":{"attributes":{"modelId":"S60ZBTPF","manufacturerName":"SONOFF","powerSource":1,"zclVersion":3,"appVersion":16,"stackVersion":2,"hwVersion":16,"dateCode":"20250411","swBuildId":"1.0.2"}},"customClusterEwelink":{"attributes":{"28675":"\u0004\u000b\u0001\u0000\u0001hB\u0000\u0000\u0000\t=\u0000","acCurrentCurrentValue":693,"acCurrentVoltageValue":238883,"acCurrentPowerValue":209087,"outlet_control_protect":0,"networkLed":1,"energyYesterday":0,"energyToday":200,"energyMonth":200,"faultCode":50462720}},"seMetering":{"attributes":{"multiplier":1,"divisor":1000,"currentSummDelivered":150}},"genOnOff":{"attributes":{"onOff":1,"startUpOnOff":0}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0xbc026efffe22c982","endpointID":1},{"cluster":64529,"type":"endpoint","deviceIeeeAddress":"0xbc026efffe22c982","endpointID":1},{"cluster":1794,"type":"endpoint","deviceIeeeAddress":"0xbc026efffe22c982","endpointID":1}],"configuredReportings":[{"cluster":64529,"attrId":28682,"minRepIntval":60,"maxRepIntval":3600,"repChange":50},{"cluster":64529,"attrId":28683,"minRepIntval":60,"maxRepIntval":3600,"repChange":50},{"cluster":64529,"attrId":28681,"minRepIntval":60,"maxRepIntval":3600,"repChange":50},{"cluster":1794,"attrId":0,"minRepIntval":5,"maxRepIntval":3600,"repChange":257},{"cluster":6,"attrId":0,"minRepIntval":0,"maxRepIntval":65000,"repChange":1},{"cluster":64529,"attrId":28676,"minRepIntval":10,"maxRepIntval":65000,"repChange":2},{"cluster":64529,"attrId":28678,"minRepIntval":10,"maxRepIntval":65000,"repChange":0}],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":16,"stackVersion":2,"hwVersion":16,"dateCode":"20250411","swBuildId":"1.0.2","zclVersion":3,"interviewCompleted":true,"interviewState":"SUCCESSFUL","meta":{"configured":"0.0.0"},"lastSeen":1787603072579} {"id":23,"type":"Router","ieeeAddr":"0xa4c1380b631cffff","nwkAddr":11741,"manufId":4742,"manufName":"SONOFF","powerSource":"Mains (single phase)","modelId":"S60ZBTPF","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,3,4,5,6,1794,2820,2821,64599,64529],"outClusterList":[3,10,25],"clusters":{"customClusterEwelink":{"attributes":{"28675":"\u0004\u000b\u0001\u0000\u0001hB\u0000\u0000\u0000\t=\u0000","acCurrentCurrentValue":0,"acCurrentVoltageValue":239673,"acCurrentPowerValue":0,"outlet_control_protect":0,"networkLed":1,"energyYesterday":0,"energyToday":0,"energyMonth":0,"faultCode":50462720}},"seMetering":{"attributes":{"multiplier":1,"divisor":1000,"currentSummDelivered":0}},"genOnOff":{"attributes":{"onOff":1,"startUpOnOff":0}},"haElectricalMeasurement":{"attributes":{"rmsVoltage":23967,"rmsCurrent":0,"activePower":0}},"genBasic":{"attributes":{"modelId":"S60ZBTPF","manufacturerName":"SONOFF","powerSource":1,"zclVersion":3,"appVersion":16,"stackVersion":2,"hwVersion":16,"dateCode":"20260530","swBuildId":"2.0.3"}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0xbc026efffe22c982","endpointID":1},{"cluster":64529,"type":"endpoint","deviceIeeeAddress":"0xbc026efffe22c982","endpointID":1},{"cluster":1794,"type":"endpoint","deviceIeeeAddress":"0xbc026efffe22c982","endpointID":1}],"configuredReportings":[{"cluster":64529,"attrId":28682,"minRepIntval":60,"maxRepIntval":3600,"repChange":50},{"cluster":64529,"attrId":28683,"minRepIntval":60,"maxRepIntval":3600,"repChange":50},{"cluster":64529,"attrId":28681,"minRepIntval":60,"maxRepIntval":3600,"repChange":50},{"cluster":1794,"attrId":0,"minRepIntval":5,"maxRepIntval":3600,"repChange":257},{"cluster":6,"attrId":0,"minRepIntval":0,"maxRepIntval":65000,"repChange":1},{"cluster":64529,"attrId":28676,"minRepIntval":10,"maxRepIntval":65000,"repChange":2},{"cluster":64529,"attrId":28678,"minRepIntval":10,"maxRepIntval":65000,"repChange":0}],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":16,"stackVersion":2,"hwVersion":16,"dateCode":"20260530","swBuildId":"2.0.3","zclVersion":3,"interviewCompleted":true,"interviewState":"SUCCESSFUL","meta":{"configured":"0.0.0"},"lastSeen":1787603073355}

Debug log

[24/08/2026, 22:24:12] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:24:13.353Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:24:22] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:24:23.354Z","linkquality":224,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:24:32] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:24:33.355Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:24:42] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:24:43.357Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:24:52] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:24:53.362Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:25:02] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:25:03.362Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:25:12] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:25:13.359Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:25:22] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:25:23.360Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:25:33] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:25:33.361Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:25:42] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:25:43.361Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:25:52] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:25:53.361Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:26:03] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:26:03.367Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:26:13] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:26:13.369Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:26:22] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:26:23.364Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:26:33] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:26:33.364Z","linkquality":224,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:26:42] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:26:43.366Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:26:53] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:26:53.374Z","linkquality":216,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:27:03] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:27:03.367Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:27:13] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:27:13.371Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:27:23] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:27:23.378Z","linkquality":216,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:27:33] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:27:33.368Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:27:43] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:27:43.368Z","linkquality":224,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:27:53] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:27:53.382Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:28:02] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:28:03.370Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:28:13] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:28:13.370Z","linkquality":216,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:28:23] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:28:23.384Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'
[24/08/2026, 22:28:33] z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/sonoff-plug-2-nas', payload '{"current":null,"energy":null,"energy_month":null,"energy_today":null,"energy_yesterday":null,"last_seen":"2026-08-24T20:28:33.374Z","linkquality":220,"network_indicator":null,"outlet_control_protect":null,"overload_protection":null,"power":0,"power_on_behavior":null,"state":null,"update":{"installed_version":-1,"latest_version":-1,"state":null},"voltage":null}'

Notes

zigbee-herdsman-converters: 26.90.0
Device firmware: 2.0.3 (updated from 1.0.2/20250411 via the official OTA index)
Reproduced after a full remove + re-pair, so not a stale-config issue.

Confirmed on two separate S60ZBTPF units, on different firmware versions
(1.0.2/20250411 and 2.0.3/20260530) — same null-clobbering behavior on
both, which suggests this is purely a converter-side issue rather than
device/firmware-specific.

The device also reports via the standard haElectricalMeasurement cluster
(rmsVoltage/rmsCurrent/activePower) in addition to the proprietary
customClusterEwelink cluster the current converter reads from — visible
in the database.db entry above. Switching the converter to read from the
standard cluster instead may be a cleaner fix path than patching the
existing custom-cluster logic.

I've been running a local external converter that only returns the
attribute(s) actually present in each message (fixes the clobbering) as
a workaround, at the cost of losing overload_protection/network_indicator/
power_on_behavior exposes from the official definition. Happy to share it
if useful as a reference for a proper fix.

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 by locating the TypeScript fromZigbee converter for S60ZBTPF and its customClusterEwelink handling. Trace how separate current, voltage, power, and energy reports become MQTT payloads, then verify that an incoming report does not null unrelated fields and that previously published values remain available between reports.

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
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.