Giter Club home page Giter Club logo

Comments (6)

brettonw avatar brettonw commented on June 18, 2024

If you are a sophisticated user, you can add it through HA.

I use the packages feature, so in my configuration.yaml I have:

...
scene: !include scenes.yaml

# include files from the packages directory
homeassistant:
  packages: !include_dir_named packages

In my packages, I have a file called aquarium.yaml, and I put a sumation sensor in there. I think HA has added a helper you can use to do this since I did it, so maybe there's an easier way. Anyway, here's what mine looks like:

template:
  sensor:
    - name: "Aquarium Power"
      unique_id: "aquarium_power_w"
      unit_of_measurement: "W"
      device_class: "power"
      state: >
        {% set w1 = (states('sensor.apex_light1_2_1w') | float) %}
        {% set w2 = (states('sensor.apex_light2_2_2w') | float) %}
        {% set w3 = (states('sensor.apex_retpump_2_3w') | float) %}
        {% set w4 = (states('sensor.apex_reflight_2_4w') | float) %}
        {% set w5 = (states('sensor.apex_skimmer_2_5w') | float) %}
        {% set w6 = (states('sensor.apex_dos_2_6w') | float) %}
        {% set w7 = (states('sensor.apex_heater_2_7w') | float) %}
        {% set w8 = (states('sensor.apex_pwrhead_2_8w') | float) %}
        {{ w1 + w2 + w3 + w4 + w5 + w6 + w7 + w8 }}

On the dashboard, under Settings->Devices&Services->Helpers, I clicked "+ Create Helper", and chose "Integration - Riemann sum integral sensor":

Screenshot 2022-12-29 at 12 57 32 PM

I named mine sensor.aquarium_kwh (friendly name: Aquarium kWh). Choose the "Left Riemann sum" option. The trapezoid rule will give an average number between readings which will be wrong if your reporting period is large. I also check the "K" prefix option, but that's up to you.

Screenshot 2022-12-29 at 12 59 00 PM

Then you can add that sensor directly to the energy dashboard as an individual device. From the dashboard home, Settings->Dashboards->Energy, then add an Individual Device:

Screenshot 2022-12-29 at 1 06 56 PM

Once the Energy dashboard starts collecting, it will show under the Monitor Individual Devices section of the Energy tab:

Screenshot 2022-12-29 at 1 08 31 PM

I also created another helper from it, called the Aquarium Utility Meter, which will give you exactly that daily report with a pretty graph I think you want...

Screenshot 2022-12-29 at 1 03 30 PM

from apex-ha.

brettonw avatar brettonw commented on June 18, 2024

Indeed, there is now a HA Helper for summing the states of individual sensors, so you can do this without coding at all:

https://www.home-assistant.io/integrations/min_max/

Screenshot 2022-12-29 at 1 15 24 PM

from apex-ha.

rwoldberg avatar rwoldberg commented on June 18, 2024

Thanks, I'll take a look at doing this.

from apex-ha.

rwoldberg avatar rwoldberg commented on June 18, 2024

That works nicely. However, there is one issue, and I am not sure what component is responsible. If the wattage does not change for a plug on the apex, i.e. something is always on, the helper entity remains in an unknown state. If all of the outputs are aggregated together this is probably not an issue, but adding them individually it is. Again, I am not sure if this is in your component or the helper component.

from apex-ha.

brettonw avatar brettonw commented on June 18, 2024

If you're using the Helper to sum the wattages, I can't help because I haven't done that, but it's not surprising that there's an error like that in an edge case. I think the problem you are running into is a HA situation where they just don't record an input if a new value is the same as the last one. They don't seem to comprehend that an updated steady state is useful information. Can you toggle the switch outlet to force it to pick up data?

from apex-ha.

rwoldberg avatar rwoldberg commented on June 18, 2024

I suspect you are correct this is a HA issue. That is exactly what I had to do, toggle the outputs off/on then they showed up. Thanks for all the work you have put in to this.

from apex-ha.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.