How to use the pydeconz.api.APIItems function in pydeconz

To help you get started, we’ve selected a few pydeconz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kane610 / deconz / pydeconz / sensor.py View on Github external
"""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
github Kane610 / deconz / pydeconz / group.py View on Github external
"""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:
github Kane610 / deconz / pydeconz / group.py View on Github external
"""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):
github Kane610 / deconz / pydeconz / light.py View on Github external
"""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