How to use the pytradfri.group.Group 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_group.py View on Github external
.set_hex_color('c984bb')
    assert cmd.data == {'5706': 'c984bb'}

    cmd = Group('anygateway', GROUP) \
        .set_predefined_color('Candlelight', 100)
    assert cmd.data == {'5712': 100, '5706': 'ebb63e'}

    cmd = Group('anygateway', GROUP) \
        .set_xy_color(200, 45000)
    assert cmd.data == {'5709': 200, '5710': 45000}

    cmd = Group('anygateway', GROUP) \
        .set_color_temp(300)
    assert cmd.data == {ATTR_LIGHT_MIREDS: 300}

    cmd = Group('anygateway', GROUP) \
        .set_hsb(300, 200, 100)
    assert cmd.data == {
        ATTR_LIGHT_COLOR_HUE: 300,
        ATTR_LIGHT_COLOR_SATURATION: 200,
        ATTR_LIGHT_DIMMER: 100,
    }
github ggravlingen / pytradfri / tests / test_group.py View on Github external
def test_setters():
    cmd = Group('anygateway', GROUP) \
        .set_predefined_color('Candlelight')
    assert cmd.data == {'5706': 'ebb63e'}

    with pytest.raises(error.ColorError):
        Group('anygateway', GROUP) \
            .set_predefined_color('kjlisby')

    cmd = Group('anygateway', GROUP) \
        .set_hex_color('c984bb')
    assert cmd.data == {'5706': 'c984bb'}

    cmd = Group('anygateway', GROUP) \
        .set_predefined_color('Candlelight', 100)
    assert cmd.data == {'5712': 100, '5706': 'ebb63e'}

    cmd = Group('anygateway', GROUP) \
        .set_xy_color(200, 45000)
    assert cmd.data == {'5709': 200, '5710': 45000}

    cmd = Group('anygateway', GROUP) \
        .set_color_temp(300)
github ggravlingen / pytradfri / tests / test_group.py View on Github external
Group('anygateway', GROUP) \
            .set_predefined_color('kjlisby')

    cmd = Group('anygateway', GROUP) \
        .set_hex_color('c984bb')
    assert cmd.data == {'5706': 'c984bb'}

    cmd = Group('anygateway', GROUP) \
        .set_predefined_color('Candlelight', 100)
    assert cmd.data == {'5712': 100, '5706': 'ebb63e'}

    cmd = Group('anygateway', GROUP) \
        .set_xy_color(200, 45000)
    assert cmd.data == {'5709': 200, '5710': 45000}

    cmd = Group('anygateway', GROUP) \
        .set_color_temp(300)
    assert cmd.data == {ATTR_LIGHT_MIREDS: 300}

    cmd = Group('anygateway', GROUP) \
        .set_hsb(300, 200, 100)
    assert cmd.data == {
        ATTR_LIGHT_COLOR_HUE: 300,
        ATTR_LIGHT_COLOR_SATURATION: 200,
        ATTR_LIGHT_DIMMER: 100,
    }
github ggravlingen / pytradfri / tests / test_group.py View on Github external
.set_predefined_color('Candlelight')
    assert cmd.data == {'5706': 'ebb63e'}

    with pytest.raises(error.ColorError):
        Group('anygateway', GROUP) \
            .set_predefined_color('kjlisby')

    cmd = Group('anygateway', GROUP) \
        .set_hex_color('c984bb')
    assert cmd.data == {'5706': 'c984bb'}

    cmd = Group('anygateway', GROUP) \
        .set_predefined_color('Candlelight', 100)
    assert cmd.data == {'5712': 100, '5706': 'ebb63e'}

    cmd = Group('anygateway', GROUP) \
        .set_xy_color(200, 45000)
    assert cmd.data == {'5709': 200, '5710': 45000}

    cmd = Group('anygateway', GROUP) \
        .set_color_temp(300)
    assert cmd.data == {ATTR_LIGHT_MIREDS: 300}

    cmd = Group('anygateway', GROUP) \
        .set_hsb(300, 200, 100)
    assert cmd.data == {
        ATTR_LIGHT_COLOR_HUE: 300,
        ATTR_LIGHT_COLOR_SATURATION: 200,
        ATTR_LIGHT_DIMMER: 100,
    }
github ggravlingen / pytradfri / tests / test_group.py View on Github external
def test_setters():
    cmd = Group('anygateway', GROUP) \
        .set_predefined_color('Candlelight')
    assert cmd.data == {'5706': 'ebb63e'}

    with pytest.raises(error.ColorError):
        Group('anygateway', GROUP) \
            .set_predefined_color('kjlisby')

    cmd = Group('anygateway', GROUP) \
        .set_hex_color('c984bb')
    assert cmd.data == {'5706': 'c984bb'}

    cmd = Group('anygateway', GROUP) \
        .set_predefined_color('Candlelight', 100)
    assert cmd.data == {'5712': 100, '5706': 'ebb63e'}

    cmd = Group('anygateway', GROUP) \
        .set_xy_color(200, 45000)
    assert cmd.data == {'5709': 200, '5710': 45000}

    cmd = Group('anygateway', GROUP) \
        .set_color_temp(300)
    assert cmd.data == {ATTR_LIGHT_MIREDS: 300}

    cmd = Group('anygateway', GROUP) \
github ggravlingen / pytradfri / pytradfri / gateway.py View on Github external
def process_result(result):
            return Group(self, result)