Skip to content

Commit

Permalink
fix: ensure consistent state when using flame_height to turn on
Browse files Browse the repository at this point in the history
This works around a quirk in which the eFIRE controller maintains its
own state for on/off which goes out of sync if the fireplace is enabled
by moving the flame height from 0 to a higher value without first
turning the fireplace on through the eFIRE controller.

Signed-off-by: Felix Kaechele <felix@kaechele.ca>
  • Loading branch information
kaechele committed Mar 12, 2023
1 parent 6e68ea7 commit f072fe8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/bonaparte/fireplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,21 @@ async def set_flame_height(self, flame_height: int) -> bool:
if not 0 <= flame_height <= MAX_FLAME_HEIGHT:
msg = "Flame height must be between 0 and 6."
raise ValueError(msg)
# The eFIRE controller does not set the on state if we change
# flame height from 0 to a non-zero value. However, the IFC
# will ignite the burner and set the requested flame height.
# To maintain consistent state we force the eFIRE controller on.
# This has the annoying side-effect that flame height will be
# set to max before being set to the desired value shortly after.
if self._state.flame_height == 0 and flame_height > 0:
_LOGGER.debug(
(
"%s: Turning on via flame_height setting, forcing controller on as"
" well"
),
self.name,
)
await self.power_on()
self._state.flame_height = flame_height
return await self._ifc_cmd2()

Expand Down

0 comments on commit f072fe8

Please sign in to comment.