Apply PR Feedback

This commit is contained in:
Oscar Calvo
2023-08-20 20:26:10 +00:00
parent 48bb6d74cf
commit 5849f884d1

View File

@@ -1,7 +1,7 @@
"""Climate device for CCM15 coordinator.""" """Climate device for CCM15 coordinator."""
import datetime import datetime
import logging import logging
from typing import Any, Optional from typing import Any
from ccm15 import CCM15Device, CCM15DeviceState, CCM15SlaveDevice from ccm15 import CCM15Device, CCM15DeviceState, CCM15SlaveDevice
import httpx import httpx
@@ -219,10 +219,9 @@ class CCM15Climate(CoordinatorEntity[CCM15Coordinator], ClimateEntity):
@property @property
def extra_state_attributes(self) -> dict[str, Any]: def extra_state_attributes(self) -> dict[str, Any]:
"""Return the optional state attributes.""" """Return the optional state attributes."""
data: Optional[CCM15SlaveDevice] = self.coordinator.get_ac_data(self._ac_index) if data := self.coordinator.get_ac_data(self._ac_index):
if data is None: return {"error_code": data.error_code}
return {} return {}
return {"error_code": data.error_code}
async def async_set_temperature(self, **kwargs: Any) -> None: async def async_set_temperature(self, **kwargs: Any) -> None:
"""Set the target temperature.""" """Set the target temperature."""