brandond / esphome-tuya_pir

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

Support for door sensors #4

Closed nunofgs closed 5 years ago

nunofgs commented 5 years ago

Hi @brandond,

Thanks for your work on this.

Are the door sensors working? What would be an example yml file?

brandond commented 5 years ago

Door sensors are working. All you really need to change from the example in pir.yaml is use device_class: door instead of motion.

nunofgs commented 5 years ago

I have both a door sensor and a PIR and couldn't flash any of them, for the life of me.

I'm 100% positive I'm connecting everything in the right pins. I've followed your README instructions to the letter but all I get is:

INFO Running:  esptool.py --before default_reset --after hard_reset --chip esp8266 --port /dev/cu.usbserial-A9M9DV3R write_flash 0x0 .build/.pioenvs/ha_pir/firmware.bin
esptool.py v2.5.1
Serial port /dev/cu.usbserial-A9M9DV3R
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP8266: Timed out waiting for packet header

Any tips on flashing this thing?

nunofgs commented 5 years ago

FYI, finally managed to flash these today. I had to order this CP2102 flasher (https://www.aliexpress.com/item/32717057832.html?spm=a2g0s.9042311.0.0.79924c4dwt4zkj) as my FTDI board simply wouldn't flash these.

Happy to report that door sensors work beautifully.

brandond commented 5 years ago

I recently burned out the original USB TTL UART adapter I was using, and had to go through a couple different adapters before I found another one that worked. I hooked them up to a scope and found that they wouldn't pull the TX line down far enough. Since it's already being pulled up by the SB1 it's got to have a pretty strong pulldown to take it close enough to 0.0v for the ESP8266 to read it. I was able to work around it temporarily with a transistor pulldown; I might write that up at some point for folks that are having trouble flashing.