实现功能
- 通知推送
- 亮度控制
- 自动亮度开关
- 应用持续时间控制
- 应用自动关闭开关
吐槽
- 这货真的只适合跑在内网,API访问完全没有鉴权措施,被人发现就随便玩了……
- mqtt不会自动反馈状态,要publish需查询的字段,返回结果还统一在awtrix/response下……服了
- 控制逻辑太奇葩了,app pause后只要换一个应用就取消pause……就不能好好当个钟吗
- 没有WiFi这货就是个显示器……(想加装时钟模块和锂电充电模块了)
心累……
效果
配置
前提:Controller网页端先填写mqtt服务器信息进行接入
# 辅助元素 可以在Lovelace中手动创建
input_number:
awtrix_brightness:
name: 亮度
icon: mdi:brightness-6
mode: slider
min: 5
max: 75
step: 5
awtrix_appduration:
name: 应用停留时间
icon: mdi:clock
mode: slider
min: 5
max: 60
step: 5
input_text:
awtrix_notify:
name: 通知内容
icon: mdi:form-textarea
switch:
- platform: template
switches:
friendly_name: 自动亮度
awtrix_autobrightness:
value_template: '{{ states.sensor.awtrix_autobrightness.state }}'
turn_on:
- service: mqtt.publish
data:
topic: awtrix/settings
payload: '{"AutoBrightness":true}'
- service: mqtt.publish
data:
topic: awtrix/basics
payload: '{"get":"settings"}'
turn_off:
- service: mqtt.publish
data:
topic: awtrix/settings
payload: '{"AutoBrightness":false}'
- service: mqtt.publish
data:
topic: awtrix/basics
payload: '{"get":"settings"}'
sensor:
- platform: mqtt
name: 'awtrix_brightness'
state_topic: 'awtrix/response'
value_template: '{{ value_json.Brightness }}'
- platform: mqtt
name: 'awtrix_AutoBrightness'
state_topic: 'awtrix/response'
value_template: '{{ value_json.AutoBrightness }}'
- platform: mqtt
name: 'awtrix_activeApp'
state_topic: 'awtrix/activeApp'
script:
awtrix_notify:
alias: 发送Awtrix通知
sequence:
- service: mqtt.publish
data:
topic: awtrix/notify
payload_template: >
{"name":"hass_notify", "force":true, "duration":5, "repeat":2,
"icon":1208, "text":"{{states.input_text.awtrix_notify.state}}"}
# duration: 当文本无需滚动即显示完毕时文本的停留时间(优先级低于repeat)
# repeat: 当文本需滚动时文本滚动次数
mode: single
icon: 'mdi:message'
automation:
- alias: awtrix暂停应用(禁止自动翻页)
description: ''
trigger:
- platform: state
entity_id: sensor.awtrix_activeapp
condition: []
action:
- service: mqtt.publish
data:
topic: awtrix/basics
payload: '{"app":"pause"}'
mode: single
- alias: awtrix应用停留时间
description: ''
trigger:
- platform: state
entity_id: input_number.awtrix_appduration
condition: []
action:
- service: mqtt.publish
data:
topic: awtrix/settings
payload_template: '{"AppDuration": {{states.input_number.awtrix_AppDuration.state|int}}}'
- service: mqtt.publish
data:
topic: awtrix/basics
payload: '{"get":"settings"}'
mode: single
- alias: awtrix亮度
description: ''
trigger:
- platform: state
entity_id: input_number.awtrix_brightness
condition: []
action:
- service: mqtt.publish
data:
topic: awtrix/settings
payload_template: '{"Brightness": {{states.input_number.awtrix_brightness.state|int}}}'
- service: mqtt.publish
data:
topic: awtrix/basics
payload: '{"get":"settings"}'
mode: single
|