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

Functions

str _get_mac_offset (str mac_addr, int offset)
 
bool _off_by_one_mac (str firmware)
 
bool async_entry_is_legacy (ConfigEntry entry)
 
Message async_execute_lifx (Callable method)
 
ConfigEntry|None async_get_legacy_entry (HomeAssistant hass)
 
list[Message] async_multi_execute_lifx_with_retries (list[Callable] methods, int attempts, int overall_timeout)
 
int convert_16_to_8 (int value)
 
int convert_8_to_16 (int value)
 
list[float|int|None]|None find_hsbk (HomeAssistant hass, **Any kwargs)
 
str formatted_serial (str serial_number)
 
str get_real_mac_addr (str mac_addr, str firmware)
 
int|None infrared_brightness_option_to_value (str option)
 
str|None infrared_brightness_value_to_option (int value)
 
dict[str, Any] lifx_features (Light bulb)
 
bool mac_matches_serial_number (str mac_addr, str serial_number)
 
list[float|int|None] merge_hsbk (list[float|int|None] base, list[float|int|None] change)
 

Variables

 FIX_MAC_FW = AwesomeVersion("3.70")
 

Detailed Description

Support for LIFX.

Function Documentation

◆ _get_mac_offset()

str homeassistant.components.lifx.util._get_mac_offset ( str  mac_addr,
int  offset 
)
private

Definition at line 155 of file util.py.

◆ _off_by_one_mac()

bool homeassistant.components.lifx.util._off_by_one_mac ( str  firmware)
private
Check if the firmware version has the off by one mac.

Definition at line 161 of file util.py.

◆ async_entry_is_legacy()

bool homeassistant.components.lifx.util.async_entry_is_legacy ( ConfigEntry  entry)
Check if a config entry is the legacy shared one.

Definition at line 43 of file util.py.

◆ async_execute_lifx()

Message homeassistant.components.lifx.util.async_execute_lifx ( Callable  method)
Execute a lifx callback method and wait for a response.

Definition at line 185 of file util.py.

◆ async_get_legacy_entry()

ConfigEntry | None homeassistant.components.lifx.util.async_get_legacy_entry ( HomeAssistant  hass)
Get the legacy config entry.

Definition at line 49 of file util.py.

◆ async_multi_execute_lifx_with_retries()

list[Message] homeassistant.components.lifx.util.async_multi_execute_lifx_with_retries ( list[Callable]  methods,
int  attempts,
int   overall_timeout 
)
Execute multiple lifx callback methods with retries and wait for a response.

This functional will the overall timeout by the number of attempts and
wait for each method to return a result. If we don't get a result
within the split timeout, we will send all methods that did not generate
a response again.

If we don't get a result after all attempts, we will raise an
TimeoutError exception.

Definition at line 194 of file util.py.

◆ convert_16_to_8()

int homeassistant.components.lifx.util.convert_16_to_8 ( int  value)
Scale a 16 bit level into 8 bits.

Definition at line 73 of file util.py.

◆ convert_8_to_16()

int homeassistant.components.lifx.util.convert_8_to_16 ( int  value)
Scale an 8 bit level into 16 bits.

Definition at line 68 of file util.py.

◆ find_hsbk()

list[float | int | None] | None homeassistant.components.lifx.util.find_hsbk ( HomeAssistant  hass,
**Any  kwargs 
)
Find the desired color from a number of possible inputs.

Hue, Saturation, Brightness, Kelvin

Definition at line 86 of file util.py.

◆ formatted_serial()

str homeassistant.components.lifx.util.formatted_serial ( str  serial_number)
Format the serial number to match the HA device registry.

Definition at line 171 of file util.py.

◆ get_real_mac_addr()

str homeassistant.components.lifx.util.get_real_mac_addr ( str  mac_addr,
str  firmware 
)
Increment the last byte of the mac address by one for FW>3.70.

Definition at line 166 of file util.py.

◆ infrared_brightness_option_to_value()

int | None homeassistant.components.lifx.util.infrared_brightness_option_to_value ( str  option)
Convert infrared brightness option to value.

Definition at line 62 of file util.py.

◆ infrared_brightness_value_to_option()

str | None homeassistant.components.lifx.util.infrared_brightness_value_to_option ( int  value)
Convert infrared brightness from value to option.

Definition at line 57 of file util.py.

◆ lifx_features()

dict[str, Any] homeassistant.components.lifx.util.lifx_features ( Light  bulb)
Return a feature map for this bulb, or a default map if unknown.

Definition at line 78 of file util.py.

◆ mac_matches_serial_number()

bool homeassistant.components.lifx.util.mac_matches_serial_number ( str  mac_addr,
str  serial_number 
)
Check if a mac address matches the serial number.

Definition at line 176 of file util.py.

◆ merge_hsbk()

list[float | int | None] homeassistant.components.lifx.util.merge_hsbk ( list[float | int | None]  base,
list[float | int | None]   change 
)
Copy change on top of base, except when None.

Hue, Saturation, Brightness, Kelvin

Definition at line 145 of file util.py.

Variable Documentation

◆ FIX_MAC_FW

homeassistant.components.lifx.util.FIX_MAC_FW = AwesomeVersion("3.70")

Definition at line 39 of file util.py.