How to handle unknown or unavailable states in template entities or automations