async def async_setup_entry(hass, config_entry, async_add_entities):
    """Set up the Fully Kiosk Browser media player."""
    coordinator = hass.data[DOMAIN][config_entry.entry_id]
    platform = entity_platform.current_platform.get()

    platform.async_register_entity_service(SERVICE_LOAD_START_URL, {},
                                           "async_fullykiosk_load_start_url")

    platform.async_register_entity_service(SERVICE_LOAD_URL,
                                           {vol.Required(ATTR_URL): cv.url},
                                           "async_fullykiosk_load_url")

    platform.async_register_entity_service(
        SERVICE_PLAY_AUDIO,
        {
            vol.Required(ATTR_URL):
            cv.string,
            vol.Required(ATTR_STREAM):
            vol.All(vol.Number(scale=0), vol.Range(1, 10)),
        },
        "async_fullykiosk_play_audio",
    )

    platform.async_register_entity_service(SERVICE_REBOOT_DEVICE, {},
                                           "async_fullykiosk_reboot_device")

    platform.async_register_entity_service(SERVICE_RESTART_APP, {},
                                           "async_fullykiosk_restart")

    platform.async_register_entity_service(
        SERVICE_SET_CONFIG,
        {
            vol.Required(ATTR_CONFIG_TYPE): vol.In(["string", "bool"]),
            vol.Required(ATTR_KEY): cv.string,
            vol.Required(ATTR_VALUE): vol.Any(cv.string, cv.boolean),
        },
        "async_fullykiosk_set_config",
    )

    platform.async_register_entity_service(
        SERVICE_VOLUME_SET,
        {
            vol.Required(ATTR_MEDIA_VOLUME_LEVEL):
            cv.small_float,
            vol.Required(ATTR_STREAM):
            vol.All(vol.Number(scale=0), vol.Range(1, 10)),
        },
        "async_fullykiosk_set_volume_level",
    )

    platform.async_register_entity_service(
        SERVICE_START_APPLICATION,
        {vol.Required(ATTR_APPLICATION): cv.string},
        "async_fullykiosk_start_app",
    )

    platform.async_register_entity_service(SERVICE_TO_FOREGROUND, {},
                                           "async_fullykiosk_to_foreground")

    async_add_entities([FullyMediaPlayer(coordinator)], False)
Exemplo n.º 2
0
async def async_setup_entry(
    hass: HomeAssistant,
    entry: ConfigEntry,
    async_add_entities: AddEntitiesCallback,
) -> None:
    """Set up Bond fan devices."""
    data = hass.data[DOMAIN][entry.entry_id]
    hub: BondHub = data[HUB]
    bpup_subs: BPUPSubscriptions = data[BPUP_SUBS]
    platform = entity_platform.async_get_current_platform()

    fans: list[Entity] = [
        BondFan(hub, device, bpup_subs) for device in hub.devices
        if DeviceType.is_fan(device.type)
    ]

    platform.async_register_entity_service(
        SERVICE_SET_FAN_SPEED_TRACKED_STATE,
        {
            vol.Required(ATTR_SPEED):
            vol.All(vol.Number(scale=0), vol.Range(0, 100))
        },
        "async_set_speed_belief",
    )

    async_add_entities(fans, True)
Exemplo n.º 3
0
async def async_setup_entry(
    hass: HomeAssistant,
    entry: ConfigEntry,
    async_add_entities: AddEntitiesCallback,
) -> None:
    """Set up Bond fan devices."""
    data: BondData = hass.data[DOMAIN][entry.entry_id]
    hub = data.hub
    bpup_subs = data.bpup_subs
    platform = entity_platform.async_get_current_platform()
    platform.async_register_entity_service(
        SERVICE_SET_FAN_SPEED_TRACKED_STATE,
        {vol.Required("speed"): vol.All(vol.Number(scale=0), vol.Range(0, 100))},
        "async_set_speed_belief",
    )

    async_add_entities(
        BondFan(hub, device, bpup_subs)
        for device in hub.devices
        if DeviceType.is_fan(device.type)
    )
