comparison do-rf-recv.yaml @ 2:717d5b5e0d7d

add first board
author drewp@bigasterisk.com
date Thu, 27 Jun 2024 14:00:44 -0700
parents
children 711019bc4357
comparison
equal deleted inserted replaced
1:f340f7a559de 2:717d5b5e0d7d
1 # 433mhz receiver board. Facing the board:
2 # pins: 3v3 | N.C. (cs) | D15 | gnd
3
4 esphome:
5 # note for historical reasons, this doesn't match the mqtt topic
6 name: "do-rf-recv"
7 platform: esp32
8 board: lolin32
9
10 logger:
11 level: INFO
12
13 wifi:
14 networks:
15 - ssid: !secret wifi_ssid
16 password: !secret wifi_password
17
18 ota:
19 platform: esphome
20 password: !secret ota_password
21
22 mqtt:
23 id: mqtt_client
24 broker: "mqtt2.bigasterisk.com"
25 port: 1883
26
27 light:
28 - platform: status_led
29 id: "status_out"
30 pin: 2
31
32 remote_receiver:
33 - id: rf_in
34 pin:
35 number: GPIO15
36 tolerance: 20%
37 filter: 250us
38 idle: 8ms
39 dump: rc_switch
40 on_rc_switch:
41 then:
42 # - logger.log:
43 # level: INFO
44 # tag: out
45 # format: "RF read; proto %d; code %08llx"
46 # args: [x.protocol, x.code]
47 - light.turn_on:
48 id: status_out
49 flash_length: 30ms
50 # legacy mode- read by nodered
51 - mqtt.publish_json:
52 topic: rf_switch_desk/rf_received
53 payload: !lambda |-
54 root["protocol"] = x.protocol;
55 root["code0"] = static_cast<unsigned long>(x.code >> 32);
56 root["code1"] = static_cast<unsigned long>(x.code & 0xffff);
57 - mqtt.publish:
58 topic: !lambda |-
59 return "rf_switch_desk/rf_received/" +
60 std::to_string(x.protocol) +
61 "/" + std::to_string(static_cast<unsigned long>(x.code >> 32)) +
62 "/" + std::to_string(static_cast<unsigned long>(x.code & 0xffff));
63 payload: ""