From bde856c576473196d8ff13914cc8852d6559b8ff Mon Sep 17 00:00:00 2001 From: SMKRV Date: Sun, 24 Nov 2024 01:18:09 +0300 Subject: [PATCH] Release v2.0.0 --- custom_components/ha_text_ai/sensor.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/custom_components/ha_text_ai/sensor.py b/custom_components/ha_text_ai/sensor.py index 0808764..3e15f1d 100644 --- a/custom_components/ha_text_ai/sensor.py +++ b/custom_components/ha_text_ai/sensor.py @@ -100,19 +100,11 @@ class HATextAISensor(CoordinatorEntity, SensorEntity): return dt_util.as_local(last_response['timestamp']) return self._current_state - @property - def state(self) -> StateType: - """Return the state of the sensor.""" - last_response = self.coordinator.last_response - if last_response and 'timestamp' in last_response: - return dt_util.as_local(last_response['timestamp']) - return self._current_state - @property def extra_state_attributes(self) -> Dict[str, Any]: """Return entity specific state attributes.""" attributes = { - ATTR_TOTAL_RESPONSES: 0, + ATTR_TOTAL_RESPONSES: len(self.coordinator._history), ATTR_MODEL: self.coordinator.model, ATTR_API_STATUS: self._current_state, ATTR_ERROR_COUNT: self._error_count,