Cleanup EZVIZ number entity (#98333)
* EZVIZ - Cleanup number entity * NL * Fix naming
This commit is contained in:
parent
00c60151d4
commit
a74d83de66
1 changed files with 3 additions and 5 deletions
|
@ -66,7 +66,7 @@ async def async_setup_entry(
|
||||||
]
|
]
|
||||||
|
|
||||||
async_add_entities(
|
async_add_entities(
|
||||||
EzvizSensor(coordinator, camera, value, entry.entry_id)
|
EzvizNumber(coordinator, camera, value, entry.entry_id)
|
||||||
for camera in coordinator.data
|
for camera in coordinator.data
|
||||||
for capibility, value in coordinator.data[camera]["supportExt"].items()
|
for capibility, value in coordinator.data[camera]["supportExt"].items()
|
||||||
if capibility == NUMBER_TYPE.supported_ext
|
if capibility == NUMBER_TYPE.supported_ext
|
||||||
|
@ -74,11 +74,9 @@ async def async_setup_entry(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class EzvizSensor(EzvizBaseEntity, NumberEntity):
|
class EzvizNumber(EzvizBaseEntity, NumberEntity):
|
||||||
"""Representation of a EZVIZ number entity."""
|
"""Representation of a EZVIZ number entity."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: EzvizDataUpdateCoordinator,
|
coordinator: EzvizDataUpdateCoordinator,
|
||||||
|
@ -86,7 +84,7 @@ class EzvizSensor(EzvizBaseEntity, NumberEntity):
|
||||||
value: str,
|
value: str,
|
||||||
config_entry_id: str,
|
config_entry_id: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the sensor."""
|
"""Initialize the entity."""
|
||||||
super().__init__(coordinator, serial)
|
super().__init__(coordinator, serial)
|
||||||
self.sensitivity_type = 3 if value == "3" else 0
|
self.sensitivity_type = 3 if value == "3" else 0
|
||||||
self._attr_native_max_value = 100 if value == "3" else 6
|
self._attr_native_max_value = 100 if value == "3" else 6
|
||||||
|
|
Loading…
Add table
Reference in a new issue