Home Assistant Energy Integration

Hi, 

I am trying to integrate to the the new "Energy" component of Home Assistant but cannot find the sensor created/generated by my two IAMMETER meters for the grid import/export

The Home Assistant page says I should point you in the direction fo this page to update the way the sensors are created

https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics

Is this something on the road map to update the Home Assistant component

Thread Status
65
4805
15
22
4

Sort replies by:

Can someone please update this with a simple how to that currently works? Like from start to finish? There's a lot of information flying about and none of them seems to work for me. There's a chance I am doing something dated or have mixed different approaches. So can we have a single source of truth for this (and everything iammeter related to be honest, everything seems all over the place)

Yes you can use Net Metering via modbustcp

Ah. It can be done via the more general Modbus integration rather than the IAMMETER integration.

Ah. It can be done via the more general Modbus integration rather than the IAMMETER integration.

How can we get the net metered total import/export energy for the WEM3080T within Home Assistant? Documentation only describes the per-phase data...

How can we get the net metered total import/export energy for the WEM3080T within Home Assistant? Documentation only describes the per-phase data...

Each has its own advantages, the official is more formal, the integration difficulty is lowercase, and github and hacs are more flexible. For familiar players, they prefer to DIY by themselves, so that they can have more free play, so I will review it now. In terms of speed, the official integration lags a lot.

Just reading back over all this and wondering if setting up a github and HACS integration would be better than relying on the integration being directly added into Home Assistant

Sorry, I had missed your feedback before.
Most of this disconnection problem is caused by the bad signal strength.
But if this device is always stable and just occur disconnection recently, we need to analyze what is different recently firstly.
Weather(environment temperature)? the router position or something else?
Please also let me know when the upload stop,
1 Is the led of wifi on the front panel still on? If so ,whether the local IP of the device is still visitable.
2 if the SSID of iMeter_sn appears around? if so, can it still be connected and visit the 11.11.11.1 ?

I've got it down to -59 to -64 with an external antenna. I'll see if that improves it.

I've got it down to -59 to -64 with an external antenna. I'll see if that improves it.

It's still dropping off the network, even with Wifi at -65 to -68. I'm going to try a different antenna, mounted outside the electricity box.

I've got the wifi to mid 60s by moving the antennas, will see if that helps.

Wifi strength from the device's scan page is -73 / -74... But this has not been an issue generally, just the last few days it's been up and down.

I'm having strange dropouts from an Iammeter single phase device:In Home Assistant, the Iammeter importenergy sensor:And the filtered sensor, working as intended to mask any issues:But this should not be dropping out like this. It's right next to an Iammeter 3 phase, which does not appear to be dropping like this.And here is a snapshot from iammeter.com tables:Note the huge gap - 7:52am then nothing until 10:29am... It's tracking, as the kWh went up by 1.36, but not reporting.Suggestions?

I'm having strange dropouts from an Iammeter single phase device:

In Home Assistant, the Iammeter importenergy sensor:



And the filtered sensor, working as intended to mask any issues:

But this should not be dropping out like this. It's right next to an Iammeter 3 phase, which does not appear to be dropping like this.

And here is a snapshot from iammeter.com tables:


Note the huge gap - 7:52am then nothing until 10:29am... It's tracking, as the kWh went up by 1.36, but not reporting.

Suggestions?

where do I add customize_glob?


since HA 2021.09add the following code in configuration.yaml:homeassistant:  customize_glob:    sensor.*_importenergy*:      last_reset: '1970-01-01T00:00:00+00:00'      device_class: DEVICE_CLASS_ENERGY      state_class: total_increasing    sensor.*_exportgrid*:      last_reset: '1970-01-01T00:00:00+00:00'      device_class: DEVICE_CLASS_ENERGY      state_class: total_increasing

