예제 #1
0
def hue_client(loop, hass_hue, aiohttp_client):
    """Create web client for emulated hue api."""
    web_app = hass_hue.http.app
    config = Config(
        None,
        {
            emulated_hue.CONF_TYPE: emulated_hue.TYPE_ALEXA,
            emulated_hue.CONF_ENTITIES: {
                "light.bed_light": {
                    emulated_hue.CONF_ENTITY_HIDDEN: True
                },
                "cover.living_room_window": {
                    emulated_hue.CONF_ENTITY_HIDDEN: False
                },
            },
        },
    )

    HueUsernameView().register(web_app, web_app.router)
    HueAllLightsStateView(config).register(web_app, web_app.router)
    HueOneLightStateView(config).register(web_app, web_app.router)
    HueOneLightChangeView(config).register(web_app, web_app.router)
    HueAllGroupsStateView(config).register(web_app, web_app.router)
    HueFullStateView(config).register(web_app, web_app.router)

    return loop.run_until_complete(aiohttp_client(web_app))
예제 #2
0
def hue_client(loop, hass_hue, test_client):
    """Create web client for emulated hue api."""
    web_app = hass_hue.http.app
    config = Config(None, {'type': 'alexa'})

    HueUsernameView().register(web_app.router)
    HueAllLightsStateView(config).register(web_app.router)
    HueOneLightStateView(config).register(web_app.router)
    HueOneLightChangeView(config).register(web_app.router)

    return loop.run_until_complete(test_client(web_app))
예제 #3
0
def hue_client(loop, hass_hue, aiohttp_client):
    """Create web client for emulated hue api."""
    web_app = hass_hue.http.app
    config = Config(
        None,
        {
            emulated_hue.CONF_ENTITIES: {
                "light.bed_light": {
                    emulated_hue.CONF_ENTITY_HIDDEN: True
                },
                # Kitchen light is explicitly excluded from being exposed
                "light.kitchen_lights": {
                    emulated_hue.CONF_ENTITY_HIDDEN: True
                },
                # Ceiling Fan is explicitly excluded from being exposed
                "fan.ceiling_fan": {
                    emulated_hue.CONF_ENTITY_HIDDEN: True
                },
                # Expose the script
                "script.set_kitchen_light": {
                    emulated_hue.CONF_ENTITY_HIDDEN: False
                },
                # Expose cover
                "cover.living_room_window": {
                    emulated_hue.CONF_ENTITY_HIDDEN: False
                },
                # Expose Hvac
                "climate.hvac": {
                    emulated_hue.CONF_ENTITY_HIDDEN: False
                },
                # Expose HeatPump
                "climate.heatpump": {
                    emulated_hue.CONF_ENTITY_HIDDEN: False
                },
                # No expose setting (use default of not exposed)
                "climate.nosetting": {},
            },
        },
    )
    config.numbers = ENTITY_IDS_BY_NUMBER

    HueUsernameView().register(web_app, web_app.router)
    HueAllLightsStateView(config).register(web_app, web_app.router)
    HueOneLightStateView(config).register(web_app, web_app.router)
    HueOneLightChangeView(config).register(web_app, web_app.router)
    HueAllGroupsStateView(config).register(web_app, web_app.router)
    HueFullStateView(config).register(web_app, web_app.router)
    HueConfigView(config).register(web_app, web_app.router)

    return loop.run_until_complete(aiohttp_client(web_app))
예제 #4
0
def hue_client(loop, hass_hue, test_client):
    """Create web client for emulated hue api."""
    web_app = hass_hue.http.app
    config = Config(None, {
        emulated_hue.CONF_TYPE: emulated_hue.TYPE_ALEXA,
        emulated_hue.CONF_ENTITIES: {
            'light.bed_light': {
                emulated_hue.CONF_ENTITY_HIDDEN: True
            }
        }
    })

    HueUsernameView().register(web_app.router)
    HueAllLightsStateView(config).register(web_app.router)
    HueOneLightStateView(config).register(web_app.router)
    HueOneLightChangeView(config).register(web_app.router)

    return loop.run_until_complete(test_client(web_app))