diff --git a/homeassistant/components/imou/button.py b/homeassistant/components/imou/button.py index cea2df639d7a..0ea9a40b6b56 100644 --- a/homeassistant/components/imou/button.py +++ b/homeassistant/components/imou/button.py @@ -2,6 +2,7 @@ from typing import override +from pyimouapi.const import PARAM_RESTART_DEVICE from pyimouapi.exceptions import ImouException from pyimouapi.ha_device import ImouHaDevice @@ -19,8 +20,7 @@ from .coordinator import ImouConfigEntry, ImouDataUpdateCoordinator from .entity import ImouEntity PARALLEL_UPDATES = 1 -# Button types -PARAM_RESTART_DEVICE = "restart_device" +# Button types not yet exported by pyimouapi (keep module-local). PARAM_MUTE = "mute" PARAM_PTZ_UP = "ptz_up" PARAM_PTZ_DOWN = "ptz_down" diff --git a/homeassistant/components/imou/const.py b/homeassistant/components/imou/const.py index 73d6d7936cb0..0e5e31e9731f 100644 --- a/homeassistant/components/imou/const.py +++ b/homeassistant/components/imou/const.py @@ -26,9 +26,7 @@ CONF_API_URL = "api_url" CONF_APP_ID = "app_id" CONF_APP_SECRET = "app_secret" -PARAM_STATUS = "status" -PARAM_STATE = "state" -PARAM_MOTION_DETECT = "motion_detect" +# Switch keys not yet exported by pyimouapi (keep integration-local). PARAM_HEADER_DETECT = "header_detect" PARAM_WHITE_LIGHT = "white_light" PARAM_CLOSE_CAMERA = "close_camera" @@ -36,8 +34,6 @@ PARAM_AB_ALARM_SOUND = "ab_alarm_sound" PARAM_AUDIO_ENCODE_CONTROL = "audio_encode_control" PARAM_LIGHT = "light" PARAM_PLUG_SWITCH = "switch" -PARAM_NIGHT_VISION_MODE = "night_vision_mode" -PARAM_DEVICE_VOLUME = "device_volume" # How long each PTZ button press moves the camera, in milliseconds (Imou cloud API). PTZ_MOVE_DURATION_MS = 500 diff --git a/homeassistant/components/imou/entity.py b/homeassistant/components/imou/entity.py index b55cf0286f3b..7f6fb3fb29b9 100644 --- a/homeassistant/components/imou/entity.py +++ b/homeassistant/components/imou/entity.py @@ -2,13 +2,14 @@ from typing import override +from pyimouapi.const import PARAM_STATE, PARAM_STATUS from pyimouapi.ha_device import DeviceStatus, ImouHaDevice from homeassistant.helpers.device_registry import DeviceInfo from homeassistant.helpers.entity import EntityDescription from homeassistant.helpers.update_coordinator import CoordinatorEntity -from .const import DOMAIN, PARAM_STATE, PARAM_STATUS, imou_device_identifier +from .const import DOMAIN, imou_device_identifier from .coordinator import ImouDataUpdateCoordinator diff --git a/homeassistant/components/imou/select.py b/homeassistant/components/imou/select.py index c2cc55f60b8c..e4f74073fc0c 100644 --- a/homeassistant/components/imou/select.py +++ b/homeassistant/components/imou/select.py @@ -2,7 +2,12 @@ from typing import override -from pyimouapi.const import PARAM_CURRENT_OPTION, PARAM_OPTIONS +from pyimouapi.const import ( + PARAM_CURRENT_OPTION, + PARAM_DEVICE_VOLUME, + PARAM_NIGHT_VISION_MODE, + PARAM_OPTIONS, +) from pyimouapi.exceptions import ImouException from pyimouapi.ha_device import ImouHaDevice @@ -12,12 +17,7 @@ from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback -from .const import ( - DOMAIN, - PARAM_DEVICE_VOLUME, - PARAM_NIGHT_VISION_MODE, - imou_device_identifier, -) +from .const import DOMAIN, imou_device_identifier from .coordinator import ImouConfigEntry, ImouDataUpdateCoordinator from .entity import ImouEntity diff --git a/homeassistant/components/imou/sensor.py b/homeassistant/components/imou/sensor.py index 539eb149adb7..0a2dd7e211d7 100644 --- a/homeassistant/components/imou/sensor.py +++ b/homeassistant/components/imou/sensor.py @@ -3,7 +3,12 @@ from dataclasses import dataclass from typing import override -from pyimouapi.const import PARAM_STATE_VARIANT, STATE_VARIANT_NUMERIC +from pyimouapi.const import ( + PARAM_STATE, + PARAM_STATE_VARIANT, + PARAM_STATUS, + STATE_VARIANT_NUMERIC, +) from pyimouapi.ha_device import ImouHaDevice from homeassistant.components.sensor import ( @@ -26,7 +31,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from homeassistant.helpers.typing import StateType -from .const import PARAM_STATE, PARAM_STATUS, imou_device_identifier +from .const import imou_device_identifier from .coordinator import ImouConfigEntry, ImouDataUpdateCoordinator from .entity import ImouEntity diff --git a/homeassistant/components/imou/switch.py b/homeassistant/components/imou/switch.py index e45a50fa33b4..d60db6a676c7 100644 --- a/homeassistant/components/imou/switch.py +++ b/homeassistant/components/imou/switch.py @@ -2,6 +2,7 @@ from typing import Any, override +from pyimouapi.const import PARAM_MOTION_DETECT, PARAM_STATE from pyimouapi.exceptions import ImouException from pyimouapi.ha_device import ImouHaDevice @@ -21,9 +22,7 @@ from .const import ( PARAM_CLOSE_CAMERA, PARAM_HEADER_DETECT, PARAM_LIGHT, - PARAM_MOTION_DETECT, PARAM_PLUG_SWITCH, - PARAM_STATE, PARAM_WHITE_LIGHT, imou_device_identifier, ) diff --git a/tests/components/imou/const.py b/tests/components/imou/const.py index 5eba8770800a..500bd26895dc 100644 --- a/tests/components/imou/const.py +++ b/tests/components/imou/const.py @@ -3,7 +3,11 @@ from pyimouapi.const import ( PARAM_BATTERY, PARAM_CURRENT_OPTION, + PARAM_DEVICE_VOLUME, + PARAM_MOTION_DETECT, + PARAM_NIGHT_VISION_MODE, PARAM_OPTIONS, + PARAM_RESTART_DEVICE, PARAM_STATE, PARAM_STATE_VARIANT, PARAM_STATUS, @@ -13,20 +17,13 @@ from pyimouapi.const import ( ) from pyimouapi.ha_device import DeviceStatus, ImouHaDevice -from homeassistant.components.imou.button import ( - PARAM_MUTE, - PARAM_PTZ_UP, - PARAM_RESTART_DEVICE, -) +from homeassistant.components.imou.button import PARAM_MUTE, PARAM_PTZ_UP from homeassistant.components.imou.const import ( CONF_API_URL, CONF_APP_ID, CONF_APP_SECRET, - PARAM_DEVICE_VOLUME, PARAM_HEADER_DETECT, PARAM_LIGHT, - PARAM_MOTION_DETECT, - PARAM_NIGHT_VISION_MODE, PARAM_PLUG_SWITCH, ) diff --git a/tests/components/imou/test_button.py b/tests/components/imou/test_button.py index 3dd8674f9cb2..4b9eb5dbda94 100644 --- a/tests/components/imou/test_button.py +++ b/tests/components/imou/test_button.py @@ -3,6 +3,7 @@ from unittest.mock import MagicMock from freezegun.api import FrozenDateTimeFactory +from pyimouapi.const import PARAM_STATE, PARAM_STATUS from pyimouapi.exceptions import ImouException from pyimouapi.ha_device import DeviceStatus, ImouHaDevice import pytest @@ -10,11 +11,7 @@ from syrupy.assertion import SnapshotAssertion from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS from homeassistant.components.imou.button import PARAM_MUTE, PARAM_PTZ_UP -from homeassistant.components.imou.const import ( - PARAM_STATE, - PARAM_STATUS, - PTZ_MOVE_DURATION_MS, -) +from homeassistant.components.imou.const import PTZ_MOVE_DURATION_MS from homeassistant.components.imou.coordinator import SCAN_INTERVAL from homeassistant.const import ATTR_ENTITY_ID, STATE_UNAVAILABLE, Platform from homeassistant.core import HomeAssistant diff --git a/tests/components/imou/test_init.py b/tests/components/imou/test_init.py index 64de5ba8d904..ee1abde272c9 100644 --- a/tests/components/imou/test_init.py +++ b/tests/components/imou/test_init.py @@ -3,12 +3,13 @@ from unittest.mock import AsyncMock, MagicMock from freezegun.api import FrozenDateTimeFactory +from pyimouapi.const import PARAM_STATE, PARAM_STATUS from pyimouapi.exceptions import ImouException from pyimouapi.ha_device import DeviceStatus, ImouHaDevice import pytest from homeassistant.components.imou.button import PARAM_MUTE, PARAM_PTZ_UP -from homeassistant.components.imou.const import DOMAIN, PARAM_STATE, PARAM_STATUS +from homeassistant.components.imou.const import DOMAIN from homeassistant.components.imou.coordinator import SCAN_INTERVAL from homeassistant.config_entries import ConfigEntryState from homeassistant.const import STATE_UNAVAILABLE diff --git a/tests/components/imou/test_select.py b/tests/components/imou/test_select.py index 652cc63e8cb6..c56e61f2ef4a 100644 --- a/tests/components/imou/test_select.py +++ b/tests/components/imou/test_select.py @@ -3,18 +3,19 @@ from unittest.mock import MagicMock from freezegun.api import FrozenDateTimeFactory -from pyimouapi.const import PARAM_CURRENT_OPTION, PARAM_OPTIONS +from pyimouapi.const import ( + PARAM_CURRENT_OPTION, + PARAM_DEVICE_VOLUME, + PARAM_NIGHT_VISION_MODE, + PARAM_OPTIONS, + PARAM_STATE, + PARAM_STATUS, +) from pyimouapi.exceptions import ImouException from pyimouapi.ha_device import DeviceStatus, ImouHaDevice import pytest from syrupy.assertion import SnapshotAssertion -from homeassistant.components.imou.const import ( - PARAM_DEVICE_VOLUME, - PARAM_NIGHT_VISION_MODE, - PARAM_STATE, - PARAM_STATUS, -) from homeassistant.components.imou.coordinator import SCAN_INTERVAL from homeassistant.components.select import DOMAIN as SELECT_DOMAIN from homeassistant.const import ( diff --git a/tests/components/imou/test_sensor.py b/tests/components/imou/test_sensor.py index 7a9149f872d1..01934ea3d45f 100644 --- a/tests/components/imou/test_sensor.py +++ b/tests/components/imou/test_sensor.py @@ -5,7 +5,9 @@ from unittest.mock import MagicMock from freezegun.api import FrozenDateTimeFactory from pyimouapi.const import ( PARAM_BATTERY, + PARAM_STATE, PARAM_STATE_VARIANT, + PARAM_STATUS, PARAM_STORAGE_USED, STATE_VARIANT_ENUM, ) @@ -13,7 +15,6 @@ from pyimouapi.ha_device import DeviceStatus, ImouHaDevice import pytest from syrupy.assertion import SnapshotAssertion -from homeassistant.components.imou.const import PARAM_STATE, PARAM_STATUS from homeassistant.components.imou.coordinator import SCAN_INTERVAL from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.const import STATE_UNAVAILABLE, STATE_UNKNOWN, Platform diff --git a/tests/components/imou/test_switch.py b/tests/components/imou/test_switch.py index e025dab5e77a..85a1918618dd 100644 --- a/tests/components/imou/test_switch.py +++ b/tests/components/imou/test_switch.py @@ -3,17 +3,13 @@ from unittest.mock import MagicMock from freezegun.api import FrozenDateTimeFactory +from pyimouapi.const import PARAM_MOTION_DETECT, PARAM_STATE, PARAM_STATUS from pyimouapi.exceptions import ImouException from pyimouapi.ha_device import DeviceStatus, ImouHaDevice import pytest from syrupy.assertion import SnapshotAssertion -from homeassistant.components.imou.const import ( - PARAM_HEADER_DETECT, - PARAM_MOTION_DETECT, - PARAM_STATE, - PARAM_STATUS, -) +from homeassistant.components.imou.const import PARAM_HEADER_DETECT from homeassistant.components.imou.coordinator import SCAN_INTERVAL from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN from homeassistant.const import (