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:
parent
6bc5b8989d
commit
0535578440
8 changed files with 52 additions and 18 deletions
|
@ -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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue