-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path433_bridge.yaml
156 lines (137 loc) · 3.8 KB
/
433_bridge.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# -------------------------------------
# ---- Implemented on Sonoff RF bridge ----
# -------------------------------------
substitutions:
devicename: 433_bridge
esphome:
name: ${devicename}
platform: ESP8266
board: esp01_1m
wifi:
#power_save_mode: light # power reduced from 1.2w to 0.8w
#fast_connect: true
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
hidden: True
manual_ip:
static_ip: !secret ip_433_bridge
gateway: !secret ip_gateway
subnet: 255.255.255.0
domain: .homelan
ap: # Enable fallback hotspot (captive portal) in case wifi connection fails
ssid: "${devicename} Hotspot"
password: !secret password
captive_portal:
mqtt:
broker: !secret mqtt_host
username: !secret mqtt_username
password: !secret mqtt_password
reboot_timeout: 0s # Dont reboot..
# Enable logging
logger:
baud_rate: 0
# Enable Home Assistant API
api:
reboot_timeout: 0s # Dont reboot..
encryption:
key: !secret encryption_key
services:
- service: send_rf_code
variables:
sync: int
low: int
high: int
code: int
then:
- rf_bridge.send_code:
sync: !lambda 'return sync;'
low: !lambda 'return low;'
high: !lambda 'return high;'
code: !lambda 'return code;'
- service: learn
then:
- rf_bridge.learn
ota:
password: !secret password
web_server:
port: 80
auth:
username: admin
password: !secret password
uart:
tx_pin: GPIO01
rx_pin: GPIO03
baud_rate: 19200
globals:
- id: rf_code
type: char[10]
rf_bridge:
on_code_received:
then:
- homeassistant.event:
event: esphome.rf_code_received
data:
sync: !lambda 'char buffer [10];return itoa(data.sync,buffer,16);'
low: !lambda 'char buffer [10];return itoa(data.low,buffer,16);'
high: !lambda 'char buffer [10];return itoa(data.high,buffer,16);'
code: !lambda 'char buffer [10];return itoa(data.code,buffer,16);'
- mqtt.publish_json:
topic: ${devicename}/received
payload: !lambda |-
char buffer1 [10];
char buffer2 [10];
char buffer3 [10];
char buffer4 [10];
root["sync"] = itoa(data.sync,buffer1,16);
root["low"] = itoa(data.low,buffer2,16);
root["high"] = itoa(data.high,buffer3,16);
root["code"] = itoa(data.code,buffer4,16);
# payload: |-
# root["sync"] = lambda 'char buffer [10];return itoa(data.sync,buffer,16);'
# root["low"] = lambda 'char buffer [10];return itoa(data.low,buffer,16);'
# root["high"] = lambda 'char buffer [10];return itoa(data.high,buffer,16);'
# root["code"] = lambda 'char buffer [10];return itoa(data.code,buffer,16);'
# - if:
# condition:
# lambda: |-
# return data.code == 0x6D8D11;
# then:
# - binary_sensor.template.publish:
# id: doorbell
# state: ON
# - delay: 5s
# - binary_sensor.template.publish:
# id: doorbell
# state: OFF
binary_sensor:
- platform: status
name: ${devicename} Status
# - platform: template
# name: ${devicename} Doorbell
# id: doorbell
# device_class: moving
- platform: gpio
pin:
number: GPIO5
mode: INPUT_PULLUP
inverted: True
name: ${devicename} Gate
device_class: door
filters:
- delayed_on: 100ms
- delayed_off: 100ms
- platform: gpio
pin:
number: GPIO4
mode: INPUT_PULLUP
inverted: True
name: ${devicename} Back Garage
device_class: garage_door
filters:
- delayed_on: 100ms
- delayed_off: 100ms
status_led:
pin:
number: GPIO13
inverted: yes