hass_nibe icon indicating copy to clipboard operation
hass_nibe copied to clipboard

Feature request: Support energy monitoring features of home assistant 2021.8

Open kvisle opened this issue 2 years ago • 41 comments

In the as I'm writing latest Home Assistant-release, there's an energy dashboard (https://www.home-assistant.io/blog/2021/08/04/home-energy-management/).

It would be nice if relevant sensors could be added as individual devices.

kvisle avatar Aug 04 '21 22:08 kvisle

I've marked them as the correct state class. But i think one may need to set a device class too.

elupus avatar Aug 04 '21 22:08 elupus

I currently use this workaround to get what I want from this:

  • Be able to use this with the energy thing
  • Separate sensors for compressor and addition
    • Caveat: Due to sensors being updated at different times, the template sensor that does the math can briefly increase and decrease at times. I haven't seen any real problems from this behavior, but I find the different sensors useful - and it could probably be done better by the integration.
template:
  sensor:
    - name: Nibe, heating compressor
      state: >
        {{ states('sensor.nibe_110549_44308') | float }}
      device_class: energy
      state_class: measurement
      unit_of_measurement: kWh
      attributes:
        last_reset: "2020-01-01T08:00:00+00:00"
    - name: Nibe, heating adding
      state: >
        {{ states('sensor.nibe_110549_44300') | float - states('sensor.nibe_110549_44308') | float }}
      device_class: energy
      state_class: measurement
      unit_of_measurement: kWh
      attributes:
        last_reset: "2020-01-01T08:00:00+00:00"
    - name: Hotwater, compressor
      state: >
        {{ states('sensor.nibe_110549_44306') | float }}
      device_class: energy
      state_class: measurement
      unit_of_measurement: kWh
      attributes:
        last_reset: "2020-01-01T08:00:00+00:00"
    - name: Hotwater, adding
      state: >
        {{ states('sensor.nibe_110549_44298') | float - states('sensor.nibe_110549_44306') | float }}
      device_class: energy
      state_class: measurement
      unit_of_measurement: kWh
      attributes:
        last_reset: "2020-01-01T08:00:00+00:00"

kvisle avatar Aug 15 '21 20:08 kvisle

Why not just set those things using customize on the sensors?

elupus avatar Aug 15 '21 23:08 elupus

Hm, can one set the entity-attributes that way? The last_reset-attribute seems to be important.

kvisle avatar Aug 16 '21 06:08 kvisle

Yes

elupus avatar Aug 16 '21 08:08 elupus

I could remove two template-sensors that way, but the two that involves math can't be done with a simple customize I believe?

kvisle avatar Aug 16 '21 11:08 kvisle

Right. Those can't be handled that way.

elupus avatar Aug 16 '21 11:08 elupus

Hi! I think what is missing is this:

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

I am getting the readings wrong Nibe Uplink correctly:

image

But I am not able to select it in the "Energy" setting! So I would need to use templates like kvisle?

Or will you implement it in the next version of the integration @elupus ?

Thanks a lot!

MichaelRV82 avatar Oct 27 '21 11:10 MichaelRV82

For now as mentioned, you can set this the measurement attribute in a customize entry inside home assistant.

elupus avatar Oct 27 '21 11:10 elupus

Can you share an example?

MichaelRV82 avatar Oct 27 '21 12:10 MichaelRV82

https://www.home-assistant.io/docs/configuration/customizing-devices/

elupus avatar Oct 27 '21 12:10 elupus

I did this:

image

Still, I cannot select the sensor for the energy function.

MichaelRV82 avatar Oct 27 '21 12:10 MichaelRV82

I think you must select a correct device class too.

elupus avatar Oct 27 '21 16:10 elupus

Yep! Working now! Thanks for your help!

MichaelRV82 avatar Oct 27 '21 17:10 MichaelRV82

I did this, and I just want to make note that the compressor time factors does not make any sense as far as I can see.

Todays example: Compressor time factor 16kWh - total electricity usage in the home, 12kWh.

Screenshot: https://imgur.com/cBXpGlN

kvisle avatar Oct 28 '21 10:10 kvisle

Which sensors or entities are you modifying to get energy monitoring to work? I have a F730

larssonj avatar Dec 09 '21 06:12 larssonj

Interested in achieving this also! Currently considering adding a hardware energy monitor (EmonPi) to the heat pump and be able to deduce energy for heating and hot water.

NickSutton avatar Dec 14 '21 10:12 NickSutton

I did this, and I just want to make note that the compressor time factors does not make any sense as far as I can see. Todays example: Compressor time factor 16kWh - total electricity usage in the home, 12kWh. Screenshot: https://imgur.com/cBXpGlN

I have the same problem.. Not sure that you actually mean "Compressor time factor" ;-) - we are talking about energy usage, right?

