Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.emulated_hue.hue_api Namespace Reference

Classes

class  HueAllGroupsStateView
 
class  HueAllLightsStateView
 
class  HueConfigView
 
class  HueFullStateView
 
class  HueGroupView
 
class  HueOneLightChangeView
 
class  HueOneLightStateView
 
class  HueUnauthorizedUser
 
class  HueUsernameView
 

Functions

dict[str, Any] _build_entity_state_dict (State entity)
 
None _clamp_values (dict[str, Any] data)
 
str _entity_unique_id (str entity_id)
 
bool _hass_to_hue_state (State entity)
 
bool _remote_is_allowed (str address)
 
dict[str, Any] create_config_model (Config config, web.Request request)
 
dict[str, Any] create_hue_success_response (str entity_number, str attr, str value)
 
dict[str, Any] create_list_of_entities (Config config, web.Request request)
 
dict[str, Any] get_entity_state_dict (Config config, State entity)
 
int hass_to_hue_brightness (int value)
 
int hue_brightness_to_hass (int value)
 
bool state_supports_hue_brightness (State state, Iterable[ColorMode] color_modes)
 
dict[str, Any] state_to_json (Config config, State state)
 
None wait_for_state_change_or_timeout (core.HomeAssistant hass, str entity_id, float timeout)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
dictionary DIMMABLE_SUPPORTED_FEATURES_BY_DOMAIN
 
dictionary ENTITY_FEATURES_BY_DOMAIN
 
string HUE_API_STATE_BRI = "bri"
 
int HUE_API_STATE_BRI_MAX = 254
 
int HUE_API_STATE_BRI_MIN = 1
 
string HUE_API_STATE_COLORMODE = "colormode"
 
string HUE_API_STATE_CT = "ct"
 
int HUE_API_STATE_CT_MAX = 500
 
int HUE_API_STATE_CT_MIN = 153
 
string HUE_API_STATE_EFFECT = "effect"
 
string HUE_API_STATE_HUE = "hue"
 
int HUE_API_STATE_HUE_MAX = 65535
 
int HUE_API_STATE_HUE_MIN = 0
 
string HUE_API_STATE_ON = "on"
 
string HUE_API_STATE_SAT = "sat"
 
int HUE_API_STATE_SAT_MAX = 254
 
int HUE_API_STATE_SAT_MIN = 0
 
string HUE_API_STATE_TRANSITION = "transitiontime"
 
string HUE_API_STATE_XY = "xy"
 
string HUE_API_USERNAME = "nouser"
 
string STATE_BRIGHTNESS = "bri"
 
float STATE_CACHED_TIMEOUT = 2.0
 
float STATE_CHANGE_WAIT_TIMEOUT = 5.0
 
string STATE_COLOR_TEMP = "ct"
 
string STATE_COLORMODE = "colormode"
 
string STATE_HUE = "hue"
 
string STATE_SATURATION = "sat"
 
string STATE_TRANSITION = "tt"
 
string STATE_XY = "xy"
 
list UNAUTHORIZED_USER
 

Detailed Description

Support for a Hue API to control Home Assistant.

Function Documentation

◆ _build_entity_state_dict()

dict[str, Any] homeassistant.components.emulated_hue.hue_api._build_entity_state_dict ( State  entity)
private
Build a state dict for an entity.

Definition at line 681 of file hue_api.py.

◆ _clamp_values()

None homeassistant.components.emulated_hue.hue_api._clamp_values ( dict[str, Any]  data)
private
Clamp brightness, hue, saturation, and color temp to valid values.

Definition at line 736 of file hue_api.py.

◆ _entity_unique_id()

str homeassistant.components.emulated_hue.hue_api._entity_unique_id ( str  entity_id)
private
Return the emulated_hue unique id for the entity_id.

Definition at line 749 of file hue_api.py.

◆ _hass_to_hue_state()

bool homeassistant.components.emulated_hue.hue_api._hass_to_hue_state ( State  entity)
private
Convert hass entity states to simple True/False on/off state for Hue.

Definition at line 903 of file hue_api.py.

◆ _remote_is_allowed()

