mirror of
https://github.com/smkrv/ha-text-ai.git
synced 2026-07-29 04:43:56 +08:00
Release v2.0.0
This commit is contained in:
@@ -100,19 +100,11 @@ class HATextAISensor(CoordinatorEntity, SensorEntity):
|
|||||||
return dt_util.as_local(last_response['timestamp'])
|
return dt_util.as_local(last_response['timestamp'])
|
||||||
return self._current_state
|
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
|
@property
|
||||||
def extra_state_attributes(self) -> Dict[str, Any]:
|
def extra_state_attributes(self) -> Dict[str, Any]:
|
||||||
"""Return entity specific state attributes."""
|
"""Return entity specific state attributes."""
|
||||||
attributes = {
|
attributes = {
|
||||||
ATTR_TOTAL_RESPONSES: 0,
|
ATTR_TOTAL_RESPONSES: len(self.coordinator._history),
|
||||||
ATTR_MODEL: self.coordinator.model,
|
ATTR_MODEL: self.coordinator.model,
|
||||||
ATTR_API_STATUS: self._current_state,
|
ATTR_API_STATUS: self._current_state,
|
||||||
ATTR_ERROR_COUNT: self._error_count,
|
ATTR_ERROR_COUNT: self._error_count,
|
||||||
|
|||||||
Reference in New Issue
Block a user