Usoing dummy switch to control switch automation

Hi,
I am migrating from Domoticz and I need help with setting up one of the scripts I did.

Devices included:
Zwave PIR motion detector
Zwave light switch
Kodi player
Dummy control switch

Here is the script and the issue I am having:
Script:
When the PIR detects motion, it will turn on the light switch.
The script detects if the Dummy control switch is off. If it is off, the lights will go on,.

When I play a movie from Kodi, the Play status turns On the Dummy control switch to ON, and the Lights to Off. While the movie plays, the motion detection will not turn the lights on.

When the movie Stops, the Kodi command triggers the Dummy control to go off, and the lights to go on.

I created a boolean Helper switch to be my Dummy control switch. I tested my automation script by manually modifying the dummy status, but the script failed to detect the Dummy status, and the lights always go on motion.

Any suggestions on how to handle this script?

Thanks,

Please post your script.