From fe6d6b81e312fe9877e866f83edc2d05d2a9cd96 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 2 Aug 2022 00:38:31 -1000 Subject: [PATCH] Add support for switchbot motion sensors (#76059) --- homeassistant/components/switchbot/__init__.py | 2 ++ homeassistant/components/switchbot/const.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/homeassistant/components/switchbot/__init__.py b/homeassistant/components/switchbot/__init__.py index e32252a7615..7eec785233f 100644 --- a/homeassistant/components/switchbot/__init__.py +++ b/homeassistant/components/switchbot/__init__.py @@ -22,6 +22,7 @@ from .const import ( ATTR_CONTACT, ATTR_CURTAIN, ATTR_HYGROMETER, + ATTR_MOTION, ATTR_PLUG, CONF_RETRY_COUNT, DEFAULT_RETRY_COUNT, @@ -35,6 +36,7 @@ PLATFORMS_BY_TYPE = { ATTR_CURTAIN: [Platform.COVER, Platform.BINARY_SENSOR, Platform.SENSOR], ATTR_HYGROMETER: [Platform.SENSOR], ATTR_CONTACT: [Platform.BINARY_SENSOR, Platform.SENSOR], + ATTR_MOTION: [Platform.BINARY_SENSOR, Platform.SENSOR], } CLASS_BY_DEVICE = { ATTR_CURTAIN: switchbot.SwitchbotCurtain, diff --git a/homeassistant/components/switchbot/const.py b/homeassistant/components/switchbot/const.py index 9cc2acebbf8..a8ec3433f84 100644 --- a/homeassistant/components/switchbot/const.py +++ b/homeassistant/components/switchbot/const.py @@ -8,13 +8,16 @@ ATTR_CURTAIN = "curtain" ATTR_HYGROMETER = "hygrometer" ATTR_CONTACT = "contact" ATTR_PLUG = "plug" +ATTR_MOTION = "motion" DEFAULT_NAME = "Switchbot" + SUPPORTED_MODEL_TYPES = { "WoHand": ATTR_BOT, "WoCurtain": ATTR_CURTAIN, "WoSensorTH": ATTR_HYGROMETER, "WoContact": ATTR_CONTACT, "WoPlug": ATTR_PLUG, + "WoPresence": ATTR_MOTION, } # Config Defaults