Skip to content

Commit

Permalink
Make NoFunction also an entity so that strobe can go off as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Breina committed Nov 10, 2024
1 parent a5401f5 commit 03c673f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
8 changes: 4 additions & 4 deletions custom_components/dmx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,17 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
# print(f"async_setup_entry: {config_entry}")
hass.data.setdefault(DOMAIN, {})

# fixture = parse("fixtures/hydrabeam-300-rgbw.json")
# channels = fixture.select_mode("42-channel")
fixture = parse("fixtures/hydrabeam-300-rgbw.json")
channels = fixture.select_mode("42-channel")

# fixture = parse("fixtures/dj_scan_led.json")
# channels = fixture.select_mode("Normal")

# fixture = parse("fixtures/hotbox-rgbw.json")
# channels = fixture.select_mode("9-channel B")

fixture = parse("fixtures/jbled-a7.json")
channels = fixture.select_mode("Standard 16bit")
# fixture = parse("fixtures/jbled-a7.json")
# channels = fixture.select_mode("Standard 16bit")

entities = create_entities(100, channels)

Expand Down
13 changes: 13 additions & 0 deletions custom_components/dmx/fixture/capability.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,19 @@ def args_to_str(self, *args) -> str:
return s[1:]


class NoFunction(Capability):
"""
A NoFunction capability.
Class name and instance arguments match the fixture format exactly.
"""

def __init__(self, **kwargs):
super().__init__(**kwargs)

def __str__(self):
return self.comment or "NoFunction"


class ShutterStrobe(Capability):
"""
A ShutterStrobe capability.
Expand Down
4 changes: 2 additions & 2 deletions custom_components/dmx/fixture/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ def __parse_channels(available_channels_json: dict,
def __parse_capability(channel: Channel,
capability_json: dict) -> Capability | None:
capability_type = capability_json["type"]
if capability_type == "NoFunction":
return None
# if capability_type == "NoFunction":
# return None

# This is directly mapped to the class names inside capability.py.
capability_obj = getattr(capability, capability_type)
Expand Down

0 comments on commit 03c673f

Please sign in to comment.