Set state motion sensor

Hi guys! Absolute newbie to HA here, just trying to make my home a little smarter one step at a time :slight_smile:
I’ve read a ton of topics on this forum on this subject (especially this one seems relevant: How to manually set state/value of sensor? - #9 by rodpayne), but I just cannot seem to make it work.

I recently bought a tuya based smart motion sensor (from Kruidvat in the Netherlands). What I want to do is have the motion sensor trigger certain RGB lights in the bedroom. This works in the Tuya app (which is otherwise very limited regarding timing), but I want this done in HA (thus giving me more options). Motion is detected as it should according to the Tuya app (motion is detected and then immediately rectified so that new motion can be detected)

I have succesfully added the motion sensor to HA, but the sensor is constantly stuck in a ‘detected’ state and thus does not trigger the automation I want. I can manually set the state to ‘none’ in the developer options, but this only works once (until motion is detected).

According to the aforementioned topic, it should be possible to force the state of the motion sensor to ‘none’ (or ‘off’) after a set time (say 2 seconds) by means of a python script. However, as a newbie, all this information is rather overwhelming and I have no idea how to run the script and automations as set out in the abovementioned topic.

Thus far, I have been able to activate python scripts in the config.yaml and I have copied the text of the script in a new file and saved in the relevant folder (I run HA via docker on Synology). After this, I am completely lost as I havent been able to make the automation work despite trying for several hours.

Is there somebody who could help me step-by-step to get this to work? Any help would be greatly appreciated!

Hi, welcome to the forum!

Stuck, even if there is no motion?

Thanks!

Yes, correct. So if I manually set the sensor to ‘none’, it detects motion once and then remains stuck on ‘detected’ until I manually set the sensor back. The Tuya app does not have this problem, so I assume its something to do with HA

This is not normal behavior and probably between Tuya (cloud) and HA.
How did you integrate Tuya into HA?

I think you can, in your automation, set the state but someone else has to confirm (or not) if that’s correct.

I integrated the same way as I integrated all my smart sockets (also Tuya based): add them to the Tuya app (which is linked with HA) and HA automatically picks it up

I did experiment a little with automations and I can set the state of the motion sensor as a trigger, but I do not know how I can reverse the state of the motion sensor throught the actions menu.

There are different ways to integrate (link) Tuya into HA.
TBH I don’t think I can help you any further but maybe that information is crucial for someone who can.

Tuya is a PITA in my opinion and I steered away from it.
I know, the devices are dirt cheap and almost available like a can of soda out of a beverage dispenser but…
Just my opinion.