While you can determine if the zwave device is reachable in HA, see this post
If you can’t reach the device you can’t turn it off.
I use linktap and it works well. When you command it on you give it a duration, once that duration expires regardless of connection status it turns off.