As DaveC mentioned you need to check if use rain sensor is being used before reading the rain sensor status. Furthermore, starting with 2.1.6, you should specifically check if the value is 1 for rain sensor (instead of checking for truthy value using JS).
I mention this because 2.1.6 will be supporting a flow sensor using the same rain sensor port and allow the user to define how the port is being used. We plan on defining which type of sensor using the urs variable. We will provide a lot more details regarding the API specifically once we get ready to release but just wanted to give you a heads up.