atxbyea / samsungrac

Home Assistant Climate Device for controlling (not only) Samsung AC
62 stars 19 forks source link

Feature Request: Comprehensive Statistics for Energy Generation, Consumption, and Compressor Activity #100

Open petriceko opened 4 months ago

petriceko commented 4 months ago

I would like to request a new feature that provides comprehensive statistics related to energy generation, consumption, and compressor activity. This feature would be extremely valuable for monitoring and optimizing system performance. Specifically, the statistics I am interested in include:

Energy Generation:
    Total kWh generated per day, week, month, and year.
    Real-time monitoring of energy generation.
    Historical data and trends for energy generation.

Energy Consumption:
    Total kWh consumed per day, week, month, and year.
    Real-time monitoring of energy consumption.
    Historical data and trends for energy consumption.

Compressor Activity:
    Number of times the compressor is started and stopped per hour.
    Detailed logs of each compressor start and stop event.
    Historical data and trends for compressor activity.

Purpose: Having access to these statistics would help in:

Analyzing the efficiency of energy generation and consumption.
Identifying patterns and trends in energy usage.
Optimizing the operation of the compressor to reduce wear and improve efficiency.
Making data-driven decisions for system improvements and maintenance.

Importance of Compressor Statistics: Monitoring the compressor's start and stop frequency is crucial because running the compressor more than five times per hour can lead to increased wear and tear, reducing its lifespan and efficiency. By tracking and analyzing this data, we can ensure the compressor operates within optimal parameters, preventing premature failures and maintaining system reliability.

Proposed Implementation:

Dashboard View: Create a user-friendly dashboard that displays these statistics in real-time, along with historical data and trends.
Data Logging: Implement data logging for energy generation, consumption, and compressor activity.
Alerts and Notifications: Optionally, add the ability to set up alerts for specific conditions (e.g., unusual increase in energy consumption or compressor activity).

Additional Context: If there are any existing features or modules related to this request, please let me know how I can access them. Otherwise, I am looking forward to seeing this feature added to enhance the monitoring capabilities of our system.

Heat pump: Samsung EHS Mono

keyluke commented 1 month ago

Would also be interested in such feature, or at least reading the daily energy consumption available through Smartthings app. AC using old REST API.

ColinSainsbury commented 1 month ago

I use this in rest.yaml to gather the data

The data is in Wh so I then have a template sensor to divide it by 1000 so that I can add it as a device in my Energy dashboard

Here is the template element {{ (states( 'sensor.ashp_daily_energy') | float / 1000) | round(1) }}

I used the same approach to retrieve the energy consumed by my Samsung HP Tumble Dryer instead of using the SmartThings integration which I felt was becoming flaky. Hope this helps.

keyluke commented 1 month ago

Thanks for your suggestion @ColinSainsbury! Just a question: I cannot find the rest.yaml file; is it a new file you are adding to this custom component? Also, are you connecting using your smart things credentials? Because I have an AC that I am contacting using the local rest API (port 8888)

ColinSainsbury commented 1 month ago

I followed these instructions https://github.com/home-assistant/core/issues/101265#issuecomment-2112170271 for an alternative way to acquire the data via the REST API. I then added the code block below to the rest.yaml to pull in the energy data and divided by 1,000 as I said.

- name: ASHP Daily Energy 
  unique_id: "ashp_daily_energy" 
  state_class: "total" 
  device_class: "energy" 
  unit_of_measurement: "Wh" 
  value_template: "{{ value_json.components.main.powerConsumptionReport.powerConsumption.value.energy }}" 
keyluke commented 1 month ago

Thank you @ColinSainsbury for pointing out that comment! Unfortunately I discovered that my Samsung AC does not expose energy consumption via SmartThings API, but only via SmartThings app on mobile device.

ColinSainsbury commented 1 month ago

Have you tried going to https://my.smartthings.com/advanced/devices and clicking on the device? You should see Device Id listed and you can then explore the data that you can pull via the REST API. HTH

keyluke commented 1 month ago

Yes, unfortunately no power consumption related attributes are exposed. It seems to be an exclusive feature for SmartThings App. I wrote on SmartThings community forum. Let's see if there is a way to expose the power consumption. Thanks again for your support @ColinSainsbury !

Beormund commented 2 days ago

I followed these instructions home-assistant/core#101265 (comment) for an alternative way to acquire the data via the REST API.

@ColinSainsbury which approach do you prefer - hass-template-climate or this integration?