Rename Eufy integration to EufyHome (#86065)
This commit is contained in:
parent
a83318f373
commit
37c1052cce
5 changed files with 24 additions and 21 deletions
|
@ -1,4 +1,4 @@
|
|||
"""Support for Eufy devices."""
|
||||
"""Support for EufyHome devices."""
|
||||
import lakeside
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -55,7 +55,7 @@ PLATFORMS = {
|
|||
|
||||
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up Eufy devices."""
|
||||
"""Set up EufyHome devices."""
|
||||
|
||||
if CONF_USERNAME in config[DOMAIN] and CONF_PASSWORD in config[DOMAIN]:
|
||||
data = lakeside.get_devices(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""Support for Eufy lights."""
|
||||
"""Support for EufyHome lights."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -21,8 +21,8 @@ from homeassistant.util.color import (
|
|||
color_temperature_mired_to_kelvin as mired_to_kelvin,
|
||||
)
|
||||
|
||||
EUFY_MAX_KELVIN = 6500
|
||||
EUFY_MIN_KELVIN = 2700
|
||||
EUFYHOME_MAX_KELVIN = 6500
|
||||
EUFYHOME_MIN_KELVIN = 2700
|
||||
|
||||
|
||||
def setup_platform(
|
||||
|
@ -31,14 +31,14 @@ def setup_platform(
|
|||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up Eufy bulbs."""
|
||||
"""Set up EufyHome bulbs."""
|
||||
if discovery_info is None:
|
||||
return
|
||||
add_entities([EufyLight(discovery_info)], True)
|
||||
add_entities([EufyHomeLight(discovery_info)], True)
|
||||
|
||||
|
||||
class EufyLight(LightEntity):
|
||||
"""Representation of a Eufy light."""
|
||||
class EufyHomeLight(LightEntity):
|
||||
"""Representation of a EufyHome light."""
|
||||
|
||||
def __init__(self, device):
|
||||
"""Initialize the light."""
|
||||
|
@ -97,18 +97,19 @@ class EufyLight(LightEntity):
|
|||
@property
|
||||
def min_mireds(self) -> int:
|
||||
"""Return minimum supported color temperature."""
|
||||
return kelvin_to_mired(EUFY_MAX_KELVIN)
|
||||
return kelvin_to_mired(EUFYHOME_MAX_KELVIN)
|
||||
|
||||
@property
|
||||
def max_mireds(self) -> int:
|
||||
"""Return maximum supported color temperature."""
|
||||
return kelvin_to_mired(EUFY_MIN_KELVIN)
|
||||
return kelvin_to_mired(EUFYHOME_MIN_KELVIN)
|
||||
|
||||
@property
|
||||
def color_temp(self):
|
||||
"""Return the color temperature of this light."""
|
||||
temp_in_k = int(
|
||||
EUFY_MIN_KELVIN + (self._temp * (EUFY_MAX_KELVIN - EUFY_MIN_KELVIN) / 100)
|
||||
EUFYHOME_MIN_KELVIN
|
||||
+ (self._temp * (EUFYHOME_MAX_KELVIN - EUFYHOME_MIN_KELVIN) / 100)
|
||||
)
|
||||
return kelvin_to_mired(temp_in_k)
|
||||
|
||||
|
@ -146,8 +147,10 @@ class EufyLight(LightEntity):
|
|||
if colortemp is not None:
|
||||
self._colormode = False
|
||||
temp_in_k = mired_to_kelvin(colortemp)
|
||||
relative_temp = temp_in_k - EUFY_MIN_KELVIN
|
||||
temp = int(relative_temp * 100 / (EUFY_MAX_KELVIN - EUFY_MIN_KELVIN))
|
||||
relative_temp = temp_in_k - EUFYHOME_MIN_KELVIN
|
||||
temp = int(
|
||||
relative_temp * 100 / (EUFYHOME_MAX_KELVIN - EUFYHOME_MIN_KELVIN)
|
||||
)
|
||||
else:
|
||||
temp = None
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"domain": "eufy",
|
||||
"name": "eufy",
|
||||
"name": "EufyHome",
|
||||
"documentation": "https://www.home-assistant.io/integrations/eufy",
|
||||
"requirements": ["lakeside==0.12"],
|
||||
"codeowners": [],
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""Support for Eufy switches."""
|
||||
"""Support for EufyHome switches."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
@ -17,14 +17,14 @@ def setup_platform(
|
|||
add_entities: AddEntitiesCallback,
|
||||
discovery_info: DiscoveryInfoType | None = None,
|
||||
) -> None:
|
||||
"""Set up Eufy switches."""
|
||||
"""Set up EufyHome switches."""
|
||||
if discovery_info is None:
|
||||
return
|
||||
add_entities([EufySwitch(discovery_info)], True)
|
||||
add_entities([EufyHomeSwitch(discovery_info)], True)
|
||||
|
||||
|
||||
class EufySwitch(SwitchEntity):
|
||||
"""Representation of a Eufy switch."""
|
||||
class EufyHomeSwitch(SwitchEntity):
|
||||
"""Representation of a EufyHome switch."""
|
||||
|
||||
def __init__(self, device):
|
||||
"""Initialize the light."""
|
||||
|
|
|
@ -1486,7 +1486,7 @@
|
|||
"integration_type": "hub",
|
||||
"config_flow": false,
|
||||
"iot_class": "local_polling",
|
||||
"name": "eufy"
|
||||
"name": "EufyHome"
|
||||
},
|
||||
"eufylife_ble": {
|
||||
"integration_type": "device",
|
||||
|
|
Loading…
Add table
Reference in a new issue