-
Notifications
You must be signed in to change notification settings - Fork 18
/
cc1101-advanced.yaml
137 lines (122 loc) · 3.22 KB
/
cc1101-advanced.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
# https://github.com/dbuezas/esphome-cc1101
esphome:
name: cc1101-example
friendly_name: CC1101 example
includes:
- cc1101.h
libraries:
- SPI
- "SmartRC-CC1101-Driver-Lib"
esp8266:
board: d1_mini
#esp32:
# board: esp32dev
wifi:
ssid: !secret wifi_name
password: !secret wifi_pass
fast_connect: true
power_save_mode: HIGH
logger:
level: VERBOSE
api:
ota:
web_server:
port: 80
number:
- platform: template
max_value: 812
min_value: 58
step: 1
mode: slider
optimistic: true
unit_of_measurement: "kHz"
name: BW
on_value:
then:
- lambda: get_cc1101(transciver).setBW(x);
- platform: template
# if your cc1101 board is tuned for ~320MHz
# min_value: 300
# max_value: 348
# if your cc1101 board is tuned for ~433MHz
min_value: 378
max_value: 464
# if your cc1101 board is tuned for ~868Hz
# min_value: 799
# max_value: 928
step: .001
mode: box
optimistic: true
unit_of_measurement: "MHz"
name: FREQ
on_value:
then:
- lambda: get_cc1101(transciver).setFreq(x);
sensor:
- platform: custom
lambda: |-
auto my_sensor = new CC1101(
// esp8266 example
D5, // SCK
D6, // MISO
D7, // MOSI
D3, // CSN
D1, // GDO0
// esp32 example
// 18, // SCK
// 19, // MISO
// 23, // MOSI
// 5, // CSN
// 32, // GDO0
200, // bandwidth_in_khz
433.92, // freq_in_mhz
id(transmitter) // id of remote_transmitter
);
App.register_component(my_sensor);
return {my_sensor};
sensors:
id: transciver
internal: true
remote_transmitter:
- id: transmitter
pin:
number: D1 # This is GDO0
allow_other_uses: true
carrier_duty_percent: 100%
remote_receiver:
- id: receiver
pin:
number: D1 # This is GDO0
allow_other_uses: true
# on the esp8266 use any of D1,D2,D5,D6,D7,Rx
# Don't use D3,D4,D8,TX, boot often fails.
# Can't be D0 or GPIO17 b/c no interrupts
dump:
- raw
binary_sensor:
- platform: remote_receiver
name: Garage
raw:
# prettier-ignore
code: [990,-330,330,-990,990,-330,330,-990,330,-990,330,-990,330,-990,330,-990,330,-990,990,-330,330,-990,990,-330,330,-990,330,-990,330,-990,330,-990,330,-990,330,-990,990,-330,990,-330,330,-990,330,-990,990,-330,330,-990,330]
switch:
- platform: template
name: "RSSI"
entity_category: diagnostic
lambda: return get_cc1101(transciver).rssi_on;
turn_on_action:
lambda: get_cc1101(transciver).rssi_on = true;
turn_off_action:
lambda: get_cc1101(transciver).rssi_on = false;
button:
- platform: template
name: Garage
on_press:
- lambda: get_cc1101(transciver).beginTransmission();
- remote_transmitter.transmit_raw:
# prettier-ignore
code: [990,-330,330,-990,990,-330,330,-990,330,-990,330,-990,330,-990,330,-990,330,-990,990,-330,330,-990,990,-330,330,-990,330,-990,330,-990,330,-990,330,-990,330,-990,990,-330,990,-330,330,-990,330,-990,990,-330,330,-990,330]
repeat:
times: 3
wait_time: 4.733ms
- lambda: get_cc1101(transciver).endTransmission();