Core: [SmartThings] Samsung DV80N62532W (Dryer) not reporting power consumption

Created on 17 Oct 2020  路  18Comments  路  Source: home-assistant/core

The problem

SmartThings integration is not reporting the power consumption from my Samsung DV80N62532W (Dryer). I'm able to see the past consumption in the SmartThings app. Would be great to have this in HA, along with the current consumption during a program.

Environment

Additional information

I also saw the following issue #36904. Not sure if it is related or not.

Name | Value | Attributes
------------ | ------------- | -------------
sensor.dryer_dryer_completion_time | 2020-10-17T19:27:24Z | friendly_name: Dryer Dryer Completion Time
device_class: timestamp
sensor.dryer_dryer_job_state | none | friendly_name: Dryer Dryer Job State
sensor.dryer_dryer_machine_state | stop | friendly_name: Dryer Dryer Machine State
switch.dryer | on | friendly_name: Dryer

enhancement smartthings

Most helpful comment

We don't need to guess -- I'll ask internally tomorrow and find out what these measure. Regarding how to represent it in HA, I would create a new sensor class (like three axsis) that reports energy as the primary value and then adds the other attributes as state attributes if a value is populated. There's no reason to make discrete sensors because the entire value will update atomically.

All 18 comments

Hey there @andrewsayre, mind taking a look at this issue as its been labeled with an integration (smartthings) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

That would be awesome! A good first step may be to follow the great instructions here https://github.com/andrewsayre/pysmartthings
to install it independently of Home Assistant and fiddle with it in Python REPL. Once initialized you can use the devices = await api.devices() to get a list of your devices. Then, find your dryer in the list and then read its capability attribute to see if it is already supporting powerMeter, energyMeter, or other.

I got the following capabilities for this Dryer:

[
  'ocf',
  'execute',
  'refresh',
  'switch',
  'remoteControlStatus',
  'dryerOperatingState',
  'powerConsumptionReport',
  'custom.disabledCapabilities',
  'custom.dryerDryLevel',
  'custom.dryerWrinklePrevent',
  'custom.jobBeginningStatus',
  'custom.supportedOptions',
  'samsungce.detergentOrder',
  'samsungce.detergentState',
  'samsungce.driverVersion',
  'samsungce.dryerAutoCycleLink',
  'samsungce.dryerCycle',
  'samsungce.kidsLock'
]

Is powerConsumptionReport something new? I can't find any traces in the library code for it.

powerConsumptionReport is in pysmartthings list of capabilities and exposed as a series of wrapper properties on the device class.

Currently powerConsumptionReport is only exposed for Air Conditions in the HA integration--it's not mapped to sensors for other devices. This is not a bug, but would be a feature enhancement to add mappings to the sensor platform.

Before we do that, can you output the value of the powerConsumptionReport? Given this is a "proposed" state capability, let's even see if your device is populating it before we add this to HA.

How about this (powerConsumption):

{
  'energy': 3500,
  'deltaEnergy': 0,
  'power': 0,
  'powerEnergy': 0.0,
  'persistedEnergy': 0,
  'energySaved': 0,
  'start': '2020-10-18T18:23:39Z',
  'end': '2020-10-19T22:11:43Z'
}

The attribute powerConsumptionReport does not exist.

Do you need more information or is there something that I can do to make this work?

Hey @Alexwijn ,
We have a few options. I can take a look at it and create a branch for you to clone and test locally if you're up for it. Since I don't have SmartThings I wouldn't feel too great about submitting the PR without your confirmation that it's working on your hardware. You might start here: https://developers.home-assistant.io/docs/development_environment/

I have been using the VSCode docker thingy lately and I am mostly happy with it. The more we simplify things the more complicated they get eh?

I have a washer that I can see that reports the same attribute. Maybe I could also help to test.
On Smarthings page I can see:

powerConsumption:
{
    "deltaEnergy": 0,
    "power": 0,
    "energy": 60800
}

@Alexwijn I just read more carefully

How about this (powerConsumption):

The attribute powerConsumptionReport does not exist.

It appears that powerConsumptionReport was in the list of capabilities output from your dryer's capabilities attribute yet powerConsumption was not.

Is it the case that:

1) dryer.capability is incorrectly reporting powerConsumptionReport as a capability
2) Querying powerConsumptionReport returns "empty" or "does not exist"
3) Manually querying for powerConsumption yields the results that should be returned by powerConsumptionReport

