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

DDF for IKEA INSPELNING smart plug #7959

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bluemoehre
Copy link
Contributor

Solves #7948

Need verification / double check of Consumption calculation.
Phoscon shows value as wH, while comments and docs states value should be in kWh.

Anyway, I have already tested and confirmed that the raw value 0x0702 / 0x0000 in deCONZ GUI is in wH. Based on the divisor value from 0x0302, I added a x1000 division.

Maybe @ebaauw can help?

Copy link
Contributor

github-actions bot commented Oct 7, 2024

Hey @bluemoehre, thanks for your pull request!

Tip

Modified bundles can be downloaded here.
Relative expire date

DDB changes

Modified

  • ikea/inspelning_smart_plug.json : INSPELNING smart plug ✔️

Validation

Tip

Everything is fine !

🕠 Updated for commit d0c3f72

@ebaauw
Copy link
Collaborator

ebaauw commented Oct 7, 2024

The API should report consumption in Wh, see https://github.com/dresden-elektronik/deconz-rest-plugin/blob/master/devices/generic/items/state_consumption_item.json.

If the device reports Current Summation Delivered in Wh, no conversion is needed. I don't use Phoscon, and have no clue how they report consumption.

The devices that I have don't use divisors/multipliers on Simple Metering, but instead use Summation Formatting. I never really figured out how that works, so I tend to use a known load (e.g. an old 60W Tungsten bulb), and see what the device reports to figure out it's scaling. Also check the Unit of Measure attribute. If that's kW and kWh binary (what I see in my cases), and 0x0000 reports in Wh, the divisor should be 1000, to transform Wh to the advertised kWh.

@SwoopX
Copy link
Collaborator

SwoopX commented Oct 7, 2024

Actually, the logic here is quite simple:
The unit of measurement is kW/kWh. To get it, take the value and apply multiplier and divisor.

If, for the given device, attribute 0x0000 gives us the value of 4, the math is 4*1/1000 = 0,004. That means the device reports already in Wh and the DDF value calculation is incorrect.

Ideally, the multipliers and divisors are correct. However, we also had enough devices out there where that is just rubbish.

@bluemoehre
Copy link
Contributor Author

bluemoehre commented Oct 7, 2024

I was testing 1h having a 6.5W bulb connected and total consumption (0x0702 / 0x0000) reported 6.

image

As far as I understand these data, there are only two approaches possible:

A

Formatting block just tells clients how to convert values to get to "kW & kWh binary" units, which is a default display to the user.

  • raw values are in base units (plain Watts - no milli, no kilo etc.)
  • raw values are provided to the API (no DDF conversion takes place)
  • formatting info is provided in the API as well (clients can use it if they want to convert)

B

Formatting block tells devs how to convert values to meet standards.

  • Values must be converted to meet standards (DDF conversion takes place)
  • Standard is described in the formatting block (to meet "kW & kWh binary")
  • Conversion needs to take place before providing data to the API (clients get user-ready data)

(C)

Formatting block / measured value is just bananas, and you have to find out yourself, as @SwoopX pointed out ;)


It's just a matter of what is the default/specs.
For both variants (A+B) the available data + formatting info generally is correct.

Based on your feedback @ebaauw, as well as what I see in the Phoscon UI, I think the first variant is the one to go.
So, I gonna remove the division.

@bluemoehre bluemoehre marked this pull request as ready for review October 7, 2024 14:10
@SwoopX
Copy link
Collaborator

SwoopX commented Oct 7, 2024

Formatting block / measured value is just bananas

Not sure where I should have said that, but I warned taking things for granted. That's also why it was suggested to verify with a known load. The zigbee spec is quite clear in my view how to use the formatting attributes (as described above) and also that the summation formatting doesn't play a considerable role 🤷‍♂️

@Mimiix Mimiix linked an issue Oct 8, 2024 that may be closed by this pull request
1 task
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.

IKEA INSPELNING Smart Plug with kWh meter
3 participants