libretiny-eu/libretiny

MOES WS-B-US 2 Button Smart Switch did not create other components such as binary_sensor, light, etc. in HA?

percy10442 opened this issue · 2 comments

Why is it that after refreshing ESPhome, only two Relay components are generated, and other components like binary_sensor, light, etc., are not generated?
螢幕擷取畫面 2024-04-10 090122

esphome:
  name: upk2esphome-bk7231n
  name_add_mac_suffix: False

bk72xx:
  board: generic-bk7231n-qfn32-tuya

logger:

web_server:

captive_portal:

mdns:

api:

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:

button:
  - platform: restart
    name: Restart

debug:
  update_interval: 30s

text_sensor:
  - platform: debug
    reset_reason:
      name: Reset Reason
  - platform: libretiny
    version:
      name: LibreTiny Version

sensor:
  - platform: uptime
    name: Uptime

output:
  - platform: gpio
    id: output_led_1
    pin:
      number: P14
      inverted: true
  - platform: gpio
    id: output_led_2
    pin:
      number: P20
      inverted: true

light:
  - platform: binary
    id: light_switch_1
    output: output_led_1
  - platform: binary
    id: light_switch_2
    output: output_led_2

binary_sensor:
  - platform: gpio
    id: binary_switch_1
    pin:
      number: P23
      inverted: true
      mode: INPUT_PULLUP
    on_press:
      then:
        - switch.toggle: switch_1
  - platform: gpio
    id: binary_switch_2
    pin:
      number: P28
      inverted: true
      mode: INPUT_PULLUP
    on_press:
      then:
        - switch.toggle: switch_2

switch:
  - platform: gpio
    id: switch_1
    name: Relay 1
    pin: P24
    on_turn_on:
      - light.turn_off: light_switch_1
    on_turn_off:
      - light.turn_on: light_switch_1
  - platform: gpio
    id: switch_2
    name: Relay 2
    pin: P26
    on_turn_on:
      - light.turn_off: light_switch_2
    on_turn_off:
      - light.turn_on: light_switch_2

This has nothing to do with LibreTiny. This is completely your ESPHome config. If you don't assign a name: property to entities, they are not exposed over the API.

Understood, thank you for your clarification.