Fixed sensor based on real sensor (for Energy dashboard use)

Hi,

I need help regarding water level sensor. The problem is that sometimes measurement is flipping between two values and then sensor is showing UP and DOWN values, which then makes problem if I want to use this sensor as energy meter because values of flipping up and down is reflected as consumption.

And values are completly wrong on consumption energy meter…
image

So the goal is to create new sensor which would made measurement based on some event (I can use water pump energy).
So when water pump stop to work (consumption below 10 Watt) then measurement of consumption would be made, otherwise not.

This kind sensor I can then use for energy dashboard.

Any ideas how to achieve this?

Other option is that measurement would be made only once per hour… so time based.

I assume you looked at creating a template sensor for this?
If so then do you have any issues ?

If not:
Template - Home Assistant (home-assistant.io)

My issue is that I am very poor on yaml and do not know how to achieve this…

So the goal is to make the same, but template sensor as current, but withouth flipping UP and DOWN… Based on trigger when to get value…

This I can then use for energy meter…

You should learn this and it will take time … in the meantime there is plenty to copy/paste from what you can find in this forum…a lot of searching but then you move forward too :slight_smile:
Something like this… when power below 10 then update sensor with that value
EDIT: I missed the pump…PUMP should be below 10

# Example configuration entry
template:
  - trigger:
      - platform: numeric_state
        entity_id: sensor.YOURPUMPENTITY
        below: 10
    sensor:
      - name: "YOURNAMEFOR THIS NEW SENSOR"
        state: '{{ states('sensor.YOURPOWERENTITY') | float(0)}}'

Great example…

Just one problem…

template:
  - trigger:
      - platform: numeric_state
        entity_id: sensor.pp_tw
        below: 10
    sensor:
      - name: "Vodostanje (trenutni nivo vode)"
        state: '{{ states('sensor.trenutni_nivo_vode') | float(0)}}'

I would like to make mesuarement when power goes from above 10 to below 10, so only then, not all the time when trigger is below 10… Can this be done?

This could become more complex…a simple way is to add a time-period, i.e. the state < 10 for (say) 20 seconds?

template:
  - trigger:
      - platform: numeric_state
        entity_id: sensor.pp_tw
        for:
          hours: 0
          minutes: 0
          seconds: 20
        below: 10
    sensor:
      - name: "Vodostanje (trenutni nivo vode)"
        state: '{{ states('sensor.trenutni_nivo_vode') | float(0)}}'
1 Like

Thank you…

I will try with “above”, as this suits better in this case…

template:
  - trigger:
      platform: numeric_state
      entity_id: sensor.pp_tw
      above: 10
      for:
        hours: 0
        minutes: 0
        seconds: 10
    sensor:
      name: "Vodostanje (trenutni nivo vode)"
      unit_of_measurement: "L"
      state: "{{ states('sensor.trenutni_nivo_vode') | float(0)}}"

We will see if this works as should with energy water consumption withouth any flipping UP and DOWN mesuarment…

It works… spikes UP/DOWN are gone :wink:

Top, please makr one of my posts as solution then…good for others to see there is one

I would like to make one of your post as solution but it’s strange that I do not see this option…

Should be somewhere on the bottom section of a post…else…forget it, not super important, just good for others :slight_smile: