simple action trigger when motion is detected using MotionSensor
this script is made on wokwi.com and then tested with real life example
Link to diagram can be found here. Link might be invalid, so you can visit webpage wokwi.com and import this diagram and script yourself