Servus,
Is it somehow possible to get a history entity state ( in my case a Date for Sun rise and setting ) in the apex chart for annotations ? I got it working for “today” ( thx to someone posted it here … ) , but i also have an history Daily graph where it would be very nice if the annotations are correct .
i have some nyb problem to understand how i would be able to retrieve a entity states[‘sensor.home_sun_rising’].state from - X days . I use the custom-template already for buttons …
- type: custom:config-template-card
card:
type: custom:apexcharts-card
card_mod:
style: |
ha-card { border: none; box-shadow: none; }
now:
show: false
apex_config:
annotations:
xaxis:
- x: ${new Date(states['sensor.home_sun_rising'].state).getTime()}
label:
text: ☼
borderWidth: 0
style:
background: "#0000"
- x: ${new Date(states['sensor.home_sun_setting'].state).getTime()}
label:
text: ☾
borderWidth: 0
style:
background: "#0000"
I guess this needs to be done in JS , and i have looked into some samples but i lost how to try and error on this here .
so Variables in the card template , but how
var d = new Date();
d.setDate(d.getDate() - 5);
d should be a date 5 days ago
Any help would be great on this.
thx, Dietmar