How to make a fabricator run on gas or electricity

I use a timer like so (because it wasn’t unpowering when the generator was turned off)

I’ve also updated my event and function now that I’ve had more time to play with it.

I moved the set is powered false to the beginning of the Check function