How to use the pytradfri.const.ATTR_DEVICE_STATE function in pytradfri

To help you get started, we’ve selected a few pytradfri 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 ggravlingen / pytradfri / tests / test_device.py View on Github external
],
        [
            "set_dimmer", "with_transitiontime", {
                'dimmer': 200,
                'transition_time': 2
            }, {
                ATTR_LIGHT_DIMMER: 200,
                ATTR_TRANSITION_TIME: 2
            },
        ],

        [
            "set_state", "true", {
                'state': True,
            }, {
                ATTR_DEVICE_STATE: True,
            },
        ],
        [
            "set_state", "false", {
                'state': False,
            }, {
                ATTR_DEVICE_STATE: False,
            },
        ],

        [
            "set_hex_color", "valid", {
                'color': '4a418a',
            }, {
                ATTR_LIGHT_COLOR_HEX: '4a418a',
            },
github ggravlingen / pytradfri / pytradfri / device.py View on Github external
def set_state(self, state, *, index=0):
        """Set state of a socket."""
        return self.set_values({
            ATTR_DEVICE_STATE: int(state)
        }, index=index)
github ggravlingen / pytradfri / pytradfri / group.py View on Github external
def state(self):
        """Boolean representing the light state of the group."""
        return self.raw.get(ATTR_DEVICE_STATE) == 1
github ggravlingen / pytradfri / pytradfri / device.py View on Github external
def state(self):
        return self.raw.get(ATTR_DEVICE_STATE) == 1
github ggravlingen / pytradfri / pytradfri / smart_task.py View on Github external
def state(self):
        """Return state of start action task."""
        return self.raw.get(ATTR_DEVICE_STATE)
github ggravlingen / pytradfri / pytradfri / smart_task.py View on Github external
def set_dimmer(self, dimmer):
        """Set final dimmer value for task."""
        command = {
            ATTR_START_ACTION: {
                    ATTR_DEVICE_STATE: self.state,
                    ROOT_START_ACTION: [{
                        ATTR_ID: self.raw[ATTR_ID],
                        ATTR_LIGHT_DIMMER: dimmer,
                        ATTR_TRANSITION_TIME: self.raw[ATTR_TRANSITION_TIME]
                    }, self.devices_dict]
                }
            }
        return self.set_values(command)
github ggravlingen / pytradfri / pytradfri / group.py View on Github external
def set_state(self, state):
        """Set state of a group."""
        return self.set_values({
            ATTR_DEVICE_STATE: int(state)
        })