在ui界面中配置仪表盘 - Digital Clock卡片介绍
在上一篇中,我展示了目前正在使用的Dashboard的样式以及大致的配置方法,这一篇着重介绍其中的一个卡片:Digital Clock
介绍
Digital Clock很简单,是用于Home Assisatant Dashboard中的一个卡片,使用它的初衷是想在Dashboard中查看当前时间,其实可以通过sensor、template等实现,但安装这个Digital Clock最省事,所以。。。
安装
Digital Clock的安装更简单了,通过HACS安装即可
打开Home Assistant的HACS
点击前端
搜索Digital Clock并下载即可
使用
Digital Clock可以在ui中配置,所以很方便
搜索Digital Clock并点击
默认配置中只有一行代码,此时ui中就会有内容显示
type: custom:digital-clock
现在已经可以使用了,但是比如想要设置地区等等,还需要增加一些配置项
根据官方文档的说明,可以使用locale、timeZone、firstLineFormat、secondLineFormat等几项
locale 用来设置语言
如 locale:cn
timeZone 用来设置时区
如 timeZone: Asia/Shanghai
firstLineFormat (timeFormat) 用来设置第一行显示内容 主要是时间
如 { hour: '2-digit', minute: '2-digit' }
secondLineFormat (dateFormat) 用来设置第二行显示内容 主要是日期 星期
如 { weekday: 'short', day: '2-digit', month: 'short' }
其中firstLineFormat secondLineFormat 使用的是Luxon Format,可以据此自由更改想显示的时间格式
具体示例如下:
type: custom:digital-clock
locale: cn
timeZone: Asia/Shanghai
dateFormat:
weekday: long
day: numeric
month: long
year: numeric
timeFormat:
hour: 2-digit
minute: 2-digit
其中 firstLineFormat secondLineFormat可以使用如下格式:
type: custom:digital-clock
locale: cn
timeZone: Asia/Shanghai
dateFormat: yyyy-MM-dd LLLL cccc
timeFormat: HH:mm

张大妈红包拿来
校验提示文案
海瑞罢官
校验提示文案
海瑞罢官
校验提示文案
张大妈红包拿来
校验提示文案