Sensor trouble

YAML=Yet Another Malfunction for Little me ;(
I have an oilburner, and i would like to track the time its running. Ive put a shelly plus1pm on it, witch is always “ON”. The plan is to use “History stats” to keep track of time when the burner is drawing power. I`ve created a sensor (from instructions in a youtube video):

  • platform: history_stats
    type: time
    name: tid oliefyr
    entity_id: sensor.oliefyr_switch_0_power
    state: “on”
    start: “{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}”
    end: “{{ now() }}”

But i can`t get it to work :frowning:
I would like to start the “timer” when the power is above 10w

YAML is like chinese to me, but believe that it`s learning by doing :slight_smile:

Hope you will help a newbie idiot :slight_smile:

Can you please format your YAML properly so that things like spacing, etc. can be checked.

Or you can use a History Stats Helper.

Just make sure that the sensor you’re using (which c/should be a binary_sensor if it only has the states “on” and “off”) reflects the actual state.

If you want/need it to report on a daily basis use this in the options screen:

My Shelly device is always ON, and i want the history stats sensor to keep track of the time when the power drawn by the burner is above 10 watts.
Don`t know if it makes sense ?

It does, but you now need an additional step.

First, create a template binary (helper) sensor that is ‘on’ when the power is above 10W and ‘off’ when it’s below.

{% if states('sensor.oliefyr_switch_0_power') | float(0) >= 10 %}
  on
{% else %}
  off
{% endif %}

Then create a History Stats sensor that shows how long the helper has been in an ‘on’ state - see above screenshots.