Thanks for clarifying!

So the name of the SmartThings capability is powerConsumptionReport and it contains a single attribute powerConsumption whose value is a JSON object of sub-attributes. It appears that energy is the only value being populated reliably between the two samples provided. Does the value of that attribute provide anything meaningful to you?

@Alexwijn @cobirnm You can test out whether this has exposed the sensor by cloning this branch:
https://github.com/JPHutchins/core/tree/smartthrings-dryer-42006
Or if it is more comfortable you can just view this commit and insert these lines at 147 of smartthings/sensor.py, as in the commit:
https://github.com/JPHutchins/core/commit/0d05aff141901803a2b4c6ef3025276fb867e63e#

    Capability.power_consumption_report: [
        Map(Attribute.power_consumption, "Power Consumption Report", None, None)
    ],

*You _could_ do this in your live version of Home Assistant at your own risk! Better to setup your development environment: https://developers.home-assistant.io/docs/development_environment/

The data may be nested under that powerConsumption attribute you found. If you want to go further then check out the code in the climate.py component to see how it was dealt with:
https://github.com/JPHutchins/core/blob/0d05aff141901803a2b4c6ef3025276fb867e63e/homeassistant/components/smartthings/climate.py#L417-L440

Good luck, let me know if you get any data!

I'm testing this as a custom component and I think the code works. I get a new sensor as you can see in the picture below:

image

I just haven't figured out how often the sensor updates itself.

After a complete washing cycle I can state that deltaEnergy and energy are updated.
One issue only. Does anyone know how to pass the data in to atributes?

This is not well documented by Samsung.

@cobirnm What is your intuition regarding the values of "deltaEnergy" and "energy"? For example, is "energy" the cumulative energy used by the device over its lifetime in Watt-hours?

I am trying to understand why "deltaEnergy" would ever report zero. I would think that "deltaEnergy" would report the amount of energy used by the last load.

@andrewsayre What do you think is the best way to make this data useful in Home Assistant?

image

We don't need to guess -- I'll ask internally tomorrow and find out what these measure. Regarding how to represent it in HA, I would create a new sensor class (like three axsis) that reports energy as the primary value and then adds the other attributes as state attributes if a value is populated. There's no reason to make discrete sensors because the entire value will update atomically.

This is not well documented by Samsung.

@cobirnm What is your intuition regarding the values of "deltaEnergy" and "energy"? For example, is "energy" the cumulative energy used by the device over its lifetime in Watt-hours?

I am trying to understand why "deltaEnergy" would ever report zero. I would think that "deltaEnergy" would report the amount of energy used by the last load.

@andrewsayre What do you think is the best way to make this data useful in Home Assistant?

image

Up until now by what I have observed it seems that:
deltaEnergy-> amount of energy spent during the cycle in Wh (wats hour)
power -> haven't had any values
energy-> total of Wh (I beleive that it's since the washer started working)

The deltaEnergy not always update but the energy is in line with what is shown in smarthings app.

image

OK, here's the definition of the values:

  • start: Start date of the reporting period in Iso8601Date format
  • end: End date of the reporting period in Iso8601Date format
  • energy: Accumulated energy consumption during the reporting period in watt-hours (Wh)
  • power: Instantaneous power consumption during the reporting period in watts (W)
  • deltaEnergy: Delta of accumulated energy consumption during the reporting period in watt-hours (Wh)
  • powerEnergy: Energy consumption during the reporting period calculated from instantaneous power consumption in watt-hours (Wh)
  • energySaved: Energy saved during the report period in watt-hours (Wh)
  • persistedEnergy: Accumulated energy consumption that was saved into device local DB in watt-hours (Wh)

Note: I don't know the frequency or logic behind when a "report" is generated, but I suspect it correlates to a cycle on the appliance. Based on the definition above, energy is not cumulative, rather will get reset every "report". If your goal is to determine total energy used (on-going), you'll need to create a separate sensor for total energy that adds the value of energy whenever it's updated (when a new report comes out).

I'm happy to submit a PR for this, unless @JPHutchins wants to. 馃槃

I will give it a shot!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sogeniusio picture sogeniusio  路  3Comments

flsabourin picture flsabourin  路  3Comments

arangates picture arangates  路  3Comments

kirichkov picture kirichkov  路  3Comments

Konstigt picture Konstigt  路  3Comments