'unavailable'
is generally meant to indicate the sensor can’t be accessed, such as due to communication errors. It means there is a value, it’s just that HA can’t currently “get” to it or retrieve it. So I don’t think that would jive very well with the usage of that term.
The Python value None
is internally converted to the string 'unknown'
when setting an entity’s state. So basically an entity’s state could never be None
.
Of course it could be 'None'
(i.e., a string), or more likely 'none'
(i.e., all lower case.) In fact, the “point in time” sensors return 'none'
when the event does not happen in the current day – when does blah happen? Well, there is none!
For the “period of time” sensors, I use 'unknown'
(which is internally represented as the Python None
object) when the period does not start, or does not end, or both, in the current day, because it doesn’t currently try to determine what the period really is, and so, to the sensor, it’s “unknown.”
If it did calculate it, then it would be either zero (if it didn’t happen during this time of year), or the total length of time it was present, since the last time it started (possibly today or on some day previously) and the next time it ends (either today or some day in the future.)
But, like I said, it was easier not to do this and just return 'unknown'
, because, again, it is unknown to the current implementation of the sensor.