Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seMetereing is only for electricity. Could it be used for other metering devices? (Gas meter example) #8596

Open
IgnacioHR opened this issue Jan 12, 2025 · 1 comment

Comments

@IgnacioHR
Copy link

Hi,

I'm in the process to create a zigbee device using an esp32c6 to measure the amount of gas consumed at home. At this stage I've successfully defined a zigbee device descriptor including the attributes for:

  • current_summation_delivered (UINT32)
  • multiplier (1)
  • divisor (100)
  • unit_of_measure (m3)
  • summation_formatting (0x72)
  • metering_device_type (0x01 gas)

When the device is connected to the zigbee network, zigbee2mqtt raises an error:

error 2025-01-12 17:54:10z2m: Failed to configure '0x404ccafffe417978', attempt 6 (Error: ZCL command 0x404ccafffe417978/1 seMetering.configReport([{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":0.5,"attribute":"instantaneousDemand"},{"minimumReportInterval":10,"maximumReportInterval":65000,"reportableChange":10,"attribute":"currentSummDelivered"}], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"reservedBits":0,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE') at Endpoint.checkStatus (/opt/zigbee2mqtt/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:349:28) at Endpoint.zclCommand (/opt/zigbee2mqtt/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:954:26) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Endpoint.configureReporting (/opt/zigbee2mqtt/node_modules/.pnpm/[email protected]/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:686:9) at setupAttributes (/opt/zigbee2mqtt/node_modules/.pnpm/[email protected]/node_modules/src/lib/modernExtend.ts:158:17) at result.configure (/opt/zigbee2mqtt/node_modules/.pnpm/[email protected]/node_modules/src/lib/modernExtend.ts:1949:29) at Object.configure (/opt/zigbee2mqtt/node_modules/.pnpm/[email protected]/node_modules/src/index.ts:257:21) at Configure.configure (/opt/zigbee2mqtt/lib/extension/configure.ts:124:13) at Configure.onMQTTMessage (/opt/zigbee2mqtt/lib/extension/configure.ts:49:25) at EventEmitter.wrappedCallback (/opt/zigbee2mqtt/lib/eventBus.ts:204:17))

and once I debug it come up to the conclusion that seMetering is mostly defined for electric devices with a value of power defined in the attribute 'instantaneousDemand' that is not possible for me to provide (and I'm not sure if it makes any sense for a simple gas counter)

Shall it be possible to open the seMetering for other devices that can't implement 'instantaneousDemand' ? a possible approach could be to start by checking 'metering_device_type' == 0x00 (Electric Metering) and then continue with current attributes but in case of 'metering_device_type' == 0x01 (Gas metering) react differently (I'm sorry I can't define the best way as I'm not an expert on this matter)

Thank you for reading!

Note in case you want to know more. Currently I've hacked a door sensor and I'm receiving the pulses from the gas meter magnet in a wheel directly in home assistant. The problem with current solution is that I'm missing pulses from time to time when HA is not powered. So I've started a path to create my own zigbee device based on an esp32c6 (i know a bit about hardware and software...) so that device can count the pulses internally and report the value back to home assistant. Hopefully that device can be battery powered (end device) as I've no access to a power supply near the gas meter.

This project is not a high priority as I'm doing it in my spare time and just because I enjoy doing it. In any case, I want to do it right and I'm open to keep learning...

Regards

@IgnacioHR
Copy link
Author

Hello everyone,

I’m excited to share that I’ve just released the source code for my Zigbee Gas Meter project. You can find the repository here: Zigbee Gas Meter.

In the repository, I’ve included an external converter file for Zigbee2MQTT: zigbee2mqtt external_converters file.

While I believe the converter works as intended, it may not adhere to the best practices or standards. Regardless, creating this has been a valuable learning experience, especially in understanding how to integrate custom Zigbee devices with Zigbee2MQTT.

I’ve also noticed there might be room for improvement in handling the seMetering cluster within Zigbee2MQTT. Perhaps this could evolve into a feature request, but for now, I’ll keep this issue open to encourage discussion and activity around this topic.

Thank you for your time, and I appreciate any feedback or insights you might have.

Best regards,
Ignacio

@IgnacioHR IgnacioHR changed the title modernExtend.ts line 1709 configureLookup and seMetereing can't be property used for a simple Gas meter seMetereing is only for electricity. Could it be used for other metering devices? (Gas meter example) Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant