Fix MyFox Camera Shutter entity in Overkiz integration (#66088)

This commit is contained in:
Mick Vleeshouwer 2022-02-08 08:49:38 -08:00 committed by GitHub
parent 6f46d98308
commit 199c8fef40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -56,7 +56,7 @@ OVERKIZ_DEVICE_TO_PLATFORM: dict[UIClass | UIWidget, Platform] = {
UIClass.VENETIAN_BLIND: Platform.COVER,
UIClass.WINDOW: Platform.COVER,
UIWidget.DOMESTIC_HOT_WATER_TANK: Platform.SWITCH, # widgetName, uiClass is WaterHeatingSystem (not supported)
UIWidget.MY_FOX_SECURITY_CAMERA: Platform.COVER, # widgetName, uiClass is Camera (not supported)
UIWidget.MY_FOX_SECURITY_CAMERA: Platform.SWITCH, # widgetName, uiClass is Camera (not supported)
UIWidget.RTD_INDOOR_SIREN: Platform.SWITCH, # widgetName, uiClass is Siren (not supported)
UIWidget.RTD_OUTDOOR_SIREN: Platform.SWITCH, # widgetName, uiClass is Siren (not supported)
UIWidget.RTS_GENERIC: Platform.COVER, # widgetName, uiClass is Generic (not supported)

View file

@ -17,6 +17,7 @@ from homeassistant.components.switch import (
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import HomeAssistantOverkizData
@ -95,6 +96,18 @@ SWITCH_DESCRIPTIONS: list[OverkizSwitchDescription] = [
turn_off=lambda execute_command: execute_command(OverkizCommand.OFF),
icon="mdi:radiator",
),
OverkizSwitchDescription(
key=UIWidget.MY_FOX_SECURITY_CAMERA,
name="Camera Shutter",
turn_on=lambda execute_command: execute_command(OverkizCommand.OPEN),
turn_off=lambda execute_command: execute_command(OverkizCommand.CLOSE),
icon="mdi:camera-lock",
is_on=lambda select_state: (
select_state(OverkizState.MYFOX_SHUTTER_STATUS)
== OverkizCommandParam.OPENED
),
entity_category=EntityCategory.CONFIG,
),
]
SUPPORTED_DEVICES = {