Improve reliability and readability of sensor policy in HA agent