ollo69 / ha-smartthinq-sensors

HomeAssistant custom integration for SmartThinQ LG devices configurable with Lovelace User Interface.
Apache License 2.0
1.12k stars 156 forks source link

Add energy and power sensor to track consumptions in HA #555

Open Giuliointhetube opened 1 year ago

Giuliointhetube commented 1 year ago

It can be useful to create energy sensor to track consumptions in the power management dashboard in ha.

kastyr1984 commented 1 year ago

The app includes some energy usage tracking so I'd be surprised if this would be very difficult to integrate.

SiboutVanLoo commented 1 year ago

A device would be handy intel, the AC power is already in there, create a template sensor to convert to kwh and you're good to go. But maybe it's not an AC unit :-)

Spannenberg commented 1 year ago

The sensor is already visible in HA, however it cannot be added to the Energy dashboard dropdown menu. When I click on the link I get the following message:

_You’re configuring a statistic but you couldn’t find your source in the dropdown? That’s caused by a bug in the integration providing the entity. Integrations need to configure their entities correctly so Home Assistant knows that we need to track statistics for it and how.

Open an issue with the author of the integration and link them to https://developers.home-assistant.io/docs/core/entity/sensor#long-term-statistics._

So a modification of the sensor should do the trick. image

Giuliointhetube commented 1 year ago

Not for mine machine. I cannot see any energy sensor for the Washing machine.

kastyr1984 commented 1 year ago

Correct, I also do not have this available for my washer or dryer.

Aekung commented 1 year ago

Confirmed that the energy consumption is not available for the washer and dryer machine.

If I remembered correctly, this sensor used to be included in the washer and dryer machine but it always show as 'unknown' status and never really work as it should. Hope it could be implemented in the integration since it will be very useful with the consumption data.

neoc83 commented 11 months ago

I managed to get an energy consumption sensor by making use of the "Integration - Riemann sum integral helper" https://www.home-assistant.io/integrations/integration/#energy Before, I only had the "Energy current" sensor for my Airco but then managed to get an "Airco_energy (kWh)" sensor which I can use to monitor in the Energy dashboard. image

mazeoft commented 11 months ago

I managed to get an energy consumption sensor by making use of the "Integration - Riemann sum integral helper" https://www.home-assistant.io/integrations/integration/#energy Before, I only had the "Energy current" sensor for my Airco but then managed to get an "Airco_energy (kWh)" sensor which I can use to monitor in the Energy dashboard. image

How can we do that?? where is this Yaml configuration?

ollo69 commented 11 months ago

I managed to get an energy consumption sensor by making use of the "Integration - Riemann sum integral helper" https://www.home-assistant.io/integrations/integration/#energy Before, I only had the "Energy current" sensor for my Airco but then managed to get an "Airco_energy (kWh)"

This is exactly how energy consumption should be calculated in HA. Integration cannon provide calculated data, this must be done by HA using helper.

@mazeoft,

@neoc83 provide also a link to the helper manual, why you just not follow the link?

neoc83 commented 11 months ago

How can we do that?? where is this Yaml configuration?

As ollo69 says: just follow the link I provided.

Here are the steps I took: Go to Settings > Devices & services > Helpers > Create Helper > Integration - Riemann sum integral sensor

Let me know if you need more help.

kastyr1984 commented 11 months ago

@ollo69 There's no energy sensor available for my washer and dryer provided at all, so I can't follow this course to convert to kWh

ollo69 commented 11 months ago

I really see a lot of confusion here. I don't want to make a lesson about the difference between power (measured in W) and Energy (measured in W/h), but just looking to the 2 unit of measure should be clear that power is an instante value while energy is a value measured in the time based on the power. If you have the power, you can use it to calculate the energy in the time. This cannot be done by the integration, because typically it doesn't persist the data and a restart would cause the calculate energy to reset to 0 (and obviously nobody want this). Only few device LG provide instant power, most of them (as washer, dryer, etc) does not, and so nothing can be provided. Do not confuse the energy dashboard provided by LG app with a real power consumption: this are just a calculation based on the program used and do not represent real power, just an very generic estimation. And you can do by yourself with some scripting, because integration provide running program, but just does not make sense. If you want to have the right, real values related to the power and related energy consumed by your device, just buy one of the cheaper plug that provide power consumption compatible with HA (just as example you can buy from meross) and you will have all details about device consumption.

I will never implement inside this integration sensors that are not based on instant data provided by device itself.

kastyr1984 commented 11 months ago

Thanks for the clarification, @ollo69. I had already considered the option of getting a plug that tracks power consumption but was a bit worried putting the load of a high power appliance through a smart plug, but now I'll look into it!

ollo69 commented 11 months ago

Thanks for the clarification, @ollo69. I had already considered the option of getting a plug that tracks power consumption but was a bit worried putting the load of a high power appliance through a smart plug, but now I'll look into it!

Plug normally are 10A or 16A (2.2kW or 3.5kW if voltage is 220V), more than enough to cover the load of 1 device. Obviously I do not suggest to use a single plug to monitor consumption for all the house.

