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

Add support for Niko Smart plug with earthing pin #2082

Merged
merged 3 commits into from
Jan 16, 2021
Merged

Conversation

sjorge
Copy link
Contributor

@sjorge sjorge commented Jan 14, 2021

Although the compliance document for the 552-80699 looks nearly identical to 170-33505 (suspicious) and claims rmsVoltage/rmsCurrent is supported, we get UNSUPPORTED_ATTRIBUTE while trying to setup reporting or reading the linked attributes in readEletricalMeasurementMultiplierDivisors.

seMetering also cleans support for a few properties, but same story there, although currentSummDelivered did seem to take a reporting config. It never reported anything for me.

Just configuring activePower separately does seem to yield a somewhat correct power reading. My 1000lm Tradfri bulb reads 13 watt, behind an Ubisys S1 it reads 12-13 watt depending on the device. So it looks to be within expected variance of ~4W < 100 watt load and ~5% for > 100 watt loads.

Although the compliance document for the 552-80699 looks nearly identical to 170-33505 (suspicious) and claims rmsVoltage/rmsCurrent is supported, we get UNSUPPORTED_ATTRIBUTE while trying to setup reporting or reading the  linked attributes in readEletricalMeasurementMultiplierDivisors.

seMetering also cleans support for a few properties, but same story there, although currentSummDelivered did seem to take a reporting config. It never reported anything for me.

Just configuring activePower seperately does seem to yield a somewhat correct power reading. My 1000lm Tradfri bulb reads 13 watt, behind a Ubisys S1 it reads 12-13 watt depending on the device. So it looks to be within expected variance and I believe the readings are good.
@sjorge
Copy link
Contributor Author

sjorge commented Jan 14, 2021

From Meter CLuster & Electrical Measurement Only_ZHA.xml

Note I trimmed most of this to add the notes...

<cluster>
<name>Simple Metering</name>
<code>0x0702</code>
<define>SIMPLE_METERING_CLUSTER</define>
<!-- Does indeed take reporting config, report 1x 0,0 and no update even after 1h with the bulb on -->
<attribute side="server" code="0x0000" define="CURRENT_SUMMATION_DELIVERED" mandatory="true" name="current summation delivered">TRUE</attribute>
<!-- also takes reporting config, never reported -->
<attribute side="server" code="0x0200" define="STATUS" mandatory="true" name="status">TRUE</attribute>
<!-- didn't take reporting config, document incorrect? ... only manual reading (not tried that) -->
<attribute side="server" code="0x0400" define="INSTANTANEOUS_DEMAND" mandatory="false" name="instantaneous demand">TRUE</attribute>
</cluster>

We get the demand via haElectricalMeasurement anyway... I'll add looking into the status attribute on my todo list...

<cluster>
<name>Electrical Measurement</name>
<code>0x0B04</code>
<define>ELECTRICAL_MEASUREMENT_CLUSTER</define>
<!-- lies, rmsVoltage* is not reportable or readable -->
<attribute source="server" code="0x0505" define="RMS_VOLTAGE" mandatory="false" name="rms voltage"/>TRUE</attribute>
<attribute source="server" code="0x0506" define="RMS_VOLTAGE_MIN" mandatory="false" name="rms voltage min"/>
<attribute source="server" code="0x0507" define="RMS_VOLTAGE_MAX" mandatory="false" name="rms voltage max"/>
<!-- lies, rmsCurrent* is not reportable or readable -->
<attribute source="server" code="0x0508" define="RMS_CURRENT" mandatory="false" name="rms current"/>TRUE</attribute>
<attribute source="server" code="0x0509" define="RMS_CURRENT_MIN" mandatory="false" name="rms current min"/>
<attribute source="server" code="0x050A" define="RMS_CURRENT_MAX" mandatory="false" name="rms current max"/>
<!-- actually, yes, this works fine -->
<attribute source="server" code="0x050B" define="ACTIVE_POWER" mandatory="false" name="active power"/>TRUE</attribute>
<attribute source="server" code="0x050C" define="ACTIVE_POWER_MIN" mandatory="false" name="active power min"/>
<attribute source="server" code="0x050D" define="ACTIVE_POWER_MAX" mandatory="false" name="active power max"/>
</cluster>

I believe most of this may have been copied form 170-33505, shame it does not provide extra measurements. But it's a solid build plug (with earthpin, good for me as a belgian) that support power measurement at least.

@sjorge
Copy link
Contributor Author

sjorge commented Jan 14, 2021

Added power_on support, looks like the plug supports it.
On, Off and Previous seem to be working.

@sjorge
Copy link
Contributor Author

sjorge commented Jan 14, 2021

Should we add them as LEEDARSON-Smart Plug-FR300 instead? All the compliance documents mentioned that, I guess they are just rebranding an components in there own shell.

Edit: not even that, it looks exactly the same! https://zigbeealliance.org/zigbee_products/leedarson-smart-plug-fr300/

