Fix EZVIZ spelling case (#79164)
* Fix EZVIZ spelling case The vendor seems consistent about all-uppercase spelling, so let's follow suit. * Revert changes to translations other than English
This commit is contained in:
parent
38f3fa0762
commit
b54458dfba
14 changed files with 42 additions and 42 deletions
|
@ -1,4 +1,4 @@
|
||||||
"""Support for Ezviz camera."""
|
"""Support for EZVIZ camera."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from pyezviz.client import EzvizClient
|
from pyezviz.client import EzvizClient
|
||||||
|
@ -39,7 +39,7 @@ PLATFORMS = [
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up Ezviz from a config entry."""
|
"""Set up EZVIZ from a config entry."""
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
|
|
||||||
if not entry.options:
|
if not entry.options:
|
||||||
|
@ -56,7 +56,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
# Fetch Entry id of main account and reload it.
|
# Fetch Entry id of main account and reload it.
|
||||||
for item in hass.config_entries.async_entries():
|
for item in hass.config_entries.async_entries():
|
||||||
if item.data.get(CONF_TYPE) == ATTR_TYPE_CLOUD:
|
if item.data.get(CONF_TYPE) == ATTR_TYPE_CLOUD:
|
||||||
_LOGGER.info("Reload Ezviz integration with new camera rtsp entry")
|
_LOGGER.info("Reload EZVIZ integration with new camera rtsp entry")
|
||||||
await hass.config_entries.async_reload(item.entry_id)
|
await hass.config_entries.async_reload(item.entry_id)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -66,7 +66,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
_get_ezviz_client_instance, entry
|
_get_ezviz_client_instance, entry
|
||||||
)
|
)
|
||||||
except (InvalidURL, HTTPError, PyEzvizError) as error:
|
except (InvalidURL, HTTPError, PyEzvizError) as error:
|
||||||
_LOGGER.error("Unable to connect to Ezviz service: %s", str(error))
|
_LOGGER.error("Unable to connect to EZVIZ service: %s", str(error))
|
||||||
raise ConfigEntryNotReady from error
|
raise ConfigEntryNotReady from error
|
||||||
|
|
||||||
coordinator = EzvizDataUpdateCoordinator(
|
coordinator = EzvizDataUpdateCoordinator(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""Support for Ezviz binary sensors."""
|
"""Support for EZVIZ binary sensors."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
|
@ -35,7 +35,7 @@ BINARY_SENSOR_TYPES: dict[str, BinarySensorEntityDescription] = {
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up Ezviz sensors based on a config entry."""
|
"""Set up EZVIZ sensors based on a config entry."""
|
||||||
coordinator: EzvizDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
|
coordinator: EzvizDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
|
||||||
DATA_COORDINATOR
|
DATA_COORDINATOR
|
||||||
]
|
]
|
||||||
|
@ -52,7 +52,7 @@ async def async_setup_entry(
|
||||||
|
|
||||||
|
|
||||||
class EzvizBinarySensor(EzvizEntity, BinarySensorEntity):
|
class EzvizBinarySensor(EzvizEntity, BinarySensorEntity):
|
||||||
"""Representation of a Ezviz sensor."""
|
"""Representation of a EZVIZ sensor."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
|
@ -57,7 +57,7 @@ async def async_setup_entry(
|
||||||
entry: ConfigEntry,
|
entry: ConfigEntry,
|
||||||
async_add_entities: entity_platform.AddEntitiesCallback,
|
async_add_entities: entity_platform.AddEntitiesCallback,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up Ezviz cameras based on a config entry."""
|
"""Set up EZVIZ cameras based on a config entry."""
|
||||||
|
|
||||||
coordinator: EzvizDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
|
coordinator: EzvizDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
|
||||||
DATA_COORDINATOR
|
DATA_COORDINATOR
|
||||||
|
@ -73,7 +73,7 @@ async def async_setup_entry(
|
||||||
if item.unique_id == camera and item.source != SOURCE_IGNORE
|
if item.unique_id == camera and item.source != SOURCE_IGNORE
|
||||||
]
|
]
|
||||||
|
|
||||||
# There seem to be a bug related to localRtspPort in Ezviz API.
|
# There seem to be a bug related to localRtspPort in EZVIZ API.
|
||||||
local_rtsp_port = (
|
local_rtsp_port = (
|
||||||
value["local_rtsp_port"]
|
value["local_rtsp_port"]
|
||||||
if value["local_rtsp_port"] != 0
|
if value["local_rtsp_port"] != 0
|
||||||
|
@ -174,7 +174,7 @@ async def async_setup_entry(
|
||||||
|
|
||||||
|
|
||||||
class EzvizCamera(EzvizEntity, Camera):
|
class EzvizCamera(EzvizEntity, Camera):
|
||||||
"""An implementation of a Ezviz security camera."""
|
"""An implementation of a EZVIZ security camera."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -187,7 +187,7 @@ class EzvizCamera(EzvizEntity, Camera):
|
||||||
local_rtsp_port: int,
|
local_rtsp_port: int,
|
||||||
ffmpeg_arguments: str | None,
|
ffmpeg_arguments: str | None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize a Ezviz security camera."""
|
"""Initialize a EZVIZ security camera."""
|
||||||
super().__init__(coordinator, serial)
|
super().__init__(coordinator, serial)
|
||||||
Camera.__init__(self)
|
Camera.__init__(self)
|
||||||
self.stream_options[CONF_USE_WALLCLOCK_AS_TIMESTAMPS] = True
|
self.stream_options[CONF_USE_WALLCLOCK_AS_TIMESTAMPS] = True
|
||||||
|
|
|
@ -67,7 +67,7 @@ def _test_camera_rtsp_creds(data):
|
||||||
|
|
||||||
|
|
||||||
class EzvizConfigFlow(ConfigFlow, domain=DOMAIN):
|
class EzvizConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a config flow for Ezviz."""
|
"""Handle a config flow for EZVIZ."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 1
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class EzvizConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
async def _validate_and_create_camera_rtsp(self, data):
|
async def _validate_and_create_camera_rtsp(self, data):
|
||||||
"""Try DESCRIBE on RTSP camera with credentials."""
|
"""Try DESCRIBE on RTSP camera with credentials."""
|
||||||
|
|
||||||
# Get Ezviz cloud credentials from config entry
|
# Get EZVIZ cloud credentials from config entry
|
||||||
ezviz_client_creds = {
|
ezviz_client_creds = {
|
||||||
CONF_USERNAME: None,
|
CONF_USERNAME: None,
|
||||||
CONF_PASSWORD: None,
|
CONF_PASSWORD: None,
|
||||||
|
@ -311,14 +311,14 @@ class EzvizConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
|
|
||||||
|
|
||||||
class EzvizOptionsFlowHandler(OptionsFlow):
|
class EzvizOptionsFlowHandler(OptionsFlow):
|
||||||
"""Handle Ezviz client options."""
|
"""Handle EZVIZ client options."""
|
||||||
|
|
||||||
def __init__(self, config_entry: ConfigEntry) -> None:
|
def __init__(self, config_entry: ConfigEntry) -> None:
|
||||||
"""Initialize options flow."""
|
"""Initialize options flow."""
|
||||||
self.config_entry = config_entry
|
self.config_entry = config_entry
|
||||||
|
|
||||||
async def async_step_init(self, user_input=None):
|
async def async_step_init(self, user_input=None):
|
||||||
"""Manage Ezviz options."""
|
"""Manage EZVIZ options."""
|
||||||
if user_input is not None:
|
if user_input is not None:
|
||||||
return self.async_create_entry(title="", data=user_input)
|
return self.async_create_entry(title="", data=user_input)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Constants for the ezviz integration."""
|
"""Constants for the ezviz integration."""
|
||||||
|
|
||||||
DOMAIN = "ezviz"
|
DOMAIN = "ezviz"
|
||||||
MANUFACTURER = "Ezviz"
|
MANUFACTURER = "EZVIZ"
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
ATTR_SERIAL = "serial"
|
ATTR_SERIAL = "serial"
|
||||||
|
|
|
@ -15,12 +15,12 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class EzvizDataUpdateCoordinator(DataUpdateCoordinator):
|
class EzvizDataUpdateCoordinator(DataUpdateCoordinator):
|
||||||
"""Class to manage fetching Ezviz data."""
|
"""Class to manage fetching EZVIZ data."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, hass: HomeAssistant, *, api: EzvizClient, api_timeout: int
|
self, hass: HomeAssistant, *, api: EzvizClient, api_timeout: int
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize global Ezviz data updater."""
|
"""Initialize global EZVIZ data updater."""
|
||||||
self.ezviz_client = api
|
self.ezviz_client = api
|
||||||
self._api_timeout = api_timeout
|
self._api_timeout = api_timeout
|
||||||
update_interval = timedelta(seconds=30)
|
update_interval = timedelta(seconds=30)
|
||||||
|
@ -28,11 +28,11 @@ class EzvizDataUpdateCoordinator(DataUpdateCoordinator):
|
||||||
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=update_interval)
|
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=update_interval)
|
||||||
|
|
||||||
def _update_data(self) -> dict:
|
def _update_data(self) -> dict:
|
||||||
"""Fetch data from Ezviz via camera load function."""
|
"""Fetch data from EZVIZ via camera load function."""
|
||||||
return self.ezviz_client.load_cameras()
|
return self.ezviz_client.load_cameras()
|
||||||
|
|
||||||
async def _async_update_data(self) -> dict:
|
async def _async_update_data(self) -> dict:
|
||||||
"""Fetch data from Ezviz."""
|
"""Fetch data from EZVIZ."""
|
||||||
try:
|
try:
|
||||||
async with timeout(self._api_timeout):
|
async with timeout(self._api_timeout):
|
||||||
return await self.hass.async_add_executor_job(self._update_data)
|
return await self.hass.async_add_executor_job(self._update_data)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""An abstract class common to all Ezviz entities."""
|
"""An abstract class common to all EZVIZ entities."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -11,7 +11,7 @@ from .coordinator import EzvizDataUpdateCoordinator
|
||||||
|
|
||||||
|
|
||||||
class EzvizEntity(CoordinatorEntity[EzvizDataUpdateCoordinator], Entity):
|
class EzvizEntity(CoordinatorEntity[EzvizDataUpdateCoordinator], Entity):
|
||||||
"""Generic entity encapsulating common features of Ezviz device."""
|
"""Generic entity encapsulating common features of EZVIZ device."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"domain": "ezviz",
|
"domain": "ezviz",
|
||||||
"name": "Ezviz",
|
"name": "EZVIZ",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/ezviz",
|
"documentation": "https://www.home-assistant.io/integrations/ezviz",
|
||||||
"dependencies": ["ffmpeg"],
|
"dependencies": ["ffmpeg"],
|
||||||
"codeowners": ["@RenierM26", "@baqs"],
|
"codeowners": ["@RenierM26", "@baqs"],
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""Support for Ezviz sensors."""
|
"""Support for EZVIZ sensors."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
|
@ -44,7 +44,7 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up Ezviz sensors based on a config entry."""
|
"""Set up EZVIZ sensors based on a config entry."""
|
||||||
coordinator: EzvizDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
|
coordinator: EzvizDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
|
||||||
DATA_COORDINATOR
|
DATA_COORDINATOR
|
||||||
]
|
]
|
||||||
|
@ -61,7 +61,7 @@ async def async_setup_entry(
|
||||||
|
|
||||||
|
|
||||||
class EzvizSensor(EzvizEntity, SensorEntity):
|
class EzvizSensor(EzvizEntity, SensorEntity):
|
||||||
"""Representation of a Ezviz sensor."""
|
"""Representation of a EZVIZ sensor."""
|
||||||
|
|
||||||
coordinator: EzvizDataUpdateCoordinator
|
coordinator: EzvizDataUpdateCoordinator
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"flow_title": "{serial}",
|
"flow_title": "{serial}",
|
||||||
"step": {
|
"step": {
|
||||||
"user": {
|
"user": {
|
||||||
"title": "Connect to Ezviz Cloud",
|
"title": "Connect to EZVIZ Cloud",
|
||||||
"data": {
|
"data": {
|
||||||
"username": "[%key:common::config_flow::data::username%]",
|
"username": "[%key:common::config_flow::data::username%]",
|
||||||
"password": "[%key:common::config_flow::data::password%]",
|
"password": "[%key:common::config_flow::data::password%]",
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"user_custom_url": {
|
"user_custom_url": {
|
||||||
"title": "Connect to custom Ezviz URL",
|
"title": "Connect to custom EZVIZ URL",
|
||||||
"description": "Manually specify your region URL",
|
"description": "Manually specify your region URL",
|
||||||
"data": {
|
"data": {
|
||||||
"username": "[%key:common::config_flow::data::username%]",
|
"username": "[%key:common::config_flow::data::username%]",
|
||||||
|
@ -20,8 +20,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"confirm": {
|
"confirm": {
|
||||||
"title": "Discovered Ezviz Camera",
|
"title": "Discovered EZVIZ Camera",
|
||||||
"description": "Enter RTSP credentials for Ezviz camera {serial} with IP {ip_address}",
|
"description": "Enter RTSP credentials for EZVIZ camera {serial} with IP {ip_address}",
|
||||||
"data": {
|
"data": {
|
||||||
"username": "[%key:common::config_flow::data::username%]",
|
"username": "[%key:common::config_flow::data::username%]",
|
||||||
"password": "[%key:common::config_flow::data::password%]"
|
"password": "[%key:common::config_flow::data::password%]"
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured_account": "[%key:common::config_flow::abort::already_configured_account%]",
|
"already_configured_account": "[%key:common::config_flow::abort::already_configured_account%]",
|
||||||
"unknown": "[%key:common::config_flow::error::unknown%]",
|
"unknown": "[%key:common::config_flow::error::unknown%]",
|
||||||
"ezviz_cloud_account_missing": "Ezviz cloud account missing. Please reconfigure Ezviz cloud account"
|
"ezviz_cloud_account_missing": "EZVIZ cloud account missing. Please reconfigure EZVIZ cloud account"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"options": {
|
"options": {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""Support for Ezviz Switch sensors."""
|
"""Support for EZVIZ Switch sensors."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -19,7 +19,7 @@ from .entity import EzvizEntity
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up Ezviz switch based on a config entry."""
|
"""Set up EZVIZ switch based on a config entry."""
|
||||||
coordinator: EzvizDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
|
coordinator: EzvizDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id][
|
||||||
DATA_COORDINATOR
|
DATA_COORDINATOR
|
||||||
]
|
]
|
||||||
|
@ -37,7 +37,7 @@ async def async_setup_entry(
|
||||||
|
|
||||||
|
|
||||||
class EzvizSwitch(EzvizEntity, SwitchEntity):
|
class EzvizSwitch(EzvizEntity, SwitchEntity):
|
||||||
"""Representation of a Ezviz sensor."""
|
"""Representation of a EZVIZ sensor."""
|
||||||
|
|
||||||
_attr_device_class = SwitchDeviceClass.SWITCH
|
_attr_device_class = SwitchDeviceClass.SWITCH
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"config": {
|
"config": {
|
||||||
"abort": {
|
"abort": {
|
||||||
"already_configured_account": "Account is already configured",
|
"already_configured_account": "Account is already configured",
|
||||||
"ezviz_cloud_account_missing": "Ezviz cloud account missing. Please reconfigure Ezviz cloud account",
|
"ezviz_cloud_account_missing": "EZVIZ cloud account missing. Please reconfigure EZVIZ cloud account",
|
||||||
"unknown": "Unexpected error"
|
"unknown": "Unexpected error"
|
||||||
},
|
},
|
||||||
"error": {
|
"error": {
|
||||||
|
@ -17,8 +17,8 @@
|
||||||
"password": "Password",
|
"password": "Password",
|
||||||
"username": "Username"
|
"username": "Username"
|
||||||
},
|
},
|
||||||
"description": "Enter RTSP credentials for Ezviz camera {serial} with IP {ip_address}",
|
"description": "Enter RTSP credentials for EZVIZ camera {serial} with IP {ip_address}",
|
||||||
"title": "Discovered Ezviz Camera"
|
"title": "Discovered EZVIZ Camera"
|
||||||
},
|
},
|
||||||
"user": {
|
"user": {
|
||||||
"data": {
|
"data": {
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
"url": "URL",
|
"url": "URL",
|
||||||
"username": "Username"
|
"username": "Username"
|
||||||
},
|
},
|
||||||
"title": "Connect to Ezviz Cloud"
|
"title": "Connect to EZVIZ Cloud"
|
||||||
},
|
},
|
||||||
"user_custom_url": {
|
"user_custom_url": {
|
||||||
"data": {
|
"data": {
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
"username": "Username"
|
"username": "Username"
|
||||||
},
|
},
|
||||||
"description": "Manually specify your region URL",
|
"description": "Manually specify your region URL",
|
||||||
"title": "Connect to custom Ezviz URL"
|
"title": "Connect to custom EZVIZ URL"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""Tests for the Ezviz integration."""
|
"""Tests for the EZVIZ integration."""
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant.components.ezviz.const import (
|
from homeassistant.components.ezviz.const import (
|
||||||
|
@ -74,7 +74,7 @@ async def init_integration(
|
||||||
options: dict = ENTRY_OPTIONS,
|
options: dict = ENTRY_OPTIONS,
|
||||||
skip_entry_setup: bool = False,
|
skip_entry_setup: bool = False,
|
||||||
) -> MockConfigEntry:
|
) -> MockConfigEntry:
|
||||||
"""Set up the Ezviz integration in Home Assistant."""
|
"""Set up the EZVIZ integration in Home Assistant."""
|
||||||
entry = MockConfigEntry(domain=DOMAIN, data=data, options=options)
|
entry = MockConfigEntry(domain=DOMAIN, data=data, options=options)
|
||||||
entry.add_to_hass(hass)
|
entry.add_to_hass(hass)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
"""Test the Ezviz config flow."""
|
"""Test the EZVIZ config flow."""
|
||||||
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue