Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions custom_components/govee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
await async_unload_entry(hass, entry)
raise PlatformNotReady()

for component in PLATFORMS:
await hass.config_entries.async_forward_entry_setup(entry, component)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

return True

Expand Down
23 changes: 17 additions & 6 deletions custom_components/govee/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from datetime import timedelta, datetime
import logging

from homeassistant.util.color import value_to_brightness
from propcache import cached_property

from govee_api_laggat import Govee, GoveeDevice, GoveeError
Expand All @@ -27,7 +28,6 @@
COLOR_TEMP_KELVIN_MAX,
)


_LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -156,6 +156,18 @@ def _state(self):
"""Lights internal state."""
return self._device # self._hub.state(self._device)

@property
def color_mode(self) -> ColorMode:
"""Get color mode."""
current = list(self._device.color)
if self._device.color_temp > 0:
return ColorMode.COLOR_TEMP
if list([0, 0, 0]) != current:
return ColorMode.HS
if self._device.brightness > 0:
return ColorMode.BRIGHTNESS
return ColorMode.ONOFF

@cached_property
def supported_color_modes(self) -> set[ColorMode]:
"""Get supported color modes."""
Expand Down Expand Up @@ -289,23 +301,22 @@ def rgb_color(self):
@property
def brightness(self):
"""Return the brightness value."""
# govee is reporting 0 to 254 - home assistant uses 1 to 255
return self._device.brightness + 1
return value_to_brightness((0, 254), self._device.brightness)

@property
def color_temp(self):
def color_temp_kelvin(self):
"""Return the color_temp of the light."""
return self._device.color_temp

@property
def min_color_temp_kelvin(self):
"""Return the coldest color_temp that this light supports."""
return COLOR_TEMP_KELVIN_MAX
return COLOR_TEMP_KELVIN_MIN

@property
def max_color_temp_kelvin(self):
"""Return the warmest color_temp that this light supports."""
return COLOR_TEMP_KELVIN_MIN
return COLOR_TEMP_KELVIN_MAX

@property
def extra_state_attributes(self):
Expand Down
41 changes: 41 additions & 0 deletions custom_components/govee/translations/cs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"title": "Govee",
"config": {
"abort": {
"already_configured": "Je povolena pouze jedna konfigurace."
},
"error": {
"cannot_connect": "Nelze se připojit. Je API-Klíč v pořádku a internetové připojení funkční?",
"unknown": "Neznámá chyba."
},
"step": {
"user": {
"data": {
"api_key": "API klíč",
"delay": "Interval obnovy"
},
"description": "API Klíč získáte v Govee Home Aplikaci. Detailní postup najdete zde https://github.com/LaggAt/hacs-govee/blob/master/README.md"
}
}
},
"options": {
"error": {
"cannot_connect": "Nelze se připojit. Je API-Klíč v pořádku a internetové připojení funkční?",
"unknown": "Neznámá chyba.",
"disabled_attribute_updates_wrong": "Špatný formát, přečtěte si README."
},
"step": {
"user": {
"data": {
"api_key": "API klíč (vyžaduje restart)",
"delay": "Interval obnovy (vyžaduje restart)",
"use_assumed_state": "Použát 'předpokládaný stav' (dvě tlačítka). Výchozí: Ano",
"offline_is_off": "Když je světlo offline, zobrazit jako vynuté (výchozí nezmění stav). Výchozí: Ne",
"disable_attribute_updates": "ZAKÁZAT aktualizace stavu. Přečtěte si README!"
},
"title": "Nastavení",
"description": "Nastavení Govee integrace. Pro více informací jděte na https://github.com/LaggAt/hacs-govee/blob/master/README.md"
}
}
}
}
Loading