miio.utils module

miio.utils.brightness_and_color_to_int(brightness: int, color: Tuple[int, int, int]) int[source]
miio.utils.deprecated(reason)[source]

This is a decorator which can be used to mark functions and classes as deprecated. It will result in a warning being emitted when the function is used.

From https://stackoverflow.com/a/40301488

miio.utils.int_to_brightness(x: int) int[source]

Return brightness (0-100) from integer.

miio.utils.int_to_rgb(x: int) Tuple[int, int, int][source]

Return a RGB tuple from integer.

miio.utils.pretty_seconds(x: float) timedelta[source]

Return a timedelta object from seconds.

miio.utils.pretty_time(x: float) datetime[source]

Return a datetime object from unix timestamp.

miio.utils.rgb_to_int(x: Tuple[int, int, int]) int[source]

Return an integer from RGB tuple.