Hadatko commented 11 months ago

So HA is not providing data storage for integration? You cannot even use file to store data?

neoc83 commented 10 months ago

Is it just me or has there been a breaking change on the Riemann sum integral sensor integration? image

bluemantwo commented 8 months ago

I have a new LG refrigerator which shows Whr usage in the IOS app. But I do not see any attributes that show either Watts or Watt Hours in Home Assistant. Either one would be great to know. Can this attribute (either W or WHr) be added?

SiboutVanLoo commented 8 months ago

You can easyly do this using a helper. 😉

Op do 21 dec 2023 22:17 schreef Blueman2 @.***>:

I have a new LG refrigerator which shows Whr usage in the IOS app. But I do not see any attributes that show either Watts or Watt Hours in Home Assistant. Either one would be great to know. Can this attribute (either W or WHr) be added?

— Reply to this email directly, view it on GitHub https://github.com/ollo69/ha-smartthinq-sensors/issues/555#issuecomment-1866940807, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFCKJFML2GYSLUMEVFV253LYKSRQNAVCNFSM6AAAAAAYTIYR7GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRWHE2DAOBQG4 . You are receiving this because you commented.Message ID: @.***>

jonad0521 commented 6 months ago

For the newly added washtower device, I don't see any power-related data, consumption, current, power or otherwise. Is it possible for it to be added?

robertmain commented 6 months ago

You can easyly do this using a helper. 😉 Op do 21 dec 2023 22:17 schreef Blueman2 @.>: I have a new LG refrigerator which shows Whr usage in the IOS app. But I do not see any attributes that show either Watts or Watt Hours in Home Assistant. Either one would be great to know. Can this attribute (either W or WHr) be added? — Reply to this email directly, view it on GitHub <#555 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFCKJFML2GYSLUMEVFV253LYKSRQNAVCNFSM6AAAAAAYTIYR7GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRWHE2DAOBQG4 . You are receiving this because you commented.Message ID: @.>

No. You can't If the field isn't provided by the integration there's no way to calculate it using a helper.

robertmain commented 6 months ago

Like many others here - I have an LG washer which captures energy usage data (as seen in the mobile app) but I don't see it in HomeAssistant. Is there any way to pull this in from the API?

image

wesgeorge commented 5 months ago

Seems like we have 2 problems here, and it might be useful to track them as separate items - Some devices already expose the energy usage sensor in HA, and thus the riemann helper will allow for building an entity that can be added as an energy device for individual device consumption reporting. Some devices (such as my refrigerator) have the energy usage info in the app, so it's definitely being tracked and is available somewhere in the API, but do not expose it as a sensor currently via the HA integration, meaning there's no device to use with the integral helper. So the feature request is to integrate the rest of the devices energy usage into the HA integration.

aredon commented 5 months ago

Seems like we have 2 problems here, and it might be useful to track them as separate items - Some devices already expose the energy usage sensor in HA, and thus the riemann helper will allow for building an entity that can be added as an energy device for individual device consumption reporting. Some devices (such as my refrigerator) have the energy usage info in the app, so it's definitely being tracked and is available somewhere in the API, but do not expose it as a sensor currently via the HA integration, meaning there's no device to use with the integral helper. So the feature request is to integrate the rest of the devices energy usage into the HA integration.

Do we have a thread open for the second issue yet? I just got a dryer and would love to be able to bring in the energy info.

oerix commented 4 months ago

+1, would be nice to get some sort of energy sensor implemented

mjsuhonos commented 3 months ago

Some devices (such as my refrigerator) have the energy usage info in the app, so it's definitely being tracked and is available somewhere in the API, but do not expose it as a sensor currently via the HA integration, meaning there's no device to use with the integral helper.

According to the ThinQ API documentation, energy usage is not made available. I have both a washer and dryer which track energy use, but neither API device profile contains this information.

LG is obviously pulling it into their (rather awful) app somehow, but they don't seem to want to share that data with developers. Moreover, the app only shows energy use for my dyer as eg "★☆☆☆☆", not even Watts or Wh.

Unfortunately, although developers can sign up for an LG account, they only offer support to B2B partners, with some rather restrictive stipulations:

ThinQ.Cloud Partnership means a license agreement for use of the ThinQ.Cloud API. Currently, even if you are a partner of LG Electronics, if you have not signed a license agreement for the use of ThinQ.Cloud API, you must proceed with this partnership separately to use ThinQ.Cloud API.

ThinQ.Cloud Partnership is for B2B partners. A partnership request must be submitted through a company email account. A request submitted through a personal email account cannot be processed.

We decide on ThinQ.Cloud Partnership by considering the partner's service content and LG Electronics' business direction. The partnership may not be granted in the following cases:

  • When the requester is a personal developer
  • When the services offered do not align with LG Electronics’ business directions
  • When the information provided is false, etc.
Daniel15 commented 3 months ago

LG is obviously pulling it into their (rather awful) app somehow

If I get some free time, I'm going to try use an MitM proxy and figure out the API endpoint the app is hitting to load this data.