Use async syntax for cover platforms (#15230)

This commit is contained in:
cdce8p 2018-06-30 18:10:59 +02:00 committed by GitHub
parent 0aad056ca7
commit 3da4642194
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 74 deletions

View file

@ -5,7 +5,6 @@ For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/cover.velbus/
"""
import logging
import asyncio
import time
import voluptuous as vol
@ -70,15 +69,14 @@ class VelbusCover(CoverDevice):
self._open_channel = open_channel
self._close_channel = close_channel
@asyncio.coroutine
def async_added_to_hass(self):
async def async_added_to_hass(self):
"""Add listener for Velbus messages on bus."""
def _init_velbus():
"""Initialize Velbus on startup."""
self._velbus.subscribe(self._on_message)
self.get_status()
yield from self.hass.async_add_job(_init_velbus)
await self.hass.async_add_job(_init_velbus)
def _on_message(self, message):
import velbus