afarago/esphome_component_bthome

Need help for binary door sensor

jerome83136 opened this issue · 2 comments

Hello,

I need help for configuring a binary sensor in order to watch opening status of a door

I use an esp01s as the "senso" (transmitter) and a d1mini as the "hub" (receiver)

Reading documentation; I found example of binary senso usage like this:

binary_sensor:
  - id: user_button
    on_click:
      - beethowen_transmitter.send_event: button_click
      - beethowen_transmitter.send_event:
          device_type: button
          event_type: double_click
      - beethowen_transmitter.send_event:
          device_type: dimmer
          event_type: left
          value: 3

I took a look at the available events for the "button" type:
image

But this doesn't match my use case.

I just need to send an event (ON / OFF) reflecting the state of a microswitch plugged on my esp01s; to a central hub, over ESP-NOW (because my sensors are running on battery; so I need to take care of power consumption)

It seems there are a lot of "binary sensors" related to this on BThome format:
image

I tried with this config:
image

But: what are the available "event types" for a "door binary sensor" ?

Thank you very much for your help

Best regards

Anyone to help here please?

Hi,

I don't know if this is the right way to to it; but I was able to achieve it by doing this:

Transmitter:

beethowen_transmitter:
  id: buanderie
  connect_persistent: true
  sensors:
    - measurement_type: generic_boolean
      sensor_id: fenetre01
  auto_send: false

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO2
      mode: INPUT_PULLUP
      inverted: true
    filters:
      - delayed_on: 25ms
      - delayed_off: 25ms
    id: fenetre01
    on_press:
    - beethowen_transmitter.send: true
    on_release:
    - beethowen_transmitter.send: false

Receiver:

beethowen_receiver:
  dump: unmatched
  devices:
    - mac_address: "***MAC_ADDRESS***"
      name_prefix: buanderie
      dump: all

binary_sensor:
  - platform: beethowen_receiver
    mac_address: "***MAC_ADDRESS***"
    sensors:
      - measurement_type: generic_boolean
        id: fenetre01
        name: fenetre01

I hope it will be usefull for others :)