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