Thanks - I am sure I read somewhere (can't find it just now) that total_increasing has a tolerance threshold for slight reductions, so I am running with this methodology to define sensors for my Iammeter inputs, which I then use in my own custom Energy Dashboard (not the Home Assistant one)


  - sensor:
     - name: "Grid consumption energy (general tariff)"
        unit_of_measurement: 'kWh'
        device_class: energy
        state_class: total_increasing
        state: >-
           {% if states('sensor.iammeter1_importenergy') in ['unavailable', 'unknown', 'none', 0] %}
              {{
                  states('sensor.grid_consumption_energy_general_tariff')|float
              }}
           {% elif states('sensor.iammeter1_importenergy')|float < (states('sensor.grid_consumption_energy_general_tariff')|float * 98/100) %}
              {{
                 states('sensor.grid_consumption_energy_general_tariff')|float
              }}
          {% else %}
             {{
                states('sensor.iammeter1_importenergy')|float
             }}
          {% endif %}

Your method is getting better and better. Of course, adding a tolerance value is also a good method. Thank you for sharing so that we have more ways to solve this problem.

The HomeAssistant updates this last week have resulted in an issue when my HA reboots - the template sensors sample a non-zero value on the total_increasing iammeter values on the way up/down, resulting in the Utility Meters resetting (adding) the previous total value.I've made the following tweak to my config, and will see how it goes (I've added the ELIF < current value section)  - sensor:      - name: "Grid consumption energy (general tariff)"       

The HomeAssistant updates this last week have resulted in an issue when my HA reboots - the template sensors sample a non-zero value on the total_increasing iammeter values on the way up/down, resulting in the Utility Meters resetting (adding) the previous total value.

I've made the following tweak to my config, and will see how it goes (I've added the ELIF < current value section)


  - sensor:
      - name: "Grid consumption energy (general tariff)"
        unit_of_measurement: 'kWh'
        device_class: energy
        state_class: total_increasing
        state: >-
           {% if states('sensor.iammeter1_importenergy') in ['unavailable', 'unknown', 'none', 0] %}
              {{
                  states('sensor.grid_consumption_energy_general_tariff')|float
              }}
           {% elif states('sensor.iammeter1_importenergy')|float < states('sensor.grid_consumption_energy_general_tariff')|float %}
              {{
                  states('sensor.grid_consumption_energy_general_tariff')|float
              }}
           {% else %}
              {{
                  states('sensor.iammeter1_importenergy')|float
              }}
          {% endif %}


Only other thing I am thinking is whether I need to build in a small amount of +/-, i.e. make it "less than current value * 98%" or similar to give it some room to vary slightly with tolerances.

This is very good, we are also actively communicating the method of passing pr, hope hass can pass pr as soon as possible

This is very good, we are also actively communicating the method of passing pr, hope hass can pass pr as soon as possible

