From 199c8fef40df73d46a9a9c75005c820bf580c22b Mon Sep 17 00:00:00 2001 From: Mick Vleeshouwer Date: Tue, 8 Feb 2022 08:49:38 -0800 Subject: [PATCH] Fix MyFox Camera Shutter entity in Overkiz integration (#66088) --- homeassistant/components/overkiz/const.py | 2 +- homeassistant/components/overkiz/switch.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/overkiz/const.py b/homeassistant/components/overkiz/const.py index e6c55af0749..370e56feeeb 100644 --- a/homeassistant/components/overkiz/const.py +++ b/homeassistant/components/overkiz/const.py @@ -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) diff --git a/homeassistant/components/overkiz/switch.py b/homeassistant/components/overkiz/switch.py index 8b3222cf442..8fd38816bcd 100644 --- a/homeassistant/components/overkiz/switch.py +++ b/homeassistant/components/overkiz/switch.py @@ -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 = {