-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Code refactoring with black style formatter
- Loading branch information
Showing
2 changed files
with
94 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,37 @@ | ||
import homeassistant.helpers.config_validation as cv | ||
import voluptuous as vol | ||
from homeassistant.const import CONF_ENTITY_ID, CONF_SEQUENCE | ||
from homeassistant.helpers.typing import HomeAssistantType | ||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers.discovery import async_load_platform | ||
|
||
DOMAIN = 'vacuum_zones' | ||
DOMAIN = "vacuum_zones" | ||
PLATFORMS = ["sensor"] | ||
|
||
CONFIG_SCHEMA = vol.Schema({ | ||
DOMAIN: vol.Schema({ | ||
vol.Required(CONF_ENTITY_ID): cv.entity_id, | ||
vol.Required('zones'): { | ||
cv.string: vol.Schema({ | ||
vol.Optional('room'): vol.Any(list, int), | ||
vol.Optional('zone'): list, | ||
vol.Optional('repeats'): int, | ||
vol.Optional('goto'): list, | ||
vol.Optional(CONF_SEQUENCE): cv.SCRIPT_SCHEMA | ||
}) | ||
} | ||
}) | ||
}, extra=vol.ALLOW_EXTRA) | ||
CONFIG_SCHEMA = vol.Schema( | ||
{ | ||
DOMAIN: vol.Schema( | ||
{ | ||
vol.Required(CONF_ENTITY_ID): cv.entity_id, | ||
vol.Required("zones"): { | ||
cv.string: vol.Schema( | ||
{ | ||
vol.Optional("room"): vol.Any(list, int), | ||
vol.Optional("zone"): list, | ||
vol.Optional("repeats"): int, | ||
vol.Optional("goto"): list, | ||
vol.Optional(CONF_SEQUENCE): cv.SCRIPT_SCHEMA, | ||
} | ||
) | ||
}, | ||
} | ||
) | ||
}, | ||
extra=vol.ALLOW_EXTRA, | ||
) | ||
|
||
|
||
async def async_setup(hass: HomeAssistantType, hass_config: dict): | ||
hass.async_create_task(hass.helpers.discovery.async_load_platform( | ||
'vacuum', DOMAIN, hass_config[DOMAIN], hass_config | ||
)) | ||
async def async_setup(hass: HomeAssistant, config: dict): | ||
hass.async_create_task( | ||
async_load_platform("vacuum", DOMAIN, config[DOMAIN], config) | ||
) | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters