Almost got this nailed down, but now just struggling to send the RF signal when the reed is opened.
The objective is simply when the reed switch is closed, deep sleep is entered. When the reed switch open, wake from deep sleep and send the code with the RF 433mhz transmitter.
Trying to use the on_press function for this but it does not like it.
Also, I may need a delay to send when waking from deep_sleep?
Any ideas?
Thanks
binary_sensor:
- platform: gpio
pin:
number: GPIO27
mode:
input: True
pullup: True
inverted: False
allow_other_uses: True
name: mail
filters:
- delayed_on: 25ms
- delayed_off: 500ms
on_press:
then:
- platform: remote_receiver
name: Garage
raw:
code: [415,-300,370,-300,375,-300,378,-300,378,-300,379,-300,405]
on_release:
then:
# switch relais?
# led blink with repeat action etc?
# delay to complete
- deep_sleep.enter: mail
deep_sleep:
id: mail
#run_duration: 2min
#sleep_duration: 1min
wakeup_pin:
number: GPIO27
allow_other_uses: True
sensor:
- platform: custom
lambda: |-
auto my_sensor = new CC1101(
18, // SCK
19, // MISO
23, // MOSI
5, // CSN
32, // GDO0
33, // GDO2
200, // bandwidth_in_khz
433.92 // freq_in_mhz
);
App.register_component(my_sensor);
return {my_sensor};
sensors:
id: transciver
internal: true
remote_transmitter:
- pin: GPIO32 # This is GDO0
carrier_duty_percent: 100%
remote_receiver:
- pin: GPIO33 # This is GDO2
# 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
button:
- platform: template
name: Garage
on_press:
- lambda: get_cc1101(transciver).beginTransmission();
- remote_transmitter.transmit_raw:
code: [415,-300,370,-300,375,-300,378,-300,378,-300,379,-300,405]
repeat:
times: 10
wait_time: 10ms
- lambda: get_cc1101(transciver).endTransmission();