Tuya pir sensor tasmota questions

i have this pir sensor:

i flashed it with tasmota and followed blackadder’s instructions:

this is my config:

  - platform: mqtt
    name: "pir sensor 2"
    state_topic: "stat/pir_sensor2/POWER"
    payload_on: "ON"
    payload_off: "OFF"
    device_class: motion

I have two questions:

  1. on movement the device wakes up with power off and blast the “55AA000000010101” message, then it goes back to sleep after 2 minutes.
    home assistant never get a power off message. should i give it a timeout or something? or should it be done on tasmota side?

  2. blackadder says:

“With a static IP set and connected to Homeassistant, it takes 6 seconds to register motion. Recommend setting Homeassistant to activate on PIR connect. Waiting for the actual message takes longer.”

how do i do that?

How you flush it ?
where the wireing connected ?
i fund only “https://templates.blakadder.com/DP-WP001.html” this link

but i dont know how connect the RX TX VCC GND

the tywe3s module has mostly the same pinout as a normal 8266:

if anyone is interested my half-assed solution was a poweronstate 1, so the state turns to ON as soon as it wakes up.
then pulsetime 160 to reset it to OFF after 60 seconds.
the downside to this is the sensor will not transmit an ON state until it will go to sleep again, if there is still movement keeping it up the state will still be OFF.
but if you just need to get 1 notification then it’s ok.

I connecy RX --> RX

And get the premission denied error

what i missing ?

Using 'COM5' as serial port.
Unexpected error: ESP Chip Auto-Detection failed: Failed to connect to Espressif device: Invalid head of packet (0x83)

Man! I flashed one of these the other week. What a pain!

Is there a way around the issue where the sensor wants to turn off after being on for one minute? One minute isn’t a lot of time to make changes in Tasmota.

Rx connects to Tx and Tx to Rx.

Something else to note, if you have this particular sensor, the chip is flipped on this board. So if you’re looking at a schematic, you need to flip the pins. And I almost forgot… I had to pull the reset pin on the SGM8139 low for the flash to take.

I try iy

The port not connected

you can tell me please what the right wireing to this PIR sensor ?

That’s my wires from PIR to arduino

  1. Ignore this. I thought you needed to pull the reset pin on this chip to ground, but that just shuts the board off
  2. Reset pin on SGM8139 to ground for the entire flash
  3. TP2 is power. Connect this to VCC on your FTDI.
  4. RX on chip to TX on the FTDI
  5. TX on chip to RX on the FTDI
  6. Hook-up 6 and 7 during boot (GPIO0 to ground)

Also, I had to use Tasmotizer to get it to flash.

did you pull gpio 0 to ground on boot?
also, i usually have more luck with cp2102 not ftdi.

How did you get this thing to stay on long enough to configure it? Every time I try to feed it the template, it times out and turns off before it accepts it and reboots.

OK, I got this working. Here’s my test automation:

- id: '1581475928774'
  alias: Tuya Test
  description: ''
  - entity_id: switch.tuyapir
    from: unavailable
    platform: state
    to: 'on'
  condition: []
  - entity_id: light.desk_lamp
    service: light.turn_on
  - delay: 00:02:00
  - entity_id: light.desk_lamp
    service: light.turn_off


It might be a silly question,
but the is it not possible to use the pin header N G S V?

I tried tuya-convert but it didn’t find anything.

Possible solution. When you have received the power on, then use an automation to sent the retain option to a fake topic (i.e. tuyapirOff) to put it in HomeAss in off state ff after x-time… In your config.yaml you can use that fake topic for for topicOff in homeassistant.


I have already successfully flash this motion detector with tasmota via ota tuya-convert and so far also configured with the template.

everything works so far and I can also switch on a lamp with the detector.
the problem is until the detector reacts and the movement to the switching process it takes around 6 seconds

is it possible to speed up this time to for example 1s (keep the ESP8266 awake) and also change sleep time significantly from 2 minutes to 1 or so? perhaps with a console command in Tasmota?!

Should you do anything specific to start flashing?
I have tried but it did not show up on the list.

@Nordic,would you mind posting your final Tasmota config and your Home Assistant config for switch.tuyapir? I’m having trouble bridging that gap. It keeps showing up as a binary_sensor, rather than a switch.

Thank you for the awesome info on flashing this device. I was able to get tasmota-battery.bin on them with very little trouble thanks to you!


i have tried it several times, you have to push the device into the pairing mode and after that press the reset button again and again to keep the ESP8622 awake… for me this way works…