For my energy, I look at the following two sensors: sensor.nibe_92850_44300 - heating, int. add. incl. sensor.nibe_92850_44298 - hw, incl. int. add

If I take the value directly, it looks like the energy used is estamated 3 times higher than it is in reality. The raw values is always way higher than my total usage of my entire home, so I know something is not right.

I have fixed it like this :

'''

sensor:

  nibe_92850_44300_converted:
    friendly_name: 'Energy Heating'
    value_template: "{{ (states('sensor.nibe_92850_44300') | float * 0.33333) | round(3) }}"
    unit_of_measurement: "kWh"

  nibe_92850_44298_converted:
    friendly_name: 'Energy Hot Water'
    value_template: "{{ (states('sensor.nibe_92850_44298') | float * 0.33333) | round(3) }}"
    unit_of_measurement: "kWh"

'''

The "_converted" values is then customized like this: unit_of_measurement: kWh device_class: energy state_class: total_increasing Last resset: ""1970-01-01T00:00:00.000000+00:00""

and used in the Energy Dashboard.

@elupus can you have a look at the raw values to see if the error is in the Nibe data or is converted/factored in any way? (3 phase power perhaps??)

oz9els avatar Jan 05 '22 10:01 oz9els

How did you arrive at "is estimated 3 times higher than it is in reality"? I have only been able to conclude that the numbers are wrong.

kvisle avatar Jan 05 '22 11:01 kvisle

@oz9els: I Have a energy meter (not smart) conneted to my Nibe F750 - seems like You are correct regarding consumtion, split 3ways. Faktor for my consumtion is "0,3256" But I cannot get this energy convertion of sensors to work. Are You able to provide a detailed "how to"?

msandvold avatar Jan 11 '22 10:01 msandvold

If you are running version v.9086R8 on a F750 it would be useful to update to the latest version of the nibe firmware (R10).

From changelog: Version: 9086R9 Release date: 2021-03-08 Changes · The basic configuration of energy flow meter BF1 went wrong in v.9086R8 which meant that the energy measuring was faulty. Corrected. · It is now possible to reset the energy flow meter in menu 5.5

gucket avatar Jan 18 '22 14:01 gucket

How did you arrive at "is estimated 3 times higher than it is in reality"?

It is a guesstimate - I have a total and know the "idle" consumption. My calculations were VERY close to 1/3

oz9els avatar Jan 20 '22 14:01 oz9els

@msandvold

But I cannot get this energy convertion of sensors to work. Are You able to provide a detailed "how to"?

The only thing I done is: Installed the NIBE uplimnk integration in HACS I use the values from sensors: sensor.nibe_XXXXX_44300 sensor.nibe_XXXXX_44298

(the XXXXX is your installation/unique number)

Then I convert them:

sensor:

  nibe_92850_44300_converted:
    friendly_name: 'Energy Heating'
    value_template: "{{ (states('sensor.nibe_92850_44300') | float * 0.33333) | round(3) }}"
    unit_of_measurement: "kWh"

  nibe_92850_44298_converted:
    friendly_name: 'Energy Hot Water'
    value_template: "{{ (states('sensor.nibe_92850_44298') | float * 0.33333) | round(3) }}"
    unit_of_measurement: "kWh"

oz9els avatar Jan 20 '22 14:01 oz9els

I did this, and I just want to make note that the compressor time factors does not make any sense as far as I can see. Todays example: Compressor time factor 16kWh - total electricity usage in the home, 12kWh. Screenshot: https://imgur.com/cBXpGlN