Exemplo n.º 4
0
async def async_setup_entry(
    hass: HomeAssistant,
    entry: ConfigEntry,
    async_add_entities: AddEntitiesCallback,
) -> None:
    """Set up Bond light devices."""
    data = hass.data[DOMAIN][entry.entry_id]
    hub: BondHub = data[HUB]
    bpup_subs: BPUPSubscriptions = data[BPUP_SUBS]
    platform = entity_platform.async_get_current_platform()

    platform = entity_platform.async_get_current_platform()
    for service in ENTITY_SERVICES:
        platform.async_register_entity_service(
            service,
            {},
            f"async_{service}",
        )

    fan_lights: list[Entity] = [
        BondLight(hub, device, bpup_subs) for device in hub.devices
        if DeviceType.is_fan(device.type) and device.supports_light()
        and not (device.supports_up_light() and device.supports_down_light())
    ]

    fan_up_lights: list[Entity] = [
        BondUpLight(hub, device, bpup_subs, "up_light")
        for device in hub.devices
        if DeviceType.is_fan(device.type) and device.supports_up_light()
    ]

    fan_down_lights: list[Entity] = [
        BondDownLight(hub, device, bpup_subs, "down_light")
        for device in hub.devices
        if DeviceType.is_fan(device.type) and device.supports_down_light()
    ]

    fireplaces: list[Entity] = [
        BondFireplace(hub, device, bpup_subs) for device in hub.devices
        if DeviceType.is_fireplace(device.type)
    ]

    fp_lights: list[Entity] = [
        BondLight(hub, device, bpup_subs, "light") for device in hub.devices
        if DeviceType.is_fireplace(device.type) and device.supports_light()
    ]

    lights: list[Entity] = [
        BondLight(hub, device, bpup_subs) for device in hub.devices
        if DeviceType.is_light(device.type)
    ]

    platform.async_register_entity_service(
        SERVICE_SET_LIGHT_BRIGHTNESS_TRACKED_STATE,
        {
            vol.Required(ATTR_BRIGHTNESS):
            vol.All(vol.Number(scale=0), vol.Range(0, 255))
        },
        "async_set_brightness_belief",
    )

    platform.async_register_entity_service(
        SERVICE_SET_LIGHT_POWER_TRACKED_STATE,
        {vol.Required(ATTR_POWER_STATE): vol.All(cv.boolean)},
        "async_set_power_belief",
    )

    async_add_entities(
        fan_lights + fan_up_lights + fan_down_lights + fireplaces + fp_lights +
        lights,
        True,
    )
Exemplo n.º 5
0
SERVICE_SET_TARGET_HUMIDITY_SCHEMA = AIRPURIFIER_SERVICE_SCHEMA.extend({
    vol.Required(SERVICE_ATTR_HUMIDITY):
    vol.All(vol.Coerce(int), vol.In(TARGET_HUMIDITY_LIST))
})

SERVICE_SET_LIGHT_BRIGHTNESS_SCHEMA = AIRPURIFIER_SERVICE_SCHEMA.extend({
    vol.Required(SERVICE_ATTR_BRIGHTNESS_LEVEL):
    vol.All(vol.Coerce(int), vol.In(LIGHT_BRIGHTNESS_LIST))
})

SERVICE_SET_CHILD_LOCK_SCHEMA = AIRPURIFIER_SERVICE_SCHEMA.extend(
    {vol.Required(SERVICE_ATTR_CHILD_LOCK): cv.boolean})

SERVICE_SET_TIMER_SCHEMA = AIRPURIFIER_SERVICE_SCHEMA.extend({
    vol.Required(SERVICE_ATTR_TIMER_HOURS):
    vol.All(vol.Coerce(int), vol.Number(scale=0), vol.Range(min=0, max=12))
})

SERVICE_SET_DISPLAY_LIGHT_SCHEMA = AIRPURIFIER_SERVICE_SCHEMA.extend(
    {vol.Required(SERVICE_ATTR_DISPLAY_LIGHT): cv.boolean})

SERVICE_SET_USED_INDEX_SCHEMA = AIRPURIFIER_SERVICE_SCHEMA.extend(
    {vol.Required(SERVICE_ATTR_USED_INDEX): vol.In(USED_INDEX_MAP.values())})

SERVICE_TO_METHOD = {
    SERVICE_SET_FUNCTION: {
        "method": "async_set_function",
        "schema": SERVICE_SET_FUNCTION_SCHEMA,
    },
    SERVICE_SET_TARGET_HUMIDITY: {
        "method": "async_set_target_humidity",
Exemplo n.º 6
0
SERVICE_SET_LIGHT_BRIGHTNESS_SCHEMA = AIRPURIFIER_SERVICE_SCHEMA.extend(
    {
        vol.Required(SERVICE_ATTR_BRIGHTNESS_LEVEL):
            vol.All(vol.Coerce(int), vol.In(LIGHT_BRIGHTNESS_LIST))
    }
)

SERVICE_SET_CHILD_LOCK_SCHEMA = AIRPURIFIER_SERVICE_SCHEMA.extend(
    {vol.Required(SERVICE_ATTR_CHILD_LOCK): cv.boolean}
)

SERVICE_SET_TIMER_SCHEMA = AIRPURIFIER_SERVICE_SCHEMA.extend(
    {
        vol.Required(SERVICE_ATTR_TIMER_HOURS): vol.All(
            vol.Coerce(int),
            vol.Number(scale=0),
            vol.Range(min=0, max=12)
        )
    }
)

SERVICE_SET_DISPLAY_LIGHT_SCHEMA = AIRPURIFIER_SERVICE_SCHEMA.extend(
    {vol.Required(SERVICE_ATTR_DISPLAY_LIGHT): cv.boolean}
)

SERVICE_TO_METHOD = {
    SERVICE_SET_MODE: {
        "method": "async_set_mode",
        "schema": SERVICE_SET_MODE_SCHEMA
    },
    SERVICE_SET_FUNCTION: {