view do-rf-recv.yaml @ 14:dcd981e1386b

br-air-quality has new screen layout; wifi connection blinks; etc (tr-a-q is behind)
author drewp@bigasterisk.com
date Thu, 01 Aug 2024 22:18:10 -0700
parents 7914d368d7b2
children
line wrap: on
line source

# 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_0

mqtt:
  id: mqtt_client
  broker: "mqtt2.bigasterisk.com"

light:
  - platform: status_led
    id: "status_out"
    pin: 2

remote_receiver:
  - id: rf_in
    pin:
      number: GPIO15
    tolerance: 30%
    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: ""