Display a custom Y axis for string values

Hi! First time posting here. Very new to grafana. I am using grafana with home assistant and influxdb, and I am wanting to create a visual where I display the state of my thermostat (off, idle, cool, or heat) over time to know how often it is on (cool or heat) and how often it is off (idle or off) and see that visually compared to the current temp that the thermostat is measuring.

The data is already in influx db just need help how to create a custom axis or how to create a calculated field much like you would using SQL. It maybe this can’t be done, but wondering if it is possible.

Here is how the data resides in influxdb:

Here is what I picture. An XY graph where it has the temperature reading over time of the thermostat and overlaid on top I can have another graph that goes maybe from 1 to 0 or ‘on’ and ‘off’ when the hvac_action_str == “cool” OR “heat” and hvac_action_str == “off” OR “idle” respectively. Is this something that is possible out of the box with grafana or do i need to do something else?