changeset 2:717d5b5e0d7d

add first board
author drewp@bigasterisk.com
date Thu, 27 Jun 2024 14:00:44 -0700
parents f340f7a559de
children 711019bc4357
files do-rf-recv.yaml
diffstat 1 files changed, 63 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/do-rf-recv.yaml	Thu Jun 27 14:00:44 2024 -0700
@@ -0,0 +1,63 @@
+# 433mhz receiver board. Facing the board:
+#  pins: 3v3  | N.C. (cs)  | D15   | gnd
+
+esphome:
+  # note for historical reasons, this doesn't match the mqtt topic
+  name: "do-rf-recv"
+  platform: esp32
+  board: lolin32
+
+logger:
+  level: INFO
+
+wifi:
+  networks:
+    - ssid: !secret wifi_ssid
+      password: !secret wifi_password
+
+ota:
+  platform: esphome
+  password: !secret ota_password
+
+mqtt:
+  id: mqtt_client
+  broker: "mqtt2.bigasterisk.com"
+  port: 1883
+
+light:
+  - platform: status_led
+    id: "status_out"
+    pin: 2
+
+remote_receiver:
+  - id: rf_in
+    pin:
+      number: GPIO15
+    tolerance: 20%
+    filter: 250us
+    idle: 8ms
+    dump: rc_switch
+    on_rc_switch:
+      then:
+        #        - logger.log:
+        #            level: INFO
+        #            tag: out
+        #            format: "RF read; proto %d; code %08llx"
+        #            args: [x.protocol, x.code]
+        - light.turn_on:
+            id: status_out
+            flash_length: 30ms
+        # legacy mode- read by nodered
+        - mqtt.publish_json:
+            topic: rf_switch_desk/rf_received
+            payload: !lambda |-
+              root["protocol"] = x.protocol;
+              root["code0"] = static_cast<unsigned long>(x.code >> 32);
+              root["code1"] = static_cast<unsigned long>(x.code & 0xffff);
+        - mqtt.publish:
+            topic: !lambda |-
+              return "rf_switch_desk/rf_received/" + 
+                std::to_string(x.protocol) +
+                "/" + std::to_string(static_cast<unsigned long>(x.code >> 32)) +
+                "/" + std::to_string(static_cast<unsigned long>(x.code & 0xffff));
+            payload: ""