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

Can't add seMetering to Schneider Wiser smart plug #2926

Closed
rindlerblabla opened this issue Aug 19, 2021 · 3 comments · Fixed by #2941
Closed

Can't add seMetering to Schneider Wiser smart plug #2926

rindlerblabla opened this issue Aug 19, 2021 · 3 comments · Fixed by #2941

Comments

@rindlerblabla
Copy link
Contributor

rindlerblabla commented Aug 19, 2021

The Schneider Wiser smart plug is supported as on/off, https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/devices/schneider_electric.js#L129-L142. Am now trying to add support for seMetering (by copy pasteing code from other devices. Don't really know what I am doing.). Any suggestions how to fix this?

Adjusted the code to following, but the metering values are not being updated

{
    zigbeeModel: ['SMARTPLUG/1'],
        model: 'CCT711119',
        vendor: 'Schneider Electric',
        description: 'Wiser smart plug',
        fromZigbee: [fz.on_off, fz.metering],
        toZigbee: [tz.on_off],
        exposes: [e.switch(), e.power(), e.energy()],
        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.readMeteringMultiplierDivisor(endpoint);
    }

The following is being posted to the log:

Debug Received MQTT message on 'zigbee2mqtt/Lightsonlampor/set' with data 'ON'
Info MQTT publish: topic 'zigbee2mqtt/Lightsonlampor', payload '{"energy":null,"last_seen":"2021-08-19T09:35:11.729Z","linkquality":78,"power":0,"state":"ON"}'
Debug Received Zigbee message from 'Lightsonlampor', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 1 with groupID 0
Debug Received Zigbee message from 'Lightsonlampor', type 'attributeReport', cluster 'haElectricalMeasurement', data '{"activePower":15}' from endpoint 1 with groupID 0
Info MQTT publish: topic 'zigbee2mqtt/Lightsonlampor', payload '{"energy":null,"last_seen":"2021-08-19T09:35:12.253Z","linkquality":78,"power":0,"state":"ON"}'

And this is the error code:

Error Failed to configure 'Lightsonlampor', attempt 3 (Error: ConfigureReporting 0x5c0272fffe537ef8/1 seMetering([{"attribute":"instantaneousDemand","minimumReportInterval":5,"maximumReportInterval":3600,"reportableChange":1}], {"sendWhenActive":false,"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'UNSUPPORTED_ATTRIBUTE') at Endpoint.checkStatus (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:293:23) at Endpoint.configureReporting (/app/node_modules/zigbee-herdsman/src/controller/model/endpoint.ts:627:22) at Object.instantaneousDemand (/app/node_modules/zigbee-herdsman-converters/lib/reporting.js:104:9) at Object.configure (/app/dist/util/externally-loaded.js:21:13) at Configure.configure (/app/lib/extension/configure.js:137:13))

@rindlerblabla
Copy link
Contributor Author

From the database.db

{"id":9,"type":"Router","ieeeAddr":"0x5c0272fffe537ef8","nwkAddr":53798,"manufId":4190,"manufName":"Schneider Electric","powerSource":"Mains (single phase)","modelId":"SMARTPLUG/1","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,3,4,5,6,1794,2820,2821],"outClusterList":[3,25],"clusters":{"genBasic":{"attributes":{"modelId":"SMARTPLUG/1","manufacturerName":"Schneider Electric","powerSource":1,"zclVersion":3,"appVersion":1,"stackVersion":2,"hwVersion":1,"dateCode":"20200929","swBuildId":"2.02.04"}},"haElectricalMeasurement":{"attributes":{"activePower":0}},"genOnOff":{"attributes":{"onOff":0}},"seMetering":{"attributes":{"multiplier":1,"divisor":100,"currentSummDelivered":[0,148]}}},"binds":[{"cluster":6,"type":"endpoint","deviceIeeeAddress":"0x00124b0021b95170","endpointID":1},{"cluster":2820,"type":"endpoint","deviceIeeeAddress":"0x00124b0021b95170","endpointID":1},{"cluster":1794,"type":"endpoint","deviceIeeeAddress":"0x00124b0021b95170","endpointID":1}],"configuredReportings":[{"cluster":2820,"attrId":1291,"minRepIntval":5,"maxRepIntval":3600,"repChange":1},{"cluster":6,"attrId":0,"minRepIntval":0,"maxRepIntval":3600,"repChange":0}],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":1,"stackVersion":2,"hwVersion":1,"dateCode":"20200929","swBuildId":"2.02.04","zclVersion":3,"interviewCompleted":true,"meta":{"configured":1466202208},"lastSeen":1629221382746}

@sjorge
Copy link
Contributor

sjorge commented Aug 20, 2021

Well the device doesn't support saMetering.instantaneousDemand, it says so in the message UNSUPPORTED_ATTRIBUTE.

I might support haElectricalMeasurement.activePower though.

    {
        zigbeeModel: ['SMARTPLUG/1'],
        model: 'CCT711119',
        vendor: 'Schneider Electric',
        description: 'Wiser smart plug',
        fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering, fz.power_on_behavior],
        toZigbee: [tz.on_off, tz.power_on_behavior, tz.electrical_measurement_power],
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']);
            await reporting.onOff(endpoint);
            // only activePower seems to be support, although compliance document states otherwise
            await endpoint.read('haElectricalMeasurement', ['acPowerMultiplier', 'acPowerDivisor']);
            await reporting.activePower(endpoint);
            await reporting.readMeteringMultiplierDivisor(endpoint);
            await reporting.currentSummDelivered(endpoint, {min: 60, change: 1});
        },
        exposes: [
            e.switch(), e.power().withAccess(ea.STATE_GET), e.energy(),
            exposes.enum('power_on_behavior', ea.ALL, ['off', 'previous', 'on'])
                .withDescription('Controls the behaviour when the device is powered on'),
        ],
    },

@rindlerblabla
Copy link
Contributor Author

Thanks a lot! Seems to work just fine! Will evaluate and then create a PR.

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

Successfully merging a pull request may close this issue.

2 participants