brandond / esphome-tuya_pir

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

Unable to add entities to HA if using api: instead of mqtt: #12

Open jivesinger opened 4 years ago

jivesinger commented 4 years ago

Hi,

Is it possible to have this communitcating exclusively using the native ESPhome api instead mqtt ?

I added api: to the esphome .yaml and I get notification of a new device in HA, but when I go to configure it, even after putting the door sensor in to pairing mode, HA complains that it can't connect. On the one occasion I did get it to connect and configure, no entities were added to HA

If mqtt: is removed from the ESPhome yaml, compile fails.

jperquin commented 4 years ago

IMG_2053 IMG_2051 IMG_2052

I managed to solder / serial flash an LSC Smart Movement Sensor (sold by Action) with the following pir.yaml, directly compiled in ESPHome on HA:

esphome:
  name: $devicename
  platform: ESP8266
  board: esp01_1m
  arduino_version: recommended
#  arduino_version: latest
#  arduino_version: dev
  board_flash_mode: dout

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

# Webserver
web_server:
  port: 80

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

sensor:
  - platform: wifi_signal
    name: ${upper_devicename} Wifi Signal
    update_interval: never
  - platform: adc
    name: ${upper_devicename} Battery
    update_interval: never
    pin: VCC

binary_sensor:
  - platform: template
    id: motion
    name: ${upper_devicename} Motion
    device_class: motion
    lambda: "return {};"

# In pir_1.yaml
substitutions:
  devicename: pir_1
  upper_devicename: PIR Sensor 1

# WiFi connection
wifi:
  networks:
  - ssid: !secret wifi_ssid
    password: !secret wifi_pw

It is not showing up on my network and so far unable to add to HA. Any suggestions?