In the UK our timezone presents huge differences of daylight between Winter and Summer, so I thought I would knockup a quick Realtime Sun Clock to quickly show time dawn, daylight dusk and nighttime.
This became a very simple task using Node-Red / Canvas Gauge Card and Home Assistant and I just thought it might be useful to others to show how you can incorporate the Custom card-templater to do this.
In Node-Red I used the Bigtimer to grab the Dawn/Sunrise/Dusk/Sunset times.
Using that node is so simple as it presents the data in minutes and then this is easily converted to decimal hrs. (there are loads of ways to get this data even without Node-red).
Using the Canvas Gauge Card you can create beautiful looking dials and I used this in conjunction with the Custom Card-templater to get the dial to show the current dawn/daylight/dusk and nighttime as the data highilghts
Here is the canvas gauge card data
type: custom:card-templater
entities:
- sensor.sunstart
- sensor.sunend
- sensor.nowhrs
card:
type: custom:canvas-gauge-card
entity: sensor.nowhrs
attribute: azimuth
card_height: 300
gauge:
animation: false
animationTarget: needle
type: radial-gauge
needleType: arrow
needleWidth: 3
colorNeedle: rgb(77, 84, 92, .90)
colorNeedleEnd: rgb(150, 161, 176, 90)
needleShadow: true
colorNeedleShadowUp: rgba(209, 223, 240,.90)
colorNeedleShadowDown: rgba(77, 84, 92, .10)
colorNeedleCircleOuterEnd: rgba(102, 100, 34, .90)
colorNeedleCircleOuter: rgba(81, 129, 138, .10)
colorNeedleCircleInner: rgba(248, 250, 187, .99)
colorNeedleCircleInnerEnd: rgba(81, 129, 138, .99)
colorPlateEnd: rgba(179, 179, 30, .50)
colorPlate: rgba(255, 255, 245, .90)
title: Sun 'O' Clock
width: 300
height: 300
borderShadowWidth: 1
borderOuterWidth: 1
borderMiddleWidth: 8
borderInnerWidth: 10
colorBorderMiddle: rgba(237, 242, 99, .10)
colorBorderMiddleEnd: rgba(183, 189, 21, .99)
colorBorderInnerEnd: rgba(183, 189, 21, .99)
colorBorderInner: rgba(237, 242, 99, .10)
minValue: 0
maxValue: 24
startAngle: 0
ticksAngle: 360
valueBox: false
majorTicks:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
fontTitleWeight: bolder
colorValueBoxBackground: rgb(245, 240, 240)
colorValueBoxRectEnd: rgb(176,172,172)
colorValueBoxRect: rgb(176,172,172)
valueInt: 1
valueDec: 0
valueBoxBorderRadius: 10
valueBoxStroke: 1
valueBoxWidth: 40
minorTicks: 10
strokeTicks: true
useMinPath: false
highlights:
- from_template: '{{ state_attr("sensor.sunstart", "dawn")}}'
to_template: '{{ states("sensor.sunstart")}}'
color: rgba(3, 15, 252, .20)
- from_template: '{{ states("sensor.sunend")}}'
to_template: '{{ state_attr("sensor.sunend", "dusk")}}'
color: rgba(3, 15, 252, .20)
- from_template: '{{ state_attr("sensor.sunend", "dusk")}}'
to_template: '{{ state_attr("sensor.sunstart", "dawn")}}'
color: rgba(3, 15, 252, .70)
- from_template: '{{ states("sensor.sunstart")}}'
to_template: '{{ states("sensor.sunend")}}'
color: rgba(245, 202, 7, .60)
Enjoy …