Implement Elmax cover platform (#79409)

* Implement Elmax cover platform.

* Reduce the number of code lines by leveraging the := operator

* Move _COMMAND_BY_MOTION_STATUS declaration at the top

* Remove redundant null-check

* Move conditional platform setup logic into the platform itself

* Remove redundant log

* Change log severity for stop request on IDLE cover state

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
Alberto Geniola 2023-08-05 22:03:51 +02:00 committed by GitHub
parent 2e8e5aabae
commit e5261fe2a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 146 additions and 1 deletions

View file

@ -16,6 +16,7 @@ from elmax_api.exceptions import (
from elmax_api.http import Elmax
from elmax_api.model.actuator import Actuator
from elmax_api.model.area import Area
from elmax_api.model.cover import Cover
from elmax_api.model.endpoint import DeviceEndpoint
from elmax_api.model.panel import PanelEntry, PanelStatus
@ -80,6 +81,12 @@ class ElmaxCoordinator(DataUpdateCoordinator[PanelStatus]):
return self._state_by_endpoint[area_id]
raise HomeAssistantError("Unknown area")
def get_cover_state(self, cover_id: str) -> Cover:
"""Return state of a specific cover."""
if self._state_by_endpoint is not None:
return self._state_by_endpoint[cover_id]
raise HomeAssistantError("Unknown cover")
@property
def http_client(self):
"""Return the current http client being used by this instance."""