I’ve just been experiencing the same issue, but the solution is not simple
I have a momentary Z-wave switch which controls my blinds - I don’t know why it becomes unavailable, but it does every now and then (I didn’t do any kind of function at 8.36 in the morning)
Irrespective, when it returns it returns with the status On, which starts my automation (it’s a momentary switch)
Obviously, the ideal solution would for it not to go unavailable, but I can’t see where that is occurring, so is there any way I make the state something else when it comes back from unavailable?
Alternatively, is there any way that I can avoid it triggering on the return?