brandond / esphome-tuya_pir

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

Additional device support #13

Open beardypig opened 4 years ago

beardypig commented 4 years ago

I have it running on a slightly different device, a LSC Smart Door Sensor, but the protocol appears to be the same. However, the reed switch state change is inverted and the event_type is 0x0101. I could submit a PR if you are interested in supporting the extra device.

I knew a few people are interested in the LSC Door Sensors because you can get them in the Dutch budget store Action for less than €10. You have done 99.9% of the work to support these devices too :)

nicovankampen commented 4 years ago

@beardypig : Hi, i flashed the same sensor. I am missing the door open and close mqtt messages. might that be because of the different event type you mention? If so, which line do i change in the sb1_uart.h file? enum SB1EventType : SB1_EVENT_TYPE_DOOR = 0x0104, SB1_EVENT_TYPE_MOTION = 0x6501, SB1_EVENT_TYPE_DOOR_RESET = 0x6504, SB1_EVENT_TYPE_MOTION_RESET = 0x6604

nicovankampen commented 4 years ago

obviously one of the two door lines...... ;-) or both?

beardypig commented 4 years ago

@nicovankampen my IDE messed up all the formatting on the file so I need to clean it up before I can PR the changes, but this gist has the complete file: https://gist.github.com/beardypig/38f9f2d6533ffd274b3b2aad0aa523a8

In the end it's only a couple of small changes.

nicovankampen commented 4 years ago

@beardypig : thanks ! Got i all working now. At first it didn't work but then i found that ESPhome makes copies of SB1_uart in 3 different folders! (very confusing). Replaced all 3 off them. Only thing left now is finding out how to make the binary_sensor always available showing one of two states always.

beardypig commented 4 years ago

The example door esphome config works pretty well. The important bit being that you use MQTT with empty birth, will and shutdown messages.