view tt-console.yaml @ 19:075b7e4854ba

wip rocks
author drewp@bigasterisk.com
date Sat, 03 Aug 2024 17:24:17 -0700
parents 5a80f3f2be8d
children
line wrap: on
line source

# mac 3c:71:bf:ab:6e:94

esphome:
  name: "tt-console"
  platform: esp32
  board: lolin32

logger:
  baud_rate: 0
  level: DEBUG
  logs:
    out: DEBUG

wifi:
  networks:
    - ssid: !secret wifi_ssid
      password: !secret wifi_password

ota:
  platform: esphome

sensor:
  - platform: wifi_signal
    name: "wifi_signal"
    update_interval: 60s

mqtt:
  id: mqtt_client
  broker: "mqtt2.bigasterisk.com"
  on_json_message:
    - topic: theater_blaster/ir_out/volume_up
      then:
        - remote_transmitter.transmit_nec:
            address: 0x4BB6
            command: 0x40BF
            repeat:
              times: !lambda |-
                if (x.containsKey("times")) {
                  return x["times"];
                }
                return 1;
    - topic: theater_blaster/ir_out/volume_down
      then:
        - remote_transmitter.transmit_nec:
            address: 0x4BB6
            command: 0xC03F
            repeat:
              times: !lambda |-
                if (x.containsKey("times")) {
                  return x["times"];
                }
                return 1;
  on_message:
    - topic: theater_blaster/ir_out
      payload: "input_bd"
      then:
        - remote_transmitter.transmit_nec:
            address: 0x4B36
            command: 0x31CE
    - topic: theater_blaster/ir_out
      payload: "input_cbl"
      then:
        - remote_transmitter.transmit_nec:
            address: 0x4BB6
            command: 0x708F
    - topic: theater_blaster/ir_out
      payload: "input_game"
      then:
        - remote_transmitter.transmit_nec:
            address: 0x4BB6
            command: 0xB04F
    - topic: theater_blaster/ir_out
      payload: "input_pc"
      then:
        - remote_transmitter.transmit_nec:
            address: 0x4BB6
            command: 0x39C6

remote_receiver:
  - id: ir_in
    # CHO1838 receiver; sig|gnd|vcc 3v3
    pin:
      number: GPIO27
      mode: INPUT
      inverted: True
    dump: nec
  - id: rf_in
    pin: GPIO13
    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]
        - mqtt.publish:
            topic: !lambda |-
              return "tt-console/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: ""
remote_transmitter:
  id: ir_out
  pin: GPIO14
  carrier_duty_percent: 50%

#13 rf recv
#12 rf send
#https://www.passion-radio.com/img/cms/wifi-kit-32-pinout.png

#on_...:
#  - remote_transmitter.transmit_nec:
#      address: 0x1234
#      command: 0x78AB

i2c:
  sda: 4
  scl: 15

font:
  - file: "/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf"
    id: font_vera
    size: 20

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    reset_pin: 16
    address: 0x3C
    lambda: |-
      it.print(128/2, 0+6, id(font_vera), TextAlign::TOP_CENTER, "big cast erisk");
      it.print(128/2, 64-6, id(font_vera), TextAlign::BOTTOM_CENTER ,"Volume 45");