Skip to content

Commit

Permalink
Fix _is_on binary sensor issue in 2023.06
Browse files Browse the repository at this point in the history
Fixes #16
  • Loading branch information
megakid authored Jun 8, 2023
1 parent 5826b53 commit ba7d1f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions custom_components/octopus_intelligent/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class OctopusIntelligentSlot(CoordinatorEntity, BinarySensorEntity):
def __init__(self, hass, octopus_system, name : str, store_attributes : bool = False, look_ahead_mins : int = 0) -> None:
"""Initialize the binary sensor."""
super().__init__(octopus_system)
self._name = name
self._unique_id = slugify(name)
self._octopus_system = octopus_system
Expand All @@ -61,6 +60,7 @@ def __init__(self, hass, octopus_system, name : str, store_attributes : bool = F

self._attributes = {}
self._is_on = self._is_off_peak()
super().__init__(octopus_system)

def _is_off_peak(self):
mins_looked = 0
Expand Down Expand Up @@ -126,7 +126,6 @@ async def async_will_remove_from_hass(self):
class OctopusIntelligentPlannedDispatchSlot(CoordinatorEntity, BinarySensorEntity):
def __init__(self, hass, octopus_system, name : str) -> None:
"""Initialize the binary sensor."""
super().__init__(octopus_system)
self._name = name
self._unique_id = slugify(name)
self._octopus_system = octopus_system
Expand All @@ -135,6 +134,7 @@ def __init__(self, hass, octopus_system, name : str) -> None:

self._attributes = {}
self._is_on = self._octopus_system.is_off_peak_charging_now()
super().__init__(octopus_system)

@callback
def _handle_coordinator_update(self) -> None:
Expand Down

0 comments on commit ba7d1f6

Please sign in to comment.