Skip to content

Commit

Permalink
Merge pull request #6 from thecrisb/Basic-xmas-lights
Browse files Browse the repository at this point in the history
Basic xmas lights
  • Loading branch information
thecrisb authored Sep 20, 2023
2 parents ac802a5 + 6669126 commit 10d0b38
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 2 deletions.
3 changes: 3 additions & 0 deletions custom_components/localtuya/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
CONF_COLOR_TEMP_MAX_KELVIN = "color_temp_max_kelvin"
CONF_COLOR_TEMP_REVERSE = "color_temp_reverse"
CONF_MUSIC_MODE = "music_mode"
CONF_CUST_SCENE = "scenes_availible"
CONF_CUST_FRIENDLY = "scenes_availible_friendly"

# switch
CONF_CURRENT = "current"
Expand Down Expand Up @@ -108,6 +110,7 @@
CONF_IDLE_STATUS_VALUE = "idle_status_value"
CONF_RETURNING_STATUS_VALUE = "returning_status_value"
CONF_DOCKED_STATUS_VALUE = "docked_status_value"
CONF_CLEANING_STATUS_VALUE = "cleaning_status_value"
CONF_BATTERY_DP = "battery_dp"
CONF_MODE_DP = "mode_dp"
CONF_MODES = "modes"
Expand Down
14 changes: 12 additions & 2 deletions custom_components/localtuya/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
CONF_COLOR_TEMP_MIN_KELVIN,
CONF_COLOR_TEMP_REVERSE,
CONF_MUSIC_MODE,
CONF_CUST_SCENE,
CONF_CUST_FRIENDLY,
)

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -125,6 +127,8 @@ def flow_schema(dps):
description={"suggested_value": DEFAULT_COLOR_TEMP_REVERSE},
): bool,
vol.Optional(CONF_SCENE): vol.In(dps),
vol.Optional(CONF_CUST_SCENE): str,
vol.Optional(CONF_CUST_FRIENDLY): str,
vol.Optional(
CONF_MUSIC_MODE, default=False, description={"suggested_value": False}
): bool,
Expand Down Expand Up @@ -166,8 +170,14 @@ def __init__(
self._effect = None
self._effect_list = []
self._scenes = None
##WiP
if self.has_config(CONF_SCENE):
if self._config.get(CONF_SCENE) < 20:
if self.has_config(CONF_CUST_SCENE):
cust_vals = self._config[CONF_CUST_SCENE].split(",")
friendly_vals = self._config.get(CONF_CUST_FRIENDLY,self._config[CONF_CUST_SCENE]).split(",")
friendly_vals.extend(cust_vals[len(friendly_vals):])
self._scenes = dict(zip(friendly_vals, cust_vals))
elif self._config.get(CONF_SCENE) < 20:
self._scenes = SCENE_LIST_RGBW_255
elif self._config.get(CONF_BRIGHTNESS) is None:
self._scenes = SCENE_LIST_RGB_1000
Expand Down Expand Up @@ -248,7 +258,7 @@ def supported_features(self):
"""Flag supported features."""
supports = 0
if self.has_config(CONF_BRIGHTNESS):
supports |= SUPPORT_BRIGHTNESS
supports |= SUPPORT_BRIGHTNESS
if self.has_config(CONF_COLOR_TEMP):
supports |= SUPPORT_COLOR_TEMP
if self.has_config(CONF_COLOR):
Expand Down
2 changes: 2 additions & 0 deletions custom_components/localtuya/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
"color_temp_max_kelvin": "Maximum Color Temperature in K",
"music_mode": "Music mode available",
"scene": "Scene",
"scenes_availible": "Override Availible Scene Values (comma-separated)",
"scenes_availible_friendly": "Overridden Scene Names (comma-separated)",
"select_options": "Valid entries, separate entries by a ;",
"select_options_friendly": "User Friendly options, separate entries by a ;",
"fan_speed_control": "Fan Speed Control dps",
Expand Down
2 changes: 2 additions & 0 deletions custom_components/localtuya/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@
"color_temp_max_kelvin": "Massima temperatura di colore in k",
"music_mode": "Modalità musicale disponibile",
"scene": "Scena",
"scenes_availible": "Sostituisci i valori della scena disponibili (separato da virgola)",
"scenes_availible_friendly": "Nomi delle scene sostituiti (separato da virgola)",
"select_options": "Opzioni valide, voci separate da una vigola (;)",
"select_options_friendly": "Opzioni intuitive, voci separate da una virgola",
"fan_speed_control": "DP di controllo di velocità del ventilatore",
Expand Down
2 changes: 2 additions & 0 deletions custom_components/localtuya/translations/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@
"color_temp_max_kelvin": "Temperatura máxima de cor em K",
"music_mode": "Modo de música disponível",
"scene": "Cena",
"scenes_availible": "Substituir valores de cena disponíveis (separados por vírgula)",
"scenes_availible_friendly": "Nomes de cenas substituídos (separados por vírgulas)",
"select_options": "Entradas válidas, entradas separadas por um ;",
"select_options_friendly": "Opções fantasia ​​ao usuário, entradas separadas por um ;",
"fan_speed_control": "Dps de controle de velocidade do ventilador",
Expand Down
2 changes: 2 additions & 0 deletions custom_components/localtuya/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
CONF_CLEAN_RECORD_DP,
CONF_CLEAN_TIME_DP,
CONF_DOCKED_STATUS_VALUE,
CONF_CLEANING_STATUS_VALUE,
CONF_FAN_SPEED_DP,
CONF_FAN_SPEEDS,
CONF_FAULT_DP,
Expand Down Expand Up @@ -52,6 +53,7 @@
DEFAULT_RETURNING_STATUS = "docking"
DEFAULT_DOCKED_STATUS = "charging,chargecompleted"
DEFAULT_MODES = "smart,wall_follow,spiral,single"
DEFAULT_CLEANING_STATUS = "smart_clean,zone_clean,part_clean,wallfollow,selectroom"
DEFAULT_FAN_SPEEDS = "low,normal,high"
DEFAULT_PAUSED_STATE = "paused"
DEFAULT_RETURN_MODE = "chargego"
Expand Down

0 comments on commit 10d0b38

Please sign in to comment.