bool homeassistant.components.emulated_hue.hue_api._remote_is_allowed ( str  address)
private
Check if remote address is allowed.

Definition at line 133 of file hue_api.py.

◆ create_config_model()

dict[str, Any] homeassistant.components.emulated_hue.hue_api.create_config_model ( Config  config,
web.Request  request 
)
Create a config resource.

Definition at line 870 of file hue_api.py.

◆ create_hue_success_response()

dict[str, Any] homeassistant.components.emulated_hue.hue_api.create_hue_success_response ( str  entity_number,
str  attr,
str   value 
)
Create a success response for an attribute set on a light.

Definition at line 862 of file hue_api.py.

◆ create_list_of_entities()

dict[str, Any] homeassistant.components.emulated_hue.hue_api.create_list_of_entities ( Config  config,
web.Request  request 
)
Create a list of all entities.

Definition at line 883 of file hue_api.py.

◆ get_entity_state_dict()

dict[str, Any] homeassistant.components.emulated_hue.hue_api.get_entity_state_dict ( Config  config,
State  entity 
)
Retrieve and convert state and brightness values for an entity.

Definition at line 637 of file hue_api.py.

◆ hass_to_hue_brightness()

int homeassistant.components.emulated_hue.hue_api.hass_to_hue_brightness ( int  value)
Convert hass brightness 0..255 to hue 1..254 scale.

Definition at line 898 of file hue_api.py.

◆ hue_brightness_to_hass()

int homeassistant.components.emulated_hue.hue_api.hue_brightness_to_hass ( int  value)
Convert hue brightness 1..254 to hass format 0..255.

Definition at line 893 of file hue_api.py.

◆ state_supports_hue_brightness()

bool homeassistant.components.emulated_hue.hue_api.state_supports_hue_brightness ( State  state,
Iterable[ColorMode]   color_modes 
)
Return True if the state supports brightness.

Definition at line 847 of file hue_api.py.

◆ state_to_json()

dict[str, Any] homeassistant.components.emulated_hue.hue_api.state_to_json ( Config  config,
State  state 
)
Convert an entity to its Hue bridge JSON representation.

Definition at line 759 of file hue_api.py.

◆ wait_for_state_change_or_timeout()

None homeassistant.components.emulated_hue.hue_api.wait_for_state_change_or_timeout ( core.HomeAssistant  hass,
str  entity_id,
float   timeout 
)
Wait for an entity to change state.

Definition at line 908 of file hue_api.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.emulated_hue.hue_api._LOGGER = logging.getLogger(__name__)
private

Definition at line 75 of file hue_api.py.

◆ DIMMABLE_SUPPORTED_FEATURES_BY_DOMAIN

dictionary homeassistant.components.emulated_hue.hue_api.DIMMABLE_SUPPORTED_FEATURES_BY_DOMAIN
Initial value:
1 = {
2  cover.DOMAIN: CoverEntityFeature.SET_POSITION,
3  fan.DOMAIN: FanEntityFeature.SET_SPEED,
4  media_player.DOMAIN: MediaPlayerEntityFeature.VOLUME_SET,
5  climate.DOMAIN: ClimateEntityFeature.TARGET_TEMPERATURE,
6 }

Definition at line 117 of file hue_api.py.

◆ ENTITY_FEATURES_BY_DOMAIN

dictionary homeassistant.components.emulated_hue.hue_api.ENTITY_FEATURES_BY_DOMAIN
Initial value:
1 = {
2  cover.DOMAIN: CoverEntityFeature,
3  fan.DOMAIN: FanEntityFeature,
4  media_player.DOMAIN: MediaPlayerEntityFeature,
5  climate.DOMAIN: ClimateEntityFeature,
6 }

Definition at line 124 of file hue_api.py.

◆ HUE_API_STATE_BRI

string homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_BRI = "bri"

Definition at line 93 of file hue_api.py.

◆ HUE_API_STATE_BRI_MAX

int homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_BRI_MAX = 254

Definition at line 104 of file hue_api.py.

◆ HUE_API_STATE_BRI_MIN

int homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_BRI_MIN = 1

