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

Help Setting up History Stats Sensor

$
0
0

@Arsenal10108 wrote:

I am trying to set up a history states sensor to simply count the total time a switch is set to the on position. Should be pretty simple but its kicking my butt
I don’t have any special configs for History or Recorder, for recorder I just have Purge_keep_days: 30
Basically its a D1 Mini(tasmota) that will be tied to the contacts of a relay. So when the relay contacts close it sets the switch to on, when they open: off. The coil side of the relay will be tied to my Oil Boiler pump to get actual run time of the burner.

The sensor for the tasmota topic works as it updates HA with on or off perfectly but the history stats just shows as unknown.

Here is the config I am trying to work with

#Oil Boiler Sensor History
  - platform: history_stats
    name: Boiler time
    entity_id: sensor.boiler_switch
    state: "ON"
    end: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    duration:
      days: 30
#Oil Boiler Switch Sensor
  - platform: mqtt
    state_topic: stat/Boiler/POWER
    name: boiler switch

Posts: 6

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 96121

Trending Articles



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