本帖最后由 huex 于 2018-3-16 10:09 编辑
坛友问及,又在本坛没有搜到,所以简单写一下样例,代大家参考 ,以ping检测为例吧,然后你们无限想象一下,能应用很多地方,
binary_sensor:
- platform: ping
name: ptdown
host: 10.0.0.5
scan_interval: 10
cout: 2
group:
pingstate:
control: hidden
name: pingstate
view: no
#icon:
entities:
- binary_sensor.ptdown
homeassistant:
customize:
binary_sensor.ptdown:
friendly_name: 苹果手机
templates:
_stateDisplay: "if (state === 'on') return '在线'; else return '离线';"
icon: mdi:cellphone-iphone
rgb_color: "if (state === 'on') return [174, 231, 43]; else return [207, 0, 57];"
展示:
|