Thats what I tried to do in the first part by setting the global var to the previous state. Because Click_Counter_Door1 is a string I am having trouble incrementing this value even with casting it to a Number or Integer.
You don’t need previousState. Restore on startup will do that for you automatically at system boot time, that’s what it is for.
Then make it a number type Item.
If you have trouble, post your rule code and the error message.
EDIT - I should add that changing the type of an existing Item (e.g. String to Number) can cause problems if it has already been persisted as one type. That might have something to do with your original difficulties, and might come around again. Try making a brand new Number Item, persist it, restore it, have your rule deal with NULL case for first time use.