Skip to content

Commit

Permalink
Don't discover WLED master and segment lights (#1270)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramstroker committed Nov 13, 2022
1 parent 9ab2901 commit 65d7d5c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom_components/powercalc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import logging
import re
from typing import Optional

import homeassistant.helpers.config_validation as cv
Expand Down Expand Up @@ -336,6 +337,7 @@ async def start_discovery(self):
if (
model_info.manufacturer == MANUFACTURER_WLED
and entity_entry.domain == LIGHT_DOMAIN
and not re.search("master|segment", str(entity_entry.original_name), flags=re.IGNORECASE)
):
self._init_entity_discovery(
source_entity,
Expand Down
14 changes: 14 additions & 0 deletions tests/strategy/test_wled.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,20 @@ async def test_wled_autodiscovery_flow(hass: HomeAssistant):
platform="light",
device_id="wled-device",
),
"light.test_master": RegistryEntry(
entity_id="light.test_master",
unique_id="1234-master",
platform="light",
original_name="Master",
device_id="wled-device",
),
"light.test_segment1": RegistryEntry(
entity_id="light.test_segment1",
unique_id="1234-segment",
platform="light",
original_name="WLED Segment1",
device_id="wled-device",
),
"sensor.test_current": RegistryEntry(
entity_id="sensor.test_current",
unique_id="1234",
Expand Down

0 comments on commit 65d7d5c

Please sign in to comment.