I’ve built a ‘security overview’ that just lists if doors and windows are closed and the frontdoor is locked.
It’s nice to have a list, but I would love to have it shown as a pie-chart, so that each entity provides a piece of the pie in a color for unsafe and safe, and then a full ‘green’ circle would indicate all is secured.
I see your point, true, that is correctly a pie-chart, but you got the picture and in lack of better terms…
Do you know of any card that provides this?
i have a sensor that has 5 possible string values. WOuld it be possible to use this card to do a pie chart of the % of time in that state for the last 24 hours? can anyone help with an example?
Hi, I’ve got this working, so I’ll share the code for anyone looking in the future like me.
Firstly, I’ve installed ApexCharts using HACS
Then, in home assistant’s configuration.yaml I’ve added a history_stats sensor for every state that my input could be in, so as I’m tracking my PC’s state, it’s Windows, Linux and Off:
sensor:
- platform: history_stats
name: Linux time
entity_id: input_select.pc
state: "Linux"
type: time
duration:
days: 31
end: "{{ now() }}"
- platform: history_stats
name: Windows time
entity_id: input_select.pc
state: "Windows"
type: time
duration:
days: 31
end: "{{ now() }}"
- platform: history_stats
name: Off time
entity_id: input_select.pc
state: "Off"
type: time
duration:
days: 31
end: "{{ now() }}"
Then, I’ve added the ApexCharts card with the following code:
type: custom:apexcharts-card
header:
show: true
title: PC Time
show_states: true
colorize_states: true
chart_type: pie
series:
- entity: sensor.linux_time
- entity: sensor.windows_time
- entity: sensor.off_time
And now I can see the percentage of time that my PC spends in each state