Koenkk / zigbee-herdsman-converters

Collection of device converters to be used with zigbee-herdsman
MIT License
916 stars 3.03k forks source link

Report change value of instantaneousDemand #7917

Closed shinasys closed 1 month ago

shinasys commented 2 months ago

https://github.com/Koenkk/zigbee-herdsman-converters/blob/8049aceee3cc6750779fc4827a8848107a1d0ad9/src/lib/modernExtend.ts#L1611-L1617

Shouldn't the value 5 in instantaneousDemand be 0.005? Both currentSummDelivered and instantaneousDemand belong to the seMetering cluster, so they should use the same unit.

Also, the value of 0.1kWh for currentSummDelivered seems too large. I think a value of 0.01kWh would be more appropriate. Since standard electrical outlets generally consume less power than power meters, it seems necessary to lower the default value.

I would suggest making the following changes to the code.

seMetering: {
            // Report change with every 5W change
            power: {attribute: 'instantaneousDemand', divisor: 'divisor', multiplier: 'multiplier', forced: args.power, change: 0.005},
            // Report change with every 0.01kWh change
            energy: {attribute: 'currentSummDelivered', divisor: 'divisor', multiplier: 'multiplier', forced: args.energy, change: 0.01},
            // produced_energy: {attribute: 'currentSummReceived', divisor: 'divisor', multiplier: 'multiplier', forced: args.energy, change: 0.1},
        },

Alternatively, I think it would be more useful if the electricityMeter() could be modified to accept input parameters of report(min,max,change).

Koenkk commented 2 months ago

Shouldn't the value 5 in instantaneousDemand be 0.005?

Yes you are right, since the value is in kWh

Also, the value of 0.1kWh for currentSummDelivered seems too large. I think a value of 0.01kWh

That would make the device report with every 10 W change, would that be too often? I think every 100 W is fine. Note that if users for whatever reason want it more frequent, they can easily change it via the configure tab

Alternatively, I think it would be more useful if the electricityMeter() could be modified to accept input parameters of report(min,max,change).

We want to unify the reporting, so preferably not.

shinasys commented 2 months ago

they can easily change it via the configure tab

That's a different issue, but The change value of uint48 type is not modified in the reporting tab of the configuration. image

Koenkk commented 1 month ago

That's a different issue, but The change value of uint48 type is not modified in the reporting tab of the configuration.

Will be solved in the next z2m release!