Pulling the switch state

In my HA configuration I am storing the states in the influxDb and displaying them in Grafana.

However, I have a problem to reliably display the current switch state in the graph (eg. overlay temperature graph with heating switch state) - if there is a switch change event (either on or off) in the selected interval, the graph works (using fill(previous)). But when there was no change during the displayed time period, there are no values in the graph.

Is there are some “standard” way to solve this? I tried to use sensor.influxdb, but this also creates data record only when the state of the watched sensor changes.
I can probably get together a pulling script that will push the data to HA or InfluxDB in regular intervals, but I would like to ask first, whether there isn’t some better way how to do this.

Many thanks for any hints!

I’m not (yet) experienced/knowledgeable with Grafana/InfluxDB (my next project) but you should be able to force repeat the state of your sensor so it gets plotted accordingly. I just spent 10 min trying to retrieve the exact name and can’t find it.
Hope this port steers someone in the right direction to get the name again
Good luck

At the end I was able to find this very similar question:

@gcosta74 resolved it with repeated pulling via automation, which is probably the way I will go as well - I hoped to find a more elegant solution, but at least this one positively works.

force_update

Is the option I was looking for. Not sure if this is suitable for you