Using the Sun Horizon Graph with another entity

Is it possible to use this graph
image
With another entity? I have a Sonoff S31 with energy meter.
“above horizon” should be when the plug is ON and “below horizon” should be when the plug is OFF / zero watts

How can I do this?

Thanks!

The history graph will display like that when the entity has no unit_of_measurement. Since switches don’t have a unit of measurement all you have to do is add it to a history graph.

type: history-graph
entities:
  - entity: switch.your_sonoff_switch_here
hours_to_show: 24
refresh_interval: 0
2 Likes

Thank you! It was easier than I thought. I had already tried the history-graph with the sonoff entity, my mistake is I was using a sensor entity and I had to use the switch entity.