Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.flux_led.util Namespace Reference

Functions

int _effect_brightness (int brightness)
 
ColorMode _flux_color_mode_to_hass (str|None flux_color_mode, set[str] flux_color_modes)
 
set[str] _hass_color_modes (AIOWifiLedBulb device)
 
str _human_readable_option (str const_option)
 
bool _is_zero_rgb_brightness (tuple[int, int, int] rgb)
 
tuple[int, int, int] _min_rgb_brightness (tuple[int, int, int] rgb)
 
tuple[int, int, int, int] _min_rgbw_brightness (tuple[int, int, int, int] rgbw, tuple[int, int, int, int] current_rgbw)
 
tuple[int, int, int, int, int] _min_rgbwc_brightness (tuple[int, int, int, int, int] rgbwc, tuple[int, int, int, int, int] current_rgbwc)
 
tuple[int, int, int] _min_scaled_rgb_brightness (tuple[int, int, int] rgb)
 
MultiColorEffects _str_to_multi_color_effect (str effect_str)
 
str|None format_as_flux_mac (str|None mac)
 
bool mac_matches_by_one (str formatted_mac_1, str formatted_mac_2)
 

Detailed Description

Utils for Magic Home.

Function Documentation

◆ _effect_brightness()

int homeassistant.components.flux_led.util._effect_brightness ( int  brightness)
private
Convert hass brightness to effect brightness.

Definition at line 55 of file util.py.

◆ _flux_color_mode_to_hass()

ColorMode homeassistant.components.flux_led.util._flux_color_mode_to_hass ( str | None  flux_color_mode,
set[str]   flux_color_modes 
)
private
Map the flux color mode to Home Assistant color mode.

Definition at line 42 of file util.py.

◆ _hass_color_modes()

set[str] homeassistant.components.flux_led.util._hass_color_modes ( AIOWifiLedBulb  device)
private

Definition at line 14 of file util.py.

◆ _human_readable_option()

str homeassistant.components.flux_led.util._human_readable_option ( str  const_option)
private

Definition at line 26 of file util.py.

◆ _is_zero_rgb_brightness()

bool homeassistant.components.flux_led.util._is_zero_rgb_brightness ( tuple[int, int, int]  rgb)
private
RGB brightness is zero.

Definition at line 69 of file util.py.

◆ _min_rgb_brightness()

tuple[int, int, int] homeassistant.components.flux_led.util._min_rgb_brightness ( tuple[int, int, int]  rgb)
private
Ensure the RGB value will not turn off the device from a turn on command.

Definition at line 74 of file util.py.

◆ _min_rgbw_brightness()

tuple[int, int, int, int] homeassistant.components.flux_led.util._min_rgbw_brightness ( tuple[int, int, int, int]  rgbw,
tuple[int, int, int, int]   current_rgbw 
)
private
Ensure the RGBW value will not turn off the device from a turn on command.

For RGBW, we also need to ensure that there is at least one
value in the RGB fields or the device will switch to CCT mode unexpectedly.

If the new value being set is all zeros, scale the current
color to brightness of 1 so we do not unexpected switch to white

Definition at line 86 of file util.py.

◆ _min_rgbwc_brightness()

tuple[int, int, int, int, int] homeassistant.components.flux_led.util._min_rgbwc_brightness ( tuple[int, int, int, int, int]  rgbwc,
tuple[int, int, int, int, int]   current_rgbwc 
)
private
Ensure the RGBWC value will not turn off the device from a turn on command.

For RGBWC, we also need to ensure that there is at least one
value in the RGB fields or the device will switch to CCT mode unexpectedly

If the new value being set is all zeros, scale the current
color to brightness of 1 so we do not unexpected switch to white

Definition at line 102 of file util.py.

◆ _min_scaled_rgb_brightness()

tuple[int, int, int] homeassistant.components.flux_led.util._min_scaled_rgb_brightness ( tuple[int, int, int]  rgb)
private
Scale an RGB tuple to minimum brightness.

Definition at line 81 of file util.py.

◆ _str_to_multi_color_effect()

MultiColorEffects homeassistant.components.flux_led.util._str_to_multi_color_effect ( str  effect_str)
private
Convert an multicolor effect string to MultiColorEffects.

Definition at line 60 of file util.py.

◆ format_as_flux_mac()

str | None homeassistant.components.flux_led.util.format_as_flux_mac ( str | None  mac)
Convert a device registry formatted mac to flux mac.

Definition at line 21 of file util.py.

◆ mac_matches_by_one()

bool homeassistant.components.flux_led.util.mac_matches_by_one ( str  formatted_mac_1,
str  formatted_mac_2 
)
Check if a mac address is only one digit off.

Some of the devices have two mac addresses which are
one off from each other. We need to treat them as the same
since its the same device.

Definition at line 30 of file util.py.