Velbus code cleanup (#97584)

* Some cleanup and code improvements for the velbus integration

* Comments

* More comments

* Update homeassistant/components/velbus/entity.py

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* More comments

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
Maikel Punie 2023-08-06 19:12:19 +02:00 committed by GitHub
parent 6bc5b8989d
commit 0535578440
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 52 additions and 18 deletions

View file

@ -15,7 +15,7 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN
from .entity import VelbusEntity
from .entity import VelbusEntity, api_call
async def async_setup_entry(
@ -81,18 +81,22 @@ class VelbusCover(VelbusEntity, CoverEntity):
return 100 - pos
return None
@api_call
async def async_open_cover(self, **kwargs: Any) -> None:
"""Open the cover."""
await self._channel.open()
@api_call
async def async_close_cover(self, **kwargs: Any) -> None:
"""Close the cover."""
await self._channel.close()
@api_call
async def async_stop_cover(self, **kwargs: Any) -> None:
"""Stop the cover."""
await self._channel.stop()
@api_call
async def async_set_cover_position(self, **kwargs: Any) -> None:
"""Move the cover to a specific position."""
await self._channel.set_position(100 - kwargs[ATTR_POSITION])