Display Sensor in Grafana with mulitple states

I have a sensor with three different states, that I want to display in Grafana. For example in a pie chart, showing me how long each state was “on” - Is this possible in Grafana, or do I have to create three different history stats sensor in Home Assistant before?

SCREENSHOT-2020-04-24 at 18-50-41

I was going to put a very similiar question on here. Did you get an answer to this?

I have the same issue with Hive where it records an ‘On’ when the boiler is engaged and ‘Off’ when not. I haven’t been able to work out how do this in Grafna/InfluxDB?

Did anyone get anywhere with this?

I am also trying to plot a graph from Hive telling me what the state of a thermostat switch is, off or eco (eco-being the boost function I think). I’d really like a graph that goes to 3 levels for instance 0.5 and one. Any ideas? Many thanks.

My solution is the TimescaleDB Addon with Postgresql as a Grafana Database. Ther you can do more complex queries in Grafana like displaying different states of a Home Assistant sensor:

Thanks so much for the response but wow that looks quite complicated! So would the PostgreSQL need to take over from InfluxDB which currently holds all my HA datalogging? Is there not a way for the standard Influx/Grafana setup to show a graph of a trichotomy like I’m describing with Hive status?