esphome:
  name: upk2esphome-bk7231n

bk72xx:
  board: generic-bk7231n-qfn32-tuya

logger:

web_server:

captive_portal:

mdns:

api:
  encryption:
    key: ""

ota:
  platform: esphome
  password: !secret ota

wifi:
  ssid: Suchodupin_IoT_2G
  password: CEC0E76B
  ap:

text_sensor:
  - platform: libretiny
    version:
      name: LibreTiny Version
  - platform: template
    id: tuya_pir_state
    name: (Unconfirmed) Pir State
    filters:
      - map:
          - 0 -> Pir
          - 1 -> None
  - platform: template
    id: tuya_battery_state
    name: (Unconfirmed) Battery State
    filters:
      - map:
          - 0 -> Low
          - 1 -> Middle
          - 2 -> High

uart:
  rx_pin: RX1
  tx_pin: TX1
  baud_rate: 9600

tuya:
  # DPIDs processed from schema model: esi4xk
  on_datapoint_update:
    - sensor_datapoint: 1
      datapoint_type: enum
      then:
        - text_sensor.template.publish:
            id: tuya_pir_state
            state: !lambda "return std::to_string(x);"
    - sensor_datapoint: 3
      datapoint_type: enum
      then:
        - text_sensor.template.publish:
            id: tuya_battery_state
            state: !lambda "return std::to_string(x);"
