Skip to content

Commit

Permalink
Merge pull request #520 from WillCodeForCats/code-quality
Browse files Browse the repository at this point in the history
Cleanup for button and binary sensor entities
  • Loading branch information
WillCodeForCats authored Jan 27, 2024
2 parents 90550e2 + 8195257 commit 9e50b78
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions custom_components/solaredge_modbus_multi/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ async def async_setup_entry(


class SolarEdgeBinarySensorBase(CoordinatorEntity, BinarySensorEntity):
"""Base class for SolarEdge binary sensor entities."""

should_poll = False
_attr_has_entity_name = True

Expand Down Expand Up @@ -66,11 +68,9 @@ def _handle_coordinator_update(self) -> None:


class AdvPowerControlEnabled(SolarEdgeBinarySensorBase):
entity_category = EntityCategory.DIAGNOSTIC
"""Grid Control boolean status. This is "AdvancedPwrControlEn" in specs."""

def __init__(self, platform, config_entry, coordinator):
super().__init__(platform, config_entry, coordinator)
"""Initialize the sensor."""
entity_category = EntityCategory.DIAGNOSTIC

@property
def available(self) -> bool:
Expand Down
8 changes: 4 additions & 4 deletions custom_components/solaredge_modbus_multi/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ async def async_setup_entry(


class SolarEdgeButtonBase(CoordinatorEntity, ButtonEntity):
"""Base class for SolarEdge button entities."""

_attr_has_entity_name = True

def __init__(self, platform, config_entry, coordinator):
Expand Down Expand Up @@ -64,11 +66,9 @@ def _handle_coordinator_update(self) -> None:


class SolarEdgeRefreshButton(SolarEdgeButtonBase):
entity_category = EntityCategory.CONFIG
"""Button to request an immediate device data update."""

def __init__(self, platform, config_entry, coordinator):
super().__init__(platform, config_entry, coordinator)
"""Initialize the sensor."""
entity_category = EntityCategory.CONFIG

@property
def unique_id(self) -> str:
Expand Down

0 comments on commit 9e50b78

Please sign in to comment.