mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 02:24:51 -05:00
Import shared Imou PARAM constants from pyimouapi (#178798)
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user