I know the state
of the sensor is being returned as a zero (the number, not the word) but HA shows a status of Unkown
rather than the zero.
Is it a “feature” that a zero is marked as Unknown? Or do I have to somehow tell HA that this is an integer and I’m not doing that correctly?
@property
def state(self):
"""Return the sensor state"""
_LOGGER.debug(
"%s returning state: %s", self.__statistic.id, self.__statistic.status
)
if not self.__statistic.status:
return None
if self.__statistic.typeName in TIMESTAMP_TYPES:
return self.__statistic.status.isoformat()
if self.__statistic.typeName == "integer":
return int(self.__statistic.status)
if self.__statistic.typeName == "float":
return float(self.__statistic.status)
return self.__statistic.status
Log:
2021-08-02 03:26:43 DEBUG (MainThread) [custom_components.nswcovid.sensor] published returning state: 2021-08-01 20:00:00+10:05
2021-08-02 03:26:43 DEBUG (MainThread) [custom_components.nswcovid.sensor] locally_active returning state: 3038
2021-08-02 03:26:43 DEBUG (MainThread) [custom_components.nswcovid.sensor] interstate_active returning state: 0
2021-08-02 03:26:43 DEBUG (MainThread) [custom_components.nswcovid.sensor] overseas_active returning state: 52