-
Notifications
You must be signed in to change notification settings - Fork 0
/
fullykiosk.yaml
124 lines (107 loc) · 4.21 KB
/
fullykiosk.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# fullykiosk.yaml
#
# Copyright (C) 2022-2024 Daniele Bochicchio, All Rights Reserved
# For updates see https://github.com/dbochicchio/reactor-mqtt-contrib
#
# *** IMPORTANT ***
# Every time you update the files, a restart is needed.
---
templates:
# fullykiosk
fullykiosk:
type: BinarySensor
capabilities: ["string_sensor", "binary_sensor", "battery_power", "battery_maintenance", "power_source", "dimming", "wifi_status"]
primary_attribute: string_sensor.value
requires: [topic]
description: Fully Kiosk device
contributor_name: "Daniele Bochicchio <[email protected]>"
license: MIT
contributor_url: https://github.com/dbochicchio/reactor-mqtt-contrib
events:
#The complete device info will be published every 60 seconds as fully/deviceInfo/[deviceId] topic (retaining, QOS=1).
#Following events are implemented for now: screenOn, screenOff, pluggedAC, pluggedUSB, pluggedWireless, unplugged, networkReconnect,
#networkDisconnect, internetReconnect, internetDisconnect, powerOn, powerOff, showKeyboard, hideKeyboard, onMotion, onDarkness, onMovement,
#volumeUp, volumeDown, onQrScanCancelled, onBatteryLevelChanged, onScreensaverStart, onScreensaverStop, onDaydreamStart, onDaydreamStop, onItemPlay,
#onPlaylistPlay, facesDetected.
# device update
"fully/deviceInfo/%topic%":
"string_sensor.value":
json_payload: true
expr: "payload.foreground ?? ''"
# battery_power
"battery_power.level":
json_payload: true
if_expr: "!isNaN(payload.batteryLevel)"
expr: "float(payload.batteryLevel)/100"
"battery_power.since":
expr: "time()"
# battery_maintenance
"battery_maintenance.charging":
json_payload: true
if_expr: "payload.isPlugged != undefined"
expr: "bool(payload.isPlugged)"
"battery_maintenance.replace":
expr: "false"
"battery_maintenance.rechargeable":
expr: "true"
# power_source
"power_source.source":
json_payload: true
if_expr: "payload.isPlugged != undefined"
expr: "bool(payload.isPlugged) ? 'ac': 'battery'"
# binary sensor for screen status
"binary_sensor.state":
json_payload: true
if_expr: "payload.screenOn && !isNaN(payload.screenBrightness)"
expr: "bool(payload.screenOn) && int(payload.screenBrightness) > 0"
# dimming level for screen status
"dimming.level":
json_payload: true
if_expr: "!isNaN(payload.screenBrightness)"
expr: "int(payload.screenBrightness) / 255"
"x_mqtt_device.online": true
# lwt
# "x_mqtt_device.online":
# json_payload: true
# if_expr: "payload._type == 'lwt'"
# expr: "payload.tst < time()/1000"
"wifi_status.rssi":
json_payload: true
expr: 'payload?.wifiSignalLevel'
"wifi_status.ssid":
json_payload: true
expr: 'payload?.SSID'
"wifi_status.station_ip":
json_payload: true
expr: "payload?.ip4"
# battery level
"fully/event/onbatterylevelchanged/%topic%":
"battery_power.level":
json_payload: true
if_expr: "!isNaN(payload.level)"
expr: "float(payload.level)/100"
"x_mqtt_device.online": true
# binary sensor for screen status
"fully/event/onScreensaverStart/%topic%":
"binary_sensor.state":
expr: "bool(false)"
"dimming.level":
expr: "int(0)"
"x_mqtt_device.online": true
"fully/event/onScreensaverStop/%topic%":
"binary_sensor.state":
expr: "bool(true)"
"x_mqtt_device.online": true
# battery_maintenance to get charging status
"fully/event/unplugged/%topic%":
"battery_maintenance.charging":
expr: "bool(false)"
"fully/event/pluggedAC/%topic%":
"battery_maintenance.charging":
expr: "bool(true)"
"fully/event/pluggedUSB/%topic%":
"battery_maintenance.charging":
expr: "bool(true)"
"fully/event/pluggedWireless/%topic%":
"battery_maintenance.charging":
expr: "bool(true)"