Keeping the lights on!

For many of you who are great automators this might seem like old hat, but today I solved a problem that has been plaguing me for months. How to keep lights on in a room that I am active in once they have been turned on by a motion detector. Initially I set up two shortcuts, one to turn the lights on (never to turn off) and a second to turn off (once motion was no longer detected). The problem I encountered was that the lights would turn off regardless of what I was doing in the room which made no sense to me. Clearly the motion detectors were not continuously sensing my activity. Today I found a solution via Homebridge using a dummy switch that appears to have solved the problem. I am far from being any sort of programmer, and had to learn a little Json to make it work, but am feeling good that I was able to make this work. For anyone else that might be interested the code for this can be found at:

Time will tell if this works long term, but it is working for now!