History bar of template sensor

hi,

I have created a sensor template for my WeMo Insight Switch to monitor my washing machine. The template looks as follows:

- platform: template
  sensors:
    laundry_state:
      friendly_name: 'Laundry'
      value_template: >-
          {%- if is_state("switch.washing_machine", "off") %}
              Off
          {%  elif states.switch.washing_machine and states.switch.washing_machine.attributes.current_power_mwh < 8000 %}
              Ready
          {% elif is_state("switch.washing_machine", "on") %}
              On
          {%  else %}
              ...
          {%- endif %}

What I don’t understand is that the history component shows the history data in a graph (without any data) with a vertical scale from 0.00 to 1.00, instead of showing the text states [“On”, “Off”, “Ready”, “…”] in a color horizontal bar (I hope you know what I mean).

Is there a way to force the history component to do this?

Thank you.

I know this is old but I have the same exact issue. Anyone know how to solve?

Post your config.

I’m trying to create a sensor that pulls from the attributes of the mobile_app battery sensor to see if my phone is charging or not. It pulls the data and shows charging or not charging, but it shows a graph for some reason instead of the bar that shows the state which is what I am trying to get.

  - platform: template
    sensors: 
      brians_iphone_battery_state:
        value_template: "{{ state_attr('sensor.britnis_iphone_battery_level', 'Battery State') }}"
        icon_template: "{{ state_attr('sensor.brians_iphone_battery_level', 'icon') }}"
        friendly_name: "Brians iPhone Battery State"

that’s not a valid attribute. Can you post a screenshot of the attributes in the dev tools → states page (of the iphone sensor).

It is a valid attribute.

Yes, it appears it is. Well, when it was added to your database, it most likely had the first value as a number. What’s your db purge interval? More than likely, when that interval is met, the system will change it to a non-unitized sensor and it will become a bar graph.

I haven’t changed that to my knowledge, so whatever default is?

Then in 10 days it should correct itself.

It seems to have fixed itself last night. It’s showing the bar now. Thanks for the explanation.