Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.71k stars 1.64k forks source link

Sercom SZ-ESW01-AU not reporting energy properly to HASS #11469

Closed jjwork closed 2 years ago

jjwork commented 2 years ago

What happened?

I'd like to get the energy reading please from this device into Home Assistant. It is not showing up as a sensor in the new 'Energy Monitoring' feature of HASS. The HASS doco suggests the energy data provided by the device is not in a format that HASS can accept.

What did you expect to happen?

The device's energy reading to be in a format that HASS can then use in its energy monitoring.

How to reproduce it (minimal and precise)

In Home Assistant.

Go to Configuration => Dashboards => Energy => Individual Devices => add a device

The Sercom device does not appear as an item to add

Zigbee2MQTT version

1.23.0

Adapter firmware version

20211217

Adapter

Tubez CC2652P2 Based Zigbee to PoE Coordinator

Debug log

No response

Koenkk commented 2 years ago

Could you check if this issue has been fixed with the following external converter:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    zigbeeModel: ['SZ-ESW01-AU'],
    model: 'SZ-ESW01-AU',
    vendor: 'Sercomm',
    description: 'Telstra smart plug',
    exposes: [e.switch(), e.power(), e.energy()],
    fromZigbee: [fz.on_off, fz.metering],
    toZigbee: [tz.on_off],
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'seMetering']);
        await reporting.onOff(endpoint);
        await reporting.instantaneousDemand(endpoint);
        await reporting.currentSummDelivered(endpoint);
        endpoint.saveClusterAttributeKeyValue('seMetering', {divisor: 1000000, multiplier: 1});
    },
};

module.exports = definition;
github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

AlexPotterOnGit commented 2 years ago

Hi Koenkk I followed above instructions and can confirm the energy is being reported: image

Could you please help to modify the converter to read • Amps/Current • Voltage ?

Cheers

Koenkk commented 2 years ago

@AlexPotterOnGit under the clusters tab, does this device show support for haElectricalMeasurement cluster? If yes try with the following converter:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
    zigbeeModel: ['SZ-ESW01-AU'],
    model: 'SZ-ESW01-AU',
    vendor: 'Sercomm',
    description: 'Telstra smart plug',
    exposes: [e.switch(), e.power(), e.energy(), e.current(), e.voltage()],
    fromZigbee: [fz.on_off, fz.metering, fz.electrical_measurement],
    toZigbee: [tz.on_off],
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'seMetering', 'haElectricalMeasurement']);
        await reporting.onOff(endpoint);
        await reporting.instantaneousDemand(endpoint);
        await reporting.currentSummDelivered(endpoint);
        endpoint.saveClusterAttributeKeyValue('seMetering', {divisor: 1000000, multiplier: 1});
        await reporting.readEletricalMeasurementMultiplierDivisors(endpoint);
        await reporting.rmsVoltage(endpoint);
        await reporting.rmsCurrent(endpoint);
    },
};

module.exports = definition;
AlexPotterOnGit commented 2 years ago

It does: image image I updated the converted and it expose everything now: image

Thank you very much @Koenkk, really appreciated. Alex.

Koenkk commented 2 years ago

Integrated the changes (so it will be included out-of-the-box in the next release)

jjwork commented 2 years ago

And another thank you to Koenkk !

This is working perfectly for me now - thank you !