Skip to content

Commit

Permalink
Update data when the miner is updated to active.
Browse files Browse the repository at this point in the history
  • Loading branch information
b-rowan committed Apr 7, 2024
1 parent 6529aa5 commit 82907aa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions custom_components/miner/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ async def async_turn_on(self) -> None:
raise TypeError(f"{miner}: Shutdown not supported.")
self._attr_is_on = True
await miner.resume_mining()
self.coordinator.data["is_mining"] = True
self.async_write_ha_state()

async def async_turn_off(self) -> None:
Expand All @@ -98,6 +99,7 @@ async def async_turn_off(self) -> None:
raise TypeError(f"{miner}: Shutdown not supported.")
self._attr_is_on = False
await miner.stop_mining()
self.coordinator.data["is_mining"] = False
self.async_write_ha_state()

@callback
Expand Down

0 comments on commit 82907aa

Please sign in to comment.