mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Only construct enum __or__ once in emulated_hue (#97114)
This commit is contained in:
parent
2618bfc073
commit
34dcd98440
@ -110,6 +110,13 @@ UNAUTHORIZED_USER = [
|
|||||||
{"error": {"address": "/", "description": "unauthorized user", "type": "1"}}
|
{"error": {"address": "/", "description": "unauthorized user", "type": "1"}}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
DIMMABLE_SUPPORT_FEATURES = (
|
||||||
|
CoverEntityFeature.SET_POSITION
|
||||||
|
| FanEntityFeature.SET_SPEED
|
||||||
|
| MediaPlayerEntityFeature.VOLUME_SET
|
||||||
|
| ClimateEntityFeature.TARGET_TEMPERATURE
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class HueUnauthorizedUser(HomeAssistantView):
|
class HueUnauthorizedUser(HomeAssistantView):
|
||||||
"""Handle requests to find the emulated hue bridge."""
|
"""Handle requests to find the emulated hue bridge."""
|
||||||
@ -801,12 +808,9 @@ def state_to_json(config: Config, state: State) -> dict[str, Any]:
|
|||||||
HUE_API_STATE_BRI: state_dict[STATE_BRIGHTNESS],
|
HUE_API_STATE_BRI: state_dict[STATE_BRIGHTNESS],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
elif entity_features & (
|
elif entity_features & DIMMABLE_SUPPORT_FEATURES or light.brightness_supported(
|
||||||
CoverEntityFeature.SET_POSITION
|
color_modes
|
||||||
| FanEntityFeature.SET_SPEED
|
):
|
||||||
| MediaPlayerEntityFeature.VOLUME_SET
|
|
||||||
| ClimateEntityFeature.TARGET_TEMPERATURE
|
|
||||||
) or light.brightness_supported(color_modes):
|
|
||||||
# Dimmable light (Zigbee Device ID: 0x0100)
|
# Dimmable light (Zigbee Device ID: 0x0100)
|
||||||
# Supports groups, scenes, on/off and dimming
|
# Supports groups, scenes, on/off and dimming
|
||||||
retval["type"] = "Dimmable light"
|
retval["type"] = "Dimmable light"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user