Fix wrong exposed light for emulated hue (#25581)
* Add auto detect if brightness is supported * Fix * Fix tests * Cleanup
This commit is contained in:
1 parent
3a3f70ef21
commit
8ffc6c05b7
2 files changed
+32
-5
No files matched your search
@@ -517,21 +517,35 @@ def get_entity_state(config, entity):
|
||||
|
||||
def entity_to_json(config, entity, state):
|
||||
"""Convert an entity to its Hue bridge JSON representation."""
|
||||
entity_features = entity.attributes.get(ATTR_SUPPORTED_FEATURES, 0)
|
||||
if entity_features & SUPPORT_BRIGHTNESS:
|
||||
return {
|
||||
'state':
|
||||
{
|
||||
HUE_API_STATE_ON: state[STATE_ON],
|
||||
HUE_API_STATE_BRI: state[STATE_BRIGHTNESS],
|
||||
HUE_API_STATE_HUE: state[STATE_HUE],
|
||||
HUE_API_STATE_SAT: state[STATE_SATURATION],
|
||||
'reachable': True
|
||||
},
|
||||
'type': 'Dimmable light',
|
||||
'name': config.get_entity_name(entity),
|
||||
'modelid': 'HASS123',
|
||||
'uniqueid': entity.entity_id,
|
||||
'swversion': '123'
|
||||
}
|
||||
return {
|
||||
'state':
|
||||
{
|
||||
HUE_API_STATE_ON: state[STATE_ON],
|
||||
HUE_API_STATE_BRI: state[STATE_BRIGHTNESS],
|
||||
HUE_API_STATE_HUE: state[STATE_HUE],
|
||||
HUE_API_STATE_SAT: state[STATE_SATURATION],
|
||||
'reachable': True
|
||||
},
|
||||
'type': 'Dimmable light',
|
||||
'type': 'On/off light',
|
||||
'name': config.get_entity_name(entity),
|
||||
'modelid': 'HASS123',
|
||||
'uniqueid': entity.entity_id,
|
||||
'swversion': '123'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def create_hue_success_response(entity_id, attr, value):
|
||||
|
||||
Reference in new issue
Block a user