Skip to content

Commit

Permalink
maint: Remove duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerSelwyn committed Apr 24, 2024
1 parent bae957a commit fb4f67b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
class DiscoveryEntity:
"""Base discovery entity class."""

PUBLISH_STATE = False

def __init__(self, hass, publish_retain, platform, publish_state):
"""Initialise the climate class."""
self._hass = hass
Expand Down
7 changes: 3 additions & 4 deletions custom_components/mqtt_discoverystream_alt/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,9 @@ def _build_discovery_class(self, entity_type):
"""Build the discovery class."""
modulename = __name__.removesuffix(".discovery")
module = importlib.import_module(f".classes.{entity_type}", package=modulename)
if hasattr(module.DiscoveryItem, "PUBLISH_STATE"):
publish_state = module.DiscoveryItem.PUBLISH_STATE
else:
publish_state = True

publish_state = module.DiscoveryItem.PUBLISH_STATE

module_class = module.DiscoveryItem(
self._hass,
self._publish_retain,
Expand Down

0 comments on commit fb4f67b

Please sign in to comment.