custom-components / weatheralerts

A sensor that gives you weather alerts from alerts.weather.gov.
MIT License
127 stars 15 forks source link

Reported state when no alert #15

Closed jazzyisj closed 5 years ago

jazzyisj commented 5 years ago

When there is no active alert sensor.weatheralerts state is reported as 'unknown'. Because of this I cannot test to see if the sensor is currently connected and active which I would like to do so I receive a notification the component has not connected for some reason.

Would it be possible to have the sensor report "None" when there are no active alerts instead of "unknown"? Seems like it would be a more intuitive value to report on the front end also.

image

ludeeus commented 5 years ago

It does report None it is the frontend that "translate" that to "unknown"

jazzyisj commented 5 years ago

Thank you for your reply, I can tell by your prolific activity on here you are a busy fellow.

I must be misunderstanding something because for example the sensor.work_holiday sensor visible in the image in my first comment actually reports "None" for a state - in the front end. I can test for "None" to see if there is a holiday, or test for "unknown" to see if the sensor state actually exists.

So with the weatheralerts sensor, how could one differentiate between no active alert and the sensor not existing and/or not being connected?

Weatheralerts Sensor connected but no active alert: image

Weatheralerts Sensor not instantiated/connected image

ludeeus commented 5 years ago

Your work_holyday sensor must be doing something wierdness, that is not the expected behavior, what you see from this sensor is, a sensor have two "modes"

Difference the tests if it exist or has no data does not make sense, to the user the result is the same, the sensor does not contain data in both scenarios