Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 102782

Create total increasing from binary_sensor

$
0
0

hello there,
I’ve got a binary_sensor which indicates my oilheating is on. The burner consumes 2.84 liters per hour on.
So I can find the time the burner is on today via history stats.

  - platform: history_stats
    name: "Brennerlaufzeit heute"
    entity_id: binary_sensor.brennerstatus
    state: 'on'
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    end: '{{ now() }}'

and from this i can do the amount oli consumed today:

      oelverbrauch_heute:
        friendly_name: "Ölverbrauch Heute"
        unit_of_measurement: 'l'
        value_template: "{{ states('sensor.brennerlaufzeit_heute') | float * 2.84}}" 

What I wanted to do now is a total_increasing sensor. I tried by finding the total time the burner is running, but i can’t figure out a good way. at he moment I’m putting the value of oil burned at the end of any day into a variable, and then adding this to the daily value, but this causes values jumping around midnight. Something smooth would be nice. And next Up I’d like to be able to manually reset this every about 2 years… but then again most likely the heating will be changed to a heatpump in the next three years anyways.
Here’s what i tried:

automation:

- id: set_total_Oil
  alias: set total oil
  description: ''
  trigger:
    platform: time
    at: "23:59:59"
  action:
    - service: input_number.set_value
      data:
        value: "{{(states('sensor.oelverbrauch_heute')) | float }}"
      target:
        entity_id: input_number.oil_today
    - service: input_number.set_value
      data:
        value: "{{ (states('input_number.oil_running_total')) | float + (states('input_number.oil_today')) | float }}"
      target:
        entity_id: input_number.oil_running_total
    - service: input_number.set_value
      data:
        value: "0"
      target:
        entity_id: input_number.oil_today

Would appreciate any help
Thanx

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 102782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>