Adjust freedompro cover position method (#73945)

This commit is contained in:
epenet 2022-06-25 12:32:55 +02:00 committed by GitHub
parent 3743d42ade
commit 9eed8b2ef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,15 +105,13 @@ class Device(CoordinatorEntity, CoverEntity):
"""Close the cover.""" """Close the cover."""
await self.async_set_cover_position(position=0) await self.async_set_cover_position(position=0)
async def async_set_cover_position(self, **kwargs): async def async_set_cover_position(self, **kwargs: Any) -> None:
"""Async function to set position to cover.""" """Async function to set position to cover."""
payload = {} payload = {"position": kwargs[ATTR_POSITION]}
payload["position"] = kwargs[ATTR_POSITION]
payload = json.dumps(payload)
await put_state( await put_state(
self._session, self._session,
self._api_key, self._api_key,
self.unique_id, self.unique_id,
payload, json.dumps(payload),
) )
await self.coordinator.async_request_refresh() await self.coordinator.async_request_refresh()