Skip to content
Snippets Groups Projects
Commit c81a5de2 authored by KERDREUX Jerome's avatar KERDREUX Jerome
Browse files

Format stuff

parent 0cc0a1c8
No related branches found
No related tags found
1 merge request!1First try of type hints
import asyncio
import functools
import logging
from typing import Any, Dict, List
from typing import Dict, List, Any
from .const import DOMAIN
from . import utils
from homeassistant.core import HomeAssistant, Event
from homeassistant.helpers.entity import Entity, DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers import device_registry
from homeassistant.helpers.device_registry import DeviceEntry, EVENT_DEVICE_REGISTRY_UPDATED
from homeassistant.helpers import entity_registry
from homeassistant.core import Event, HomeAssistant
from homeassistant.helpers import device_registry, entity_registry
from homeassistant.helpers.device_registry import EVENT_DEVICE_REGISTRY_UPDATED, DeviceEntry
from homeassistant.helpers.entity import DeviceInfo, Entity
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.entity_registry import EVENT_ENTITY_REGISTRY_UPDATED
from xaal.lib import AsyncEngine, tools, Device, Message, bindings
from xaal.lib import AsyncEngine, Device, Message, bindings, tools
from xaal.monitor import Monitor, Notification
from xaal.monitor.monitor import Device as MonitorDevice
import logging
from . import utils
from .const import DOMAIN
_LOGGER = logging.getLogger(__name__)
UNSUPPORTED_TYPES = ['cli', 'hmi', 'logger']
......
......@@ -4,12 +4,15 @@ import voluptuous as vol
DOMAIN = "xaal"
CONF_DB_SERVER = "db_server"
XAAL_TTS_SCHEMA = vol.Schema({
vol.Optional("title"): cv.template,
vol.Required("message"): cv.template,
})
XAAL_TTS_SCHEMA = vol.Schema({
vol.Required("message"): cv.template,
})
XAAL_TTS_SCHEMA = vol.Schema(
{
vol.Optional("title"): cv.template,
vol.Required("message"): cv.template,
}
)
XAAL_TTS_SCHEMA = vol.Schema(
{
vol.Required("message"): cv.template,
}
)
import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP_KELVIN,
ATTR_HS_COLOR,
ColorMode,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.components.light import LightEntity, ColorMode, ATTR_BRIGHTNESS, ATTR_HS_COLOR, ATTR_COLOR_TEMP_KELVIN
from .bridge import XAALEntity, async_setup_factory
_LOGGER = logging.getLogger(__name__)
async def async_setup_entry(hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddEntitiesCallback) -> None:
async def async_setup_entry(
hass: HomeAssistant, config_entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
binding = {'lamp.': [Lamp]}
return async_setup_factory(hass, config_entry, async_add_entities, binding)
......@@ -47,7 +53,7 @@ class Lamp(XAALEntity, LightEntity):
def hs_color(self) -> tuple[float, float] | None:
hsv = self.get_attribute('hsv')
if hsv:
return (hsv[0], hsv[1]*100)
return (hsv[0], hsv[1] * 100)
@property
def color_temp_kelvin(self) -> int | None:
......
[tool.ruff]
line-length = 110
[tool.ruff.format]
quote-style = "preserve"
[tool.black]
line-length = 110
skip-string-normalization = true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment