Multiple Sensors not showing

Hi
I’m sure it’s pretty obvious but I’ve been awake since 3am!

I’ve just setup some history sensors but I can only see one in HA

Configuration:

sensor:
 - platform: history_stats
   name: Heating_Today
   entity_id: sensor.heating_activity
   state: 'heating'
   type: time
   start: "{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}"
   end: "{{ now() }}"


sensor:
 - platform: history_stats
   name: Heating_Yesterday
   entity_id: sensor.heating_activity
   state: 'heating'
   type: time6666
   end: "{{ now().replace(hour=0, minute=0, second=0) }}"
   duration:
     hours: 24

sensor:
 - platform: history_stats
   name: Heating_This_Week
   entity_id: sensor.heating_activity
   state: 'heating'
   type: time
   start: "{{ as_timestamp( now().replace(hour=0, minute=0, second=0) ) - now().weekday() * 86400 }}"
   end: "{{ now() }}"

And in the UI I have

image

sensor:
 - platform: history_stats
   name: Heating_Today
   entity_id: sensor.heating_activity
   state: 'heating'
   type: time
   start: "{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}"
   end: "{{ now() }}"

 - platform: history_stats
   name: Heating_Yesterday
   entity_id: sensor.heating_activity
   state: 'heating'
   type: time6666
   end: "{{ now().replace(hour=0, minute=0, second=0) }}"
   duration:
     hours: 24

 - platform: history_stats
   name: Heating_This_Week
   entity_id: sensor.heating_activity
   state: 'heating'
   type: time
   start: "{{ as_timestamp( now().replace(hour=0, minute=0, second=0) ) - now().weekday() * 86400 }}"
   end: "{{ now() }}"

Of course I was just being stupid - life is a learning curve!

All works, except:

which throws

Invalid config for [sensor.history_stats]: value must be one of [‘count’, ‘ratio’, ‘time’] for dictionary value @ data[‘type’]. Got ‘time6666’. (See ?, line ?).

but it could be because I don’t have history stats for that long

This should be type: time

What the actual

I genuinely don’t know where that came from nor why I didn’t see it. All working now, except that it returns a non-numeric value for yesterday - which makes sense as I didn’t have my custom sensor yesterday (so there is no value).

Tomorrow it will work :smiley:

Thanks for all your help @tom_l and @parrel

1 Like