miio.gateway.light module

Xiaomi Gateway Light implementation.

class miio.gateway.light.Light(parent: Gateway = None)[source]

Bases: GatewayDevice

Light controls for the gateway.

The gateway LEDs can be controlled using ‘rgb’ or ‘night_light’ methods. The ‘night_light’ methods control the same light as the ‘rgb’ methods, but has a separate memory for brightness and color. Changing the ‘rgb’ light does not affect the stored state of the ‘night_light’, while changing the ‘night_light’ does effect the state of the ‘rgb’ light.

night_light_status()[source]

Get status of the night light. This command only gives the correct status of the LEDs if the last command was a ‘night_light’ command and not a ‘rgb’ light command, otherwise it gives the stored values of the ‘night_light’.

Example:

{“is_on”: false, “brightness”: 0, “rgb”: (0, 0, 0)}

rgb_status()[source]

Get current status of the light. Always represents the current status of the light as opposed to ‘night_light_status’.

Example:

{“is_on”: false, “brightness”: 0, “rgb”: (0, 0, 0)}

set_night_light(brightness: int, rgb: Tuple[int, int, int])[source]

Set gateway night light using brightness and rgb tuple.

set_night_light_brightness(brightness: int)[source]

Set night light brightness (0-100).

set_night_light_color(color_name: str)[source]

Set night light color using color name (‘color_map’ variable in the source holds the valid values).

set_night_light_using_name(color_name: str, brightness: int)[source]

Set night light color (using color name, ‘color_map’ variable in the source holds the valid values) and brightness (0-100).

set_rgb(brightness: int, rgb: Tuple[int, int, int])[source]

Set gateway light using brightness and rgb tuple.

set_rgb_brightness(brightness: int)[source]

Set gateway light brightness (0-100).

set_rgb_color(color_name: str)[source]

Set gateway light color using color name (‘color_map’ variable in the source holds the valid values).

set_rgb_using_name(color_name: str, brightness: int)[source]

Set gateway light color (using color name, ‘color_map’ variable in the source holds the valid values) and brightness (0-100).