Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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):
"""Set initial information about light group.
Create scenes related to light group.
"""
super().__init__(device_id, raw, request)
self._scenes = Scenes(self, request)
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
ZHATYPE = set()
@property
def battery(self):
"""The battery status of the sensor."""
return self.raw["config"].get("battery")
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
def state(self):
"""True if the light is on."""
return self.raw["state"].get("on")
@property
def alert(self):
"""Temporary alert effect.