brandond / esphome-tuya_pir

ESPHome support for cheap WiFi PIR sensors
66 stars 22 forks source link

MQTT required? #23

Open TheFes opened 3 years ago

TheFes commented 3 years ago

Is MQTT required to have the door sensor working in Home Assistant? I would expect that the binary sensor is exposed to HA, and the status of the binary sensor could be used to trigger automations.

In case it is not required, would the code then also work without the custom component? So something like this?

esphome:
  name: door
  platform: ESP8266
  board: esp01_1m
  arduino_version: 2.5.1
  board_flash_mode: dout

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_pass
  fast_connect: true

uart:
  - tx_pin: 1
    rx_pin: 3
    baud_rate: 9600
    id: uart0

ota:

logger:
  level: INFO
  hardware_uart: UART1

sensor:
  - platform: wifi_signal
    name: "Door WiFi Signal"
    update_interval: 60s
  - platform: adc
    name: "Door Battery"
    update_interval: 60s
    pin: VCC

binary_sensor:
  - platform: template
    id: door
    name: "Door Closure"
    filters: []
    device_class: door
    lambda: "return {};"
simonk1969 commented 2 years ago

I'm interested in this also as I'd prefer to not have to use MQTT and just the ESPHome integration.

RamjetX commented 1 year ago

From reading the readme. The co-processor that does all of the power management waits for the ESP to tell it that it's connected to the MQTT server before passing on the PIR event.

It seems the co-processor is 90% of the problem here. You could technically bypass the co processor, but you'd lose the energy efficiency for running on batteries.

At that point... just use a wemos d1 or similar board with a cheap PIR and run it off USB somewhere in the house.

Until I figure out how to compile this older code on 2023 ESPHome environment, I'm probably going to abandon this device in favour of making my own with a generic esp dev board and 3D print a nice enclosure instead.