Didn't seem to report at all without change: 1, but was rather spammy so also set min to 1 minute.
@sjorge
Copy link
Contributor Author

sjorge commented Jan 15, 2021

Got energy to work too!
image

@Koenkk
Copy link
Owner

Koenkk commented Jan 16, 2021

Thanks!

@Koenkk Koenkk merged commit 1c8da8b into Koenkk:master Jan 16, 2021
@sjorge sjorge deleted the patch-6 branch January 16, 2021 13:45
@sjorge
Copy link
Contributor Author

sjorge commented Jan 16, 2021

@Koenkk any particular action needed to get the product icon to show?

@Koenkk
Copy link
Owner

Koenkk commented Jan 16, 2021

If you mean picture in frontend, I will add it in the next release.

@sjorge
Copy link
Contributor Author

sjorge commented Jan 16, 2021

Yeah, I noticed it seem to pull all the basic info form devices.js for the docgen, but not the picture.

@fluppie
Copy link

fluppie commented Jan 19, 2021

Possible that I can't copy paste "the updated version" without errors?


    {
        zigbeeModel: ['Smart plug Zigbee PE'],
        model: '552-80699',
        vendor: 'Niko',
        description: 'Smart plug with earthing pin',
        fromZigbee: [fz.on_off, fz.electrical_measurement, fz.metering],
        toZigbee: [tz.on_off, tz.power_on_behavior],
        meta: {configureKey: 1},
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff', 'haElectricalMeasurement', 'seMetering']);
            // 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(), e.energy(),
            exposes.enum('power_on_behavior', exposes.access.STATE_SET, ['off', 'previous', 'on'])
                .withDescription('Controls the behaviour when the device is powered on'),
        ],
    },

> zigbee2mqtt@1.17.0 start /zigbee2mqtt-1.17.0
> node index.js
/zigbee2mqtt-1.17.0/node_modules/zigbee-herdsman-converters/devices.js:14470
            exposes.enum('power_on_behavior', ea.ALL, ['off', 'previous', 'on'])
                                              ^
ReferenceError: ea is not defined
    at Object.<anonymous> (/zigbee2mqtt-1.17.0/node_modules/zigbee-herdsman-converters/devices.js:14470:47)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/zigbee2mqtt-1.17.0/node_modules/zigbee-herdsman-converters/index.js:3:17)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
npm
 ERR! code ELIFECYCLE
npm ERR! errno 1
npm
 ERR! zigbee2mqtt@1.17.0 start: `node index.js`

@sjorge
Copy link
Contributor Author

sjorge commented Jan 19, 2021

Looks like it didn't get pasted correctly/ The error points to ea.ALL while it should be exposes.access.STATE_ALL

@fluppie
Copy link

fluppie commented Jan 19, 2021

As far as I can see, the copy paste is 1:1. I also tried downloading the whole devices.js from your commit. Does not work for me; now back to the pre e.energy() file and it works again.

Zigbee2MQTT:info  2021-01-19 19:01:22: Starting Zigbee2MQTT version 1.17.0 (commit #1.17.0)
Zigbee2MQTT:info  2021-01-19 19:01:22: Starting zigbee-herdsman (0.13.46)
Zigbee2MQTT:info  2021-01-19 19:01:34: zigbee-herdsman started

Zigbee herdsman too old?

@sjorge
Copy link
Contributor Author

sjorge commented Jan 19, 2021

Not sure, it’s working fine on dev release at at least for me.

@sjorge
Copy link
Contributor Author

sjorge commented Feb 3, 2021

@fluppie 1.17.1 was release so this should now be included

@fluppie
Copy link

fluppie commented Feb 3, 2021

There is a energy property right now. Says 0 kWh, will see if it changes in the future.
Is it possible that https://www.zigbee2mqtt.io/devices/170-33505.html also has this energy property in the zigbee payload? I also have one like this in the living room.

@sjorge
Copy link
Contributor Author

sjorge commented Feb 3, 2021

It was 0 for me for ages too, I had to use a heated fan to make it go up.

been slowly going up since then though with normal use too. If you repair it resets to 0.

Would be nice to be able to reset it, but not found how (Not sure it’s possible) to do it via zigbee.

@fluppie
Copy link

fluppie commented Feb 3, 2021

I have the central heating gas burner connected to it. I use it as a "detector" to see if it's working or not.
Standby is 3W and in use is 40-45W. It's been there since 2 weeks and I still get a zero? Maybe it will only register from now on?

@sjorge
Copy link
Contributor Author

sjorge commented Feb 3, 2021 via email

@waltvm
Copy link

waltvm commented May 2, 2023

I added this smart plug in my home Assistant with zigbee2mqtt. The device is recognized and I can set it on and off but the power gives 0 all the time. In read this discussion but it is to technical for me. Is there a simple way to make de power display the right value?

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 this pull request may close these issues.

4 participants