zweckj / lmcloud

Library to interface with La Marzocco's cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setting prebew/preinfusion times leads to type conflict

rccoleman opened this issue · comments

This function has the on/off times passed in as float, but expects an int, resulting in TypeError being raised:

    async def configure_prebrew(
        self, on_time=5000, off_time=5000, key: int = 1
    ) -> bool:
        """Set Pre-Brew details. Also used for preinfusion (prebrewOnTime=0, prebrewOnTime=ms)."""

        if not isinstance(on_time, int) or not isinstance(off_time, int):
            msg = "Prebrew times must be in ms (integer)"
            _logger.debug(msg)
            raise TypeError(msg)

From the HA integration:

    async def set_prebrew_times(
        self, key: int, seconds_on: float, seconds_off: float
    ) -> None:
        """Set the prebrew times of the machine."""
        await self.configure_prebrew(
            on_time=seconds_on * 1000, off_time=seconds_off * 1000, key=key
        )

Failed to call service lamarzocco/set_preinfusion_time. Service call encountered error: Prebrew times must be in ms (integer)

damn, I should really spend some time on unit tests... fixed in #21