HomeKit integration breaks approximately every day

Ok thanks! So I have to create a virtual switch to the command that rule to run? After that Driver Code is installed.

I tried doing that and I am still not able to select device in the variables list.
I tried running the device and it doesnt seem to be working. I am not sure where I went wrong.. I am guessing I am doing something wrong when setting up the virtual device.