I found a useful tip on the HA github for utility_meters relying on sensors that sometimes go unavailable, and have edited the sensors as follows:  - sensor:      - name: "Grid consumption energy (general tariff)"         unit_of_measurement: 'kWh'         device_class: energy         state_class: total_increasing         state: >-            {%

...and with those sensor definitions behind the utility_meters, today for the first time all of the utility meters read EXACTLY the same as Energy Dashboard.

I found a useful tip on the HA github for utility_meters relying on sensors that sometimes go unavailable, and have edited the sensors as follows:

  - sensor:
      - name: "Grid consumption energy (general tariff)"
         unit_of_measurement: 'kWh'
         device_class: energy
         state_class: total_increasing
         state: >-
            {% if states('sensor.iammeter1_importenergy') in ['unavailable', 'unknown', 'none', 0] %}
               {{
                   states('sensor.grid_consumption_energy_general_tariff')|float
               }}
                  {% else %}
               {{
                  states('sensor.iammeter1_importenergy')|float
               }}
            {% endif %}

I like this because it catches all of the things the iammeter sensor should never be: unavailable, unknown, none or 0... and if that is the case, it just uses the existing value. I'll see how this goes.

Here is an example of what I mean about inaccurate readings.



I tracked the Iammeter sensors over 24h, and they match almost 100% with what Energy Dashboard shows. But the utility_meters have a small variation - in the example above it's 3% under.

The config for those is:

  - sensor:
       - name: "Grid consumption energy (general tariff)"
          unit_of_measurement: 'kWh'
          device_class: energy
          state_class: total
          state: >-
             {{
                states('sensor.iammeter1_importenergy')|float
             }}
          availability: >-
             {{
                is_number(states('sensor.iammeter1_importenergy'))
             }}

...and its utility_meter:

grid_consumption_general_energy_daily:
      source: sensor.grid_consumption_energy_general_tariff
      cycle: daily

For some reason it is under-recording.

Yep... using "availability:" checks to see if the source entity is available (i.e. it's a number, but which could include zero) before publishing the sensor:

availability: >-
          {{
             is_number(states('sensor.iammeter1_importenergy'))
          }}

Your check tests to see if it is available AND greater than zero:

value_template: >
{% if states('sensor.wem3080t_exportgrid_c') | int > 0 %}
{{ states('sensor.wem3080t_exportgrid_c') }}
{% endif %}

In the new sensor format, your one could be written:

- sensor:
     - name: "Grid consumption energy (general tariff)"
        unit_of_measurement: 'kWh'
        device_class: energy
        state_class: total
        state: >-
           {% if states('sensor.iammeter1_importenergy') | int > 0 %}
             {{
                states('sensor.iammeter1_importenergy') | float
             }}
           {% endif %}

Both accomplish the same thing I think... I'll test to see. 

What I am finding is that the utility_meter approach is resulting in slightly incorrect readings, mainly on the imported energy one... where the Energy Dashboard is spot on. I'm going to test and see if the different availability tests change that.



there is a solution, by changing the configuration of homeassistant to shield the situation that the power suddenly becomes 0:

sensor:
- platform: template
sensors:
newname_importenergy_a:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_importenergy_a') | int > 0 %}
{{ states('sensor.wem3080t_importenergy_a') }}
{% endif %}
newname_exportgrid_a:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_exportgrid_a') | int > 0 %}
{{ states('sensor.wem3080t_exportgrid_a') }}
{% endif %}
newname_importenergy_b:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_importenergy_b') | int > 0 %}
{{ states('sensor.wem3080t_importenergy_b') }}
{% endif %}
newname_exportgrid_b:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_exportgrid_b') | int > 0 %}
{{ states('sensor.wem3080t_exportgrid_b') }}
{% endif %}
newname_importenergy_c:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_importenergy_c') | int > 0 %}
{{ states('sensor.wem3080t_importenergy_c') }}
{% endif %}
newname_exportgrid_c:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_exportgrid_c') | int > 0 %}
{{ states('sensor.wem3080t_exportgrid_c') }}
{% endif %}

Hi folks, update on my Home Assistant integration efforts. Note as this site does not have a code plain text view, any YAML is not properly indented.

First learning - customize_glob wildcard problems

For me, using the suggested customize_glob with wildcards for the sensors (e.g. sensor.*_importenergy*) caused problems with statistics.

The resultant entities were usable in Energy Dashboard, and everything looked OK at first. But when I added a cost to the entity in Energy Dashboard config it created an entity which also was 'caught' by the customize_glob - so for sensor.iammeter1_importenergy entity, I then got  sensor.iammeter1_importenergy_cost. The customize_glob "sensor.*_importenergy*" then forced sensor.iammeter1_importenergy_cost to have "device_class: energy" and "state_class: total_increasing". As it had a unit of AUD, this failed to work, and recorder did not accumulate statistics for the cost entities. This was visible as an error in Developer Tools / Statistics.

So I changed to specify each sensor in full, not with a glob:

customize:
sensor.iammeter3_importenergy_c:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing
sensor.iammeter3_importenergy_b:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing
sensor.iammeter3_importenergy_a:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing
sensor.iammeter1_importenergy:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing
sensor.iammeter1_exportgrid:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing

Once I had done that, the financial entities were no longer being forced to incorrect classes, and recorder accepted them for stats, and the $ worked. 

Second learning - adding power entities for recorder/statistics

I wanted to track power produced/imported. So I added the following to the customize: section:

sensor.iammeter1_power:
device_class: power
state_class: measurement
sensor.iammeter3_power_a:
device_class: power
state_class: measurement
sensor.iammeter3_power_b:
device_class: power
state_class: measurement

Once I did that, recorder accepted these entities for proper historical statistics, meaning I can now track max, min, mean etc. for power. Note that state_class measurement do not have last_reset.

Third learning - setting up for non-Dashboard power/energy tracking

Home Assistant Energy Management does not yet track power... and I wanted to recreate the views available from the iammeter website. Using the instructions at https://community.home-assistant.io/t/monitor-your-solar-pv-system-in-home-assistant-energy-dashboard-vs-energy-management/342710 I set up all of the entities (sensors and utility_meters) to use the Apex Chart integration. Initially these were as recommended in that tutorial, e.g.:

- platform: template 
     sensors:
        grid_consumption_energy:
           unit_of_measurement: 'kWh'
           value_template: "{{ states('sensor.solar_importenergy_b') }}"

...however I ran into problems. For statistics to work nicely you need to set device_class and state_class. Using the newer sensor format, I then got this:

template:
   - sensor:
      - name: "Grid consumption energy (general tariff)"
         unit_of_measurement: 'kWh'
         device_class: energy
         state_class: total
         state: {{ states('sensor.iammeter1_importenergy')|float }}

That appeared to be working OK, but... :) noooo...

Every so often the Iammeter's go 'offline' for a few seconds. When they did, the utility_meters would see a zero value. Utility_meters based on entities with a state_class of total or total_increasing see a zero value as an instruction to reset to what the underlying sensor says. It is so if you replace the meter, it picks up what the new base value is. Problem is, that these resets to zero were causing the utility_meters to pick up the non-zero value of the Iammeter. In one instance I had 4 glitches in a couple of minutes which saw my utility_meter go from a couple of kWh to 1,100kWh in about 30 seconds. 

So you need to add an availability check. This means the sensor goes to "unavailable" instead of zero, and prevents the resets. 

What I ended up with, laid out for readability:

  - sensor:
     - name: "Grid consumption energy (general tariff)"
        unit_of_measurement: 'kWh'
        device_class: energy
        state_class: total
        state: >-
           {{
              states('sensor.iammeter1_importenergy')|float
           }}
        unique_id: 2452716747549
        availability: >-
          {{
             is_number(states('sensor.iammeter1_importenergy'))
          }}

That was all yesterday... and I now have it working properly, although I had to make an adjustment this morning, so the maths are not exactly correct on this screenshot:

in fact, we have always tried to upgrade our HA integration since 2020,we also want to support the new features of home assistant , such as energy management.
But it is very difficult for us to merge any new code in HA now.
The PR can never get any response for more than half a year.
like this
https://github.com/home-assistant/core/pull/49735
we are still waiting for the reviewer of HA will come back in one day. 

I'm running latest version.Specifying the customize_glob to be exactly per sensors makes it work: e.g. sensor.iammeter3_importenergy_c. leaving with the wildcard afterwards is applying the "device_class: energy" to all entities which match the wildcard... which includes the cost / consumption ones created by HA when I add cost to the energy source. Your setup may be different, but this *will* catch some people - suggest you place a caveat on the definition, or change it so it does not catch them

I'm running latest version.

Specifying the customize_glob to be exactly per sensors makes it work: e.g. sensor.iammeter3_importenergy_c. leaving with the wildcard afterwards is applying the "device_class: energy" to all entities which match the wildcard... which includes the cost / consumption ones created by HA when I add cost to the energy source. Your setup may be different, but this *will* catch some people - suggest you place a caveat on the definition, or change it so it does not catch them.


Try upgrading to the latest version? I found no problems here.

I've had to specify without wildcards, as the wildcards catch the cost/compensation entities created by HA.

No $ values yet, but the recorder/statistics errors have disappeared, so I'm assuming this is a step in the right direction at least.

customize_glob:
sensor.iammeter3_importenergy_c:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing
sensor.iammeter3_importenergy_b:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing
sensor.iammeter3_importenergy_a:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing
sensor.iammeter1_importenergy:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing
sensor.iammeter1_exportgrid:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing

I can integrate the sensors into HA Energy Dashboard OK, see below. That is using the "customize_glob:    sensor.*_importenergy*" notes above from miwyf:customize_glob:    sensor.*_importenergy*:      last_reset: '1970-01-01T00:00:00+00:00'      device_class: energy      state_class: total_increasing    sensor.*_exportgrid*:      last_reset: '1970-01-01T00:00:00+00:00'      device_class: energy      state_class: total_increasingThat works well:But as soon as I try and assign

I can integrate the sensors into HA Energy Dashboard OK, see below. That is using the "customize_glob:    sensor.*_importenergy*" notes above from miwyf:

customize_glob:

sensor.*_importenergy*:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing
sensor.*_exportgrid*:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing

That works well:



But as soon as I try and assign a cost to the sources:



HA recorder notes errors and fails to track them:

2022-01-08 11:45:10 WARNING (Recorder) [homeassistant.components.sensor.recorder] sensor.iammeter3_importenergy_a_cost has unit AUD which is unsupported for device_class energy


So the balances always stay at $0.00.


Is anyone tracking costs in HA, and how are they assigning costs/kWh?

Thank you very much. Now it looks good!

You can use the following configuration, the new version of homeassistant seems to have been changed,homeassistant:  customize_glob:    sensor.*_importenergy*:      last_reset: '1970-01-01T00:00:00+00:00'      device_class: energy      state_class: total_increasing    sensor.*_exportgrid*:      last_reset: '1970-01-01T00:00:00+00:00'      device_class: energy      state_class: total_increasing


You can use the following configuration, the new version of homeassistant seems to have been changed,

homeassistant:
customize_glob:
sensor.*_importenergy*:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing
sensor.*_exportgrid*:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
state_class: total_increasing

Hello.I have wem3080t with Home Assistant 2021.11.4.In my config I have:homeassistant:  customize_glob:    sensor.*_importenergy*:      last_reset: '1970-01-01T00:00:00+00:00'      device_class: DEVICE_CLASS_ENERGY      state_class: total_increasing    sensor.*_exportgrid*:      last_reset: '1970-01-01T00:00:00+00:00'      device_class: DEVICE_CLASS_ENERGY      state_class: total_increasing  sensor:  - platform: iammeter    host: 192.168.1.50    name: meterBut, when I try to add to the energy ta

Hello.


I have wem3080t with Home Assistant 2021.11.4.


In my config I have:

homeassistant:
customize_glob:
sensor.*_importenergy*:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: DEVICE_CLASS_ENERGY

state_class: total_increasing

sensor.*_exportgrid*:
last_reset: '1970-01-01T00:00:00+00:00'
device_class: DEVICE_CLASS_ENERGY

state_class: total_increasing


sensor:
- platform: iammeter
host: 192.168.1.50
name: meter




But, when I try to add to the energy tab there is no source on the list :( . Of course the entity list is fine, ant I can find the meter, so it is working, but can't add to the energy tab...


I missed something?


Thanks

It may be stored in config/.storage/core.restore_state
Or in the statistics* data table of the mysql database
I'm not sure

Thanks Miwifi,

 It works fine! Do you know how I can remove data errors? Thank you

The reason for the sudden increase of homeassistant statistics should be that the homeassistant may get 0 when the meter is started. If your meter has an older firmware version, you can upgrade to the latest firmware. This problem has been resolved in the new firmware (For WEM3080 series , only the firmware version of 1.70.x and later can be upgraded to this version. Please do not upgrade your firmware if the version is earlier than 1.70.1.), firmware address and upgrade notes: https://imet

Thank you, I updated it, I am waiting for the results

The reason for the sudden increase of homeassistant statistics should be that the homeassistant may get 0 when the meter is started. If your meter has an older firmware version, you can upgrade to the latest firmware. This problem has been resolved in the new firmware (For WEM3080 series , only the firmware version of 1.70.x and later can be upgraded to this version. Please do not upgrade your firmware if the version is earlier than 1.70.1.), firmware address and upgrade notes: https://imet

The reason for the sudden increase of homeassistant statistics should be that the homeassistant may get 0 when the meter is started. If your meter has an older firmware version, you can upgrade to the latest firmware. This problem has been resolved in the new firmware (For WEM3080 series , only the firmware version of 1.70.x and later can be upgraded to this version. Please do not upgrade your firmware if the version is earlier than 1.70.1.), firmware address and upgrade notes: https://imeter.club /topic/11
If your meter's firmware version is less than 1.70.1, of course, there is a solution, by changing the configuration of homeassistant to shield the situation that the power suddenly becomes 0:

sensor:
- platform: template
sensors:
newname_importenergy_a:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_importenergy_a') | int > 0 %}
{{ states('sensor.wem3080t_importenergy_a') }}
{% endif %}
newname_exportgrid_a:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_exportgrid_a') | int > 0 %}
{{ states('sensor.wem3080t_exportgrid_a') }}
{% endif %}
newname_importenergy_b:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_importenergy_b') | int > 0 %}
{{ states('sensor.wem3080t_importenergy_b') }}
{% endif %}
newname_exportgrid_b:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_exportgrid_b') | int > 0 %}
{{ states('sensor.wem3080t_exportgrid_b') }}
{% endif %}
newname_importenergy_c:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_importenergy_c') | int > 0 %}
{{ states('sensor.wem3080t_importenergy_c') }}
{% endif %}
newname_exportgrid_c:
unit_of_measurement: 'kWh'
value_template: >
{% if states('sensor.wem3080t_exportgrid_c') | int > 0 %}
{{ states('sensor.wem3080t_exportgrid_c') }}
{% endif %}

Hello everyoneI have a problem with my data, Some day I have completely crazy values, do you know where this could come from?Thank you

Hello everyone


I have a problem with my data, Some day I have completely crazy values, do you know where this could come from?
Thank you

Hi Ben:

Of course, my colleague had already found the solution, please refer to this above post.


"When we find the method ,we will post it here."Hello,is there any news about this? Any official implementation of IAMMETER products for the new "Energy" section in Home Assistant?It's weird that Home Assistant makes it hard to update your integration: if there is something the community can do, let us know.Regards,Ben

"When we find the method ,we will post it here."


Hello,


is there any news about this? Any official implementation of IAMMETER products for the new "Energy" section in Home Assistant?

It's weird that Home Assistant makes it hard to update your integration: if there is something the community can do, let us know.


Regards,

Ben

We do not know when we can merge our integration successful to HA, before that we will try to find a compromised method to use IAMMETER product in the energy component of HA.When we find the method ,we will post it here.

since HA 2021.09

add the following code in configuration.yaml:

homeassistant:

  customize_glob:
    sensor.*_importenergy*:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: DEVICE_CLASS_ENERGY

      state_class: total_increasing

    sensor.*_exportgrid*:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: DEVICE_CLASS_ENERGY

      state_class: total_increasing

hello

since HA 2020.09

the data modification no longer works

i tried to remplace measurement by total_increasing  but inconclusive

Hello
apparently no longer works on version 2021.9

state_class must be put: total_increasing


at least since I made the change I no longer have the error message

homeassistant:

  customize_glob:
    sensor.*_importenergy*:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: energy
      state_class: measurement
    sensor.*_exportgrid*:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: energy
      state_class: measurement

If using 3 phase, this needs an extra asterisk before it will appear as a Home Assistant energy source - sensor.*_importenergy*:

Yes, we indeed want to upgrade our integration either.
But as I said in above thread, it is very difficult to merge new integration code in HA from the last year (there will be not any feedback after the first reviewer any more), we also do not know how do do now.


Like this https://github.com/home-assistant/core/pull/49735

I suspect there will be a whole heap of updating to be done on this integration from those coding at/for HA.  As an example, there's currently no elegant way to incorporate a battery into that integration.  When I've tried it just subtracts or adds the battery flow from solar or grid energy flow.  Ie at night time, when the powerwall is supplying the house with power, HA calls that a grid import or solar goes negative.  The energy flow has to show somewhere and currently ther

If using 3 phase, this needs an extra asterisk before it will appear as a Home Assistant energy source - sensor.*_importenergy*:

I have now found a more convenient way to add the following code in configuration.yaml:homeassistant:  customize_glob:    sensor.*_importenergy:      last_reset: '1970-01-01T00:00:00+00:00'      device_class: energy      state_class: measurement        sensor.*_exportgrid:      last_reset: '1970-01-01T00:00:00+00:00'      device_class: energy      state_class: measurement 

I suspect there will be a whole heap of updating to be done on this integration from those coding at/for HA.  As an example, there's currently no elegant way to incorporate a battery into that integration.  When I've tried it just subtracts or adds the battery flow from solar or grid energy flow.  Ie at night time, when the powerwall is supplying the house with power, HA calls that a grid import or solar goes negative.  The energy flow has to show somewhere and currently there's no battery option.


Please only add sensor.*_importenergy and sensor.*_exportgrid, if you want to add these voltage, current, power, frequency, pf, please refer to https://developers.home-assistant.io/docs/core/entity/sensor/#long -term-statistics Modify device classes,for example:

homeassistant:
  customize_glob:
    sensor.*_power_*:
      last_reset: '1970-01-01T00:00:00+00:00'
      device_class: power
      state_class: measurement

Looks like you are new here. Register for free, learn and contribute.