Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""Python library to connect deCONZ and Home Assistant to work together."""
import logging
from .api import APIItems
from .deconzdevice import DeconzDevice
_LOGGER = logging.getLogger(__name__)
URL = "/sensors"
class Sensors(APIItems):
"""Represent deCONZ sensors."""
def __init__(self, raw, request):
super().__init__(raw, request, URL, create_sensor)
class DeconzSensor(DeconzDevice):
"""deCONZ sensor representation.
Dresden Elektroniks documentation of sensors in deCONZ
http://dresden-elektronik.github.io/deconz-rest-doc/sensors/
"""
DECONZ_TYPE = "sensors"
BINARY = None
"""Sync color state with light."""
self.update(
{
"action": {
"bri": light.brightness,
"hue": light.hue,
"sat": light.sat,
"ct": light.ct,
"xy": light.xy or (None, None),
"colormode": light.colormode,
}
}
)
class Scenes(APIItems):
"""Represent scenes of a deCONZ group."""
def __init__(self, group, request):
self.group = group
url = f"{URL}/{group.device_id}/scenes"
super().__init__(group.raw["scenes"], request, url, DeconzScene)
def process_raw(self, raw: list) -> None:
""""""
for raw_item in raw:
id = raw_item["id"]
obj = self._items.get(id)
if obj is not None:
obj.raw = raw_item
else:
"""Python library to connect deCONZ and Home Assistant to work together."""
import logging
from pprint import pformat
from .api import APIItems
from .deconzdevice import DeconzDevice
_LOGGER = logging.getLogger(__name__)
URL = "/groups"
class Groups(APIItems):
"""Represent deCONZ groups."""
def __init__(self, raw, request):
super().__init__(raw, request, URL, DeconzGroup)
class DeconzGroup(DeconzDevice):
"""deCONZ light group representation.
Dresden Elektroniks documentation of light groups in deCONZ
http://dresden-elektronik.github.io/deconz-rest-doc/groups/
"""
DECONZ_TYPE = "groups"
def __init__(self, device_id, raw, request):
"""Python library to connect deCONZ and Home Assistant to work together."""
import logging
from .api import APIItems
from .deconzdevice import DeconzDevice
_LOGGER = logging.getLogger(__name__)
URL = "/lights"
class Lights(APIItems):
"""Represent deCONZ lights."""
def __init__(self, raw, request):
super().__init__(raw, request, URL, DeconzLight)
class DeconzLight(DeconzDevice):
"""deCONZ light representation.
Dresden Elektroniks documentation of lights in deCONZ
http://dresden-elektronik.github.io/deconz-rest-doc/lights/
"""
DECONZ_TYPE = "lights"
@property