I have the same problem.. Not sure that you actually mean "Compressor time factor" ;-) - we are talking about energy usage, right?

For my energy, I look at the following two sensors: sensor.nibe_92850_44300 - heating, int. add. incl. sensor.nibe_92850_44298 - hw, incl. int. add

If I take the value directly, it looks like the energy used is estamated 3 times higher than it is in reality. The raw values is always way higher than my total usage of my entire home, so I know something is not right.

I have fixed it like this :

'''

sensor:

  nibe_92850_44300_converted:
    friendly_name: 'Energy Heating'
    value_template: "{{ (states('sensor.nibe_92850_44300') | float * 0.33333) | round(3) }}"
    unit_of_measurement: "kWh"

  nibe_92850_44298_converted:
    friendly_name: 'Energy Hot Water'
    value_template: "{{ (states('sensor.nibe_92850_44298') | float * 0.33333) | round(3) }}"
    unit_of_measurement: "kWh"

'''

The "_converted" values is then customized like this: unit_of_measurement: kWh device_class: energy state_class: total_increasing Last resset: ""1970-01-01T00:00:00.000000+00:00""

and used in the Energy Dashboard.

@elupus can you have a look at the raw values to see if the error is in the Nibe data or is converted/factored in any way? (3 phase power perhaps??)

The integration only parses the data from the device. So it should not be applying any scaling.

elupus avatar Jan 20 '22 14:01 elupus

@msandvold

But I cannot get this energy convertion of sensors to work. Are You able to provide a detailed "how to"?

The only thing I done is: Installed the NIBE uplimnk integration in HACS I use the values from sensors: sensor.nibe_XXXXX_44300 sensor.nibe_XXXXX_44298

(the XXXXX is your installation/unique number)

Then I convert them:

sensor:

  nibe_92850_44300_converted:
    friendly_name: 'Energy Heating'
    value_template: "{{ (states('sensor.nibe_92850_44300') | float * 0.33333) | round(3) }}"
    unit_of_measurement: "kWh"

  nibe_92850_44298_converted:
    friendly_name: 'Energy Hot Water'
    value_template: "{{ (states('sensor.nibe_92850_44298') | float * 0.33333) | round(3) }}"
    unit_of_measurement: "kWh"

Hey,

Can you please direct me to the name of the entities you are using? I don't have neither 44300 nor 44298 in my list of Nibe sensors. I have the F730 heating pump.

Thanks!

pasberg avatar Mar 08 '22 13:03 pasberg

@pasberg You will find the sensors under "master : heat meter"

  • There is listet 5 sensor - one for pump spess and four "energy" sensors.

@oz9els I think I forgott to say that I got this to work - thanks alot for the information.

msandvold avatar Mar 08 '22 14:03 msandvold

@pasberg You will find the sensors under "master : heat meter"

  • There is listet 5 sensor - one for pump spess and four "energy" sensors.

@oz9els I think I forgott to say that I got this to work - thanks alot for the information.

Thanks for the reply, but I only got these "master" -units: Skärmavbild 2022-03-08 kl  15 49 57

How do I get the "master: heat meter" unit? Do I need to specify something more in configuration.yaml?

pasberg avatar Mar 08 '22 14:03 pasberg

I think heat meter will only show up if you have a flow meter installed on your pump.

elupus avatar Mar 08 '22 14:03 elupus

I think heat meter will only show up if you have a flow meter installed on your pump.

Ah... like an energy meter? Do you have one? What kind do you have?

pasberg avatar Mar 08 '22 15:03 pasberg

This energy meter was innstalled simultaniously as I replaced my old Nibe F310p with a F750. IMG_20220308_192036 (not a smart meter)

msandvold avatar Mar 08 '22 18:03 msandvold

Well it's two things really. A flow meter measures the hot water flow rate out of the pump. It can then calculate the energy output. An energy meater can be installed on the incoming electrical lines to measure consumed energy.

elupus avatar Mar 08 '22 18:03 elupus

This energy meter was innstalled simultaniously as I replaced my old Nibe F310p with a F750. IMG_20220308_192036 (not a smart meter)

Thanks! OK, so if you don't have a smart meter, how did you get the numbers into HA?

pasberg avatar Mar 09 '22 12:03 pasberg

Well it's two things really. A flow meter measures the hot water flow rate out of the pump. It can then calculate the energy output. An energy meater can be installed on the incoming electrical lines to measure consumed energy.

I get it. So an energy meter would be preferred, but a flow meter would do it if you don't have an energy meter, right?

pasberg avatar Mar 09 '22 12:03 pasberg

Well two different things really. One is the energy consumed from the grid. One is the heat energy your pump adds to your house. It will add more energy than consumed from electricity since it pulls that from surrounding air or ground based on pump.

To calculate COP for a pump, you need both.

elupus avatar Mar 09 '22 12:03 elupus

Well two different things really. One is the energy consumed from the grid. One is the heat energy your pump adds to your house. It will add more energy than consumed from electricity since it pulls that from surrounding air or ground based on pump.

To calculate COP for a pump, you need both.

I see... Thanks for a great explanation how it's all connected! Since I don't seem to have an energy meter nor a flow meter, this isn't for me, I guess. :(

pasberg avatar Mar 09 '22 13:03 pasberg

This energy meter was innstalled simultaniously as I replaced my old Nibe F310p with a F750. IMG_20220308_192036 (not a smart meter)

You ca get data from your meter by reading the led light in the right corner 1000 blinks / kwh use ESPhome for an example.

rabbadab avatar Mar 18 '22 07:03 rabbadab

I guess that is an option :) , but since this meter somehow is attached to the pump, i get Readings regarding consumptions both in the menu/info in the pump it self and in HA using this integration.

msandvold avatar Mar 18 '22 15:03 msandvold

@kvisle and @oz9els you are talking about wrong readings from parameter 44298 and 44300. Isn't those two values the energy produced rather than the energy consumed?

delabrava avatar Mar 24 '22 20:03 delabrava

[sensor.nibe_48147_42075] produced electricity The state_class is set to "measurement" but should be "total_increasing"

ejaw42 avatar Jul 24 '22 10:07 ejaw42

I can confirm that adding new template sensors based on the state of the heat meter and setting them to total_increasing as suggested allows me to add them to the energy dashboard.

template:
    - sensor:
        name: "Nibe cooling energy spent"
        unit_of_measurement: "kWh"
        state_class: total_increasing
        device_class: energy
        state: "{{ states('sensor.nibe_xxx_44302') }}"
    - sensor:
        name: "Nibe hot water energy spent"
        unit_of_measurement: "kWh"
        state_class: total_increasing
        device_class: energy
        state: "{{ states('sensor.nibe_xxx_44298') }}"
    - sensor:
        name: "Nibe heating energy spent"
        unit_of_measurement: "kWh"
        state_class: total_increasing
        device_class: energy
        state: "{{ states('sensor.nibe_xxx_44300') }}"

Maybe the integration can just be updated so that the sensors are set to total_increasing instead of measurement?

nbeernink avatar Jul 26 '22 13:07 nbeernink

I can confirm that adding new template sensors based on the state of the heat meter and setting them to total_increasing as suggested allows me to add them to the energy dashboard.

template:
    - sensor:
        name: "Nibe cooling energy spent"
        unit_of_measurement: "kWh"
        state_class: total_increasing
        device_class: energy
        state: "{{ states('sensor.nibe_xxx_44302') }}"
    - sensor:
        name: "Nibe hot water energy spent"
        unit_of_measurement: "kWh"
        state_class: total_increasing
        device_class: energy
        state: "{{ states('sensor.nibe_xxx_44298') }}"
    - sensor:
        name: "Nibe heating energy spent"
        unit_of_measurement: "kWh"
        state_class: total_increasing
        device_class: energy
        state: "{{ states('sensor.nibe_xxx_44300') }}"

Maybe the integration can just be updated so that the sensors are set to total_increasing instead of measurement?

@nbeernink , as per my understanding, these sensors are not the energy consumed(spent), it's the amount of energy produced. Since it's a heat pump the acutal energy consumed will be less.

delabrava avatar Jul 26 '22 13:07 delabrava