Skip to content

Commit

Permalink
refactor: rename SENSOR_MIXER_KEY to AVAILABLE_SENSOR_MIXER_KEYS and …
Browse files Browse the repository at this point in the history
…update sensor creation logic
  • Loading branch information
jontofront committed Dec 6, 2024
1 parent 775d449 commit 37ba755
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions custom_components/econet300/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ def create_mixer_sensor_entity_description(key: str) -> EconetSensorEntityDescri
return entity_description


# Dynamically generate SENSOR_MIXER_KEY
SENSOR_MIXER_KEY = {
# Dynamically generate AVAILABLE_SENSOR_MIXER_KEYS
AVAILABLE_SENSOR_MIXER_KEYS = {
str(i): {f"mixerTemp{i}", f"mixerSetTemp{i}"}
for i in range(1, AVAILABLE_NUMBER_OF_MIXERS + 1)
}
Expand All @@ -161,9 +161,10 @@ def create_mixer_sensors(
"""Create individual sensor descriptions for mixer sensors."""
entities: list[MixerSensor] = []

for i in range(1, AVAILABLE_NUMBER_OF_MIXERS + 1):
for string_mix, mixer_keys in AVAILABLE_SENSOR_MIXER_KEYS.items():
i = int(string_mix)
string_mix = str(i)
mixer_keys = SENSOR_MIXER_KEY.get(string_mix)
mixer_keys = AVAILABLE_SENSOR_MIXER_KEYS.get(string_mix)

if not mixer_keys:
_LOGGER.debug(
Expand Down

0 comments on commit 37ba755

Please sign in to comment.