Skip to content

Commit

Permalink
Get sunset themes from device
Browse files Browse the repository at this point in the history
  • Loading branch information
theneweinstein committed Feb 18, 2024
1 parent ba7faf3 commit 7b4044c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion custom_components/somneo/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"somneo"
],
"requirements": [
"pysomneo==4.0.2"
"git+https://github.com/theneweinstein/pysomneo.git@retrieve_light_sound#pysomneo==4.1.0"
],
"ssdp": [
{
Expand Down
10 changes: 7 additions & 3 deletions custom_components/somneo/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from homeassistant.const import CONF_NAME
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from pysomneo import SOUND_DUSK
from pysomneo import FM_PRESETS

from .const import (
CUSTOM,
Expand Down Expand Up @@ -85,9 +85,13 @@ class SomneoSunsetSound(SomneoEntity, SelectEntity):
_attr_translation_key = "sunset_sound"
_attr_assumed_state = False
_attr_available = True
_attr_options = [item.replace(" ", "_") for item in SOUND_DUSK.keys()]
_attr_current_option = "soft_rain"

@property
def options(self) -> list:
"""Return a set of selectable options."""
return [item.replace(" ", "_") for item in self.coordinator.somneo.dusk_sound_themes] + [item.replace(" ", "_") for item in FM_PRESETS]

@callback
def _handle_coordinator_update(self) -> None:
_LOGGER.debug(self.coordinator.data["sunset"]["sound"])
Expand All @@ -113,7 +117,7 @@ class SomneoSunsetCurve(SomneoEntity, SelectEntity):
@property
def options(self) -> list:
"""Return a set of selectable options."""
return [item.replace(" ", "_") for item in self.coordinator.somneo.light_curves]
return [item.replace(" ", "_") for item in self.coordinator.somneo.dusk_light_themes]

@callback
def _handle_coordinator_update(self) -> None:
Expand Down

0 comments on commit 7b4044c

Please sign in to comment.