Definition at line 103 of file hue_api.py.

◆ HUE_API_STATE_COLORMODE

string homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_COLORMODE = "colormode"

Definition at line 94 of file hue_api.py.

◆ HUE_API_STATE_CT

string homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_CT = "ct"

Definition at line 97 of file hue_api.py.

◆ HUE_API_STATE_CT_MAX

int homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_CT_MAX = 500

Definition at line 110 of file hue_api.py.

◆ HUE_API_STATE_CT_MIN

int homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_CT_MIN = 153

Definition at line 109 of file hue_api.py.

◆ HUE_API_STATE_EFFECT

string homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_EFFECT = "effect"

Definition at line 99 of file hue_api.py.

◆ HUE_API_STATE_HUE

string homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_HUE = "hue"

Definition at line 95 of file hue_api.py.

◆ HUE_API_STATE_HUE_MAX

int homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_HUE_MAX = 65535

Definition at line 106 of file hue_api.py.

◆ HUE_API_STATE_HUE_MIN

int homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_HUE_MIN = 0

Definition at line 105 of file hue_api.py.

◆ HUE_API_STATE_ON

string homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_ON = "on"

Definition at line 92 of file hue_api.py.

◆ HUE_API_STATE_SAT

string homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_SAT = "sat"

Definition at line 96 of file hue_api.py.

◆ HUE_API_STATE_SAT_MAX

int homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_SAT_MAX = 254

Definition at line 108 of file hue_api.py.

◆ HUE_API_STATE_SAT_MIN

int homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_SAT_MIN = 0

Definition at line 107 of file hue_api.py.

◆ HUE_API_STATE_TRANSITION

string homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_TRANSITION = "transitiontime"

Definition at line 100 of file hue_api.py.

◆ HUE_API_STATE_XY

string homeassistant.components.emulated_hue.hue_api.HUE_API_STATE_XY = "xy"

Definition at line 98 of file hue_api.py.

◆ HUE_API_USERNAME

string homeassistant.components.emulated_hue.hue_api.HUE_API_USERNAME = "nouser"

Definition at line 112 of file hue_api.py.

◆ STATE_BRIGHTNESS

string homeassistant.components.emulated_hue.hue_api.STATE_BRIGHTNESS = "bri"

Definition at line 83 of file hue_api.py.

◆ STATE_CACHED_TIMEOUT

float homeassistant.components.emulated_hue.hue_api.STATE_CACHED_TIMEOUT = 2.0

Definition at line 81 of file hue_api.py.

◆ STATE_CHANGE_WAIT_TIMEOUT

float homeassistant.components.emulated_hue.hue_api.STATE_CHANGE_WAIT_TIMEOUT = 5.0

Definition at line 79 of file hue_api.py.

◆ STATE_COLOR_TEMP

string homeassistant.components.emulated_hue.hue_api.STATE_COLOR_TEMP = "ct"

Definition at line 87 of file hue_api.py.

◆ STATE_COLORMODE

string homeassistant.components.emulated_hue.hue_api.STATE_COLORMODE = "colormode"

Definition at line 84 of file hue_api.py.

◆ STATE_HUE

string homeassistant.components.emulated_hue.hue_api.STATE_HUE = "hue"

Definition at line 85 of file hue_api.py.

◆ STATE_SATURATION

string homeassistant.components.emulated_hue.hue_api.STATE_SATURATION = "sat"

Definition at line 86 of file hue_api.py.

◆ STATE_TRANSITION

string homeassistant.components.emulated_hue.hue_api.STATE_TRANSITION = "tt"

Definition at line 88 of file hue_api.py.

◆ STATE_XY

string homeassistant.components.emulated_hue.hue_api.STATE_XY = "xy"

Definition at line 89 of file hue_api.py.

◆ UNAUTHORIZED_USER

list homeassistant.components.emulated_hue.hue_api.UNAUTHORIZED_USER
Initial value:
1 = [
2  {"error": {"address": "/", "description": "unauthorized user", "type": "1"}}
3 ]

Definition at line 113 of file hue_api.py.