-
Notifications
You must be signed in to change notification settings - Fork 0
/
shelly_gen1_sensors.yaml
115 lines (107 loc) · 3.36 KB
/
shelly_gen1_sensors.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
# shelly_gen1_sensors.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:
# Shelly Door/Window Sensor 2
shelly_dw2:
type: BinarySensor
capabilities: ["door_sensor", "light_sensor", "tilt_sensor", "motion_sensor", "battery_power"]
primary_attribute: door_sensor.state
requires: [topic]
description: Shelly Door/Window Sensor 2
include:
- shelly_online_gen1
- shelly_battery_gen1
query:
topic: "shellies/%topic%/command"
payload: "update"
qos: 0
retain: false
events:
"shellies/%topic%/sensor/state":
"door_sensor.state":
expr: "float(payload) == 1"
"x_mqtt_device.online": true
"shellies/%topic%/sensor/lux":
"light_sensor.value":
expr: "float(payload)"
"light_sensor.units": "lux"
"x_mqtt_device.online": true
# tilt as a binary sensor
"shellies/%topic%/sensor/tilt":
"tilt_sensor.state":
expr: "float(payload) > 0"
"x_mqtt_device.online": true
# vibration as motion_sensor
"shellies/%topic%/sensor/vibration":
"motion_sensor.state":
expr: "float(payload) == 1"
"x_mqtt_device.online": true
# battery_power
"shellies/%topic%/sensor/battery":
"x_mqtt_device.online": true
# Shelly with external temp sensor
shelly_exttemperature:
type: ValueSensor
capabilities: ["temperature_sensor"]
primary_attribute: temperature_sensor.value
requires: [topic, channel]
description: Shelly with external temperature sensors
include:
- shelly_online_gen1
events:
"shellies/%topic%/ext_temperature/%channel%":
"temperature_sensor.value":
expr: "float(payload)"
if_expr: 'payload != "999"'
"temperature_sensor.units": "C"
"x_mqtt_device.online": true
# Shelly with external humidity sensor
shelly_exthumidity:
type: ValueSensor
capabilities: ["humidity_sensor"]
primary_attribute: humidity_sensor.value
requires: [topic, channel]
description: Shelly with external humidity sensors
include:
- shelly_online_gen1
events:
"shellies/%topic%/ext_humidity/%channel%":
"humidity_sensor.value":
expr: "float(payload)"
if_expr: 'payload != "999"'
"humidity_sensor.units": "%"
"x_mqtt_device.online": true
# Shelly with binary input
shelly_binary:
type: BinarySensor
capabilities: ["binary_sensor"]
primary_attribute: binary_sensor.state
requires: [topic, channel]
description: Shelly with detached inputs, mapped as binary sensor
include:
- shelly_online_gen1
events:
"shellies/%topic%/input/%channel%":
"binary_sensor.state":
expr: "float(payload) == 1"
"x_mqtt_device.online": true
# Shelly Uni ADC sensor
shelly_uni_adc:
type: ValueSensor
capabilities: ["value_sensor"]
primary_attribute: value_sensor.value
requires: [topic, channel]
description: Shelly Uni ADC sensor
include:
- shelly_online_gen1
events:
"shellies/%topic%/adc/%channel%":
"value_sensor.value":
expr: "float(payload)"
"x_mqtt_device.online": true