Bump aiohue library to 4.6.1 (#85504)
* Bump aiohue to 4.6.0 * fix device name for lights * fix name for groups too * ignore smart scenes * bump to 4.6.1 instead * fix test fixture * update tests * fix scene test
This commit is contained in:
parent
86ab5f76e0
commit
c181fb6de0
9 changed files with 27 additions and 40 deletions
|
@ -3,7 +3,7 @@
|
||||||
"name": "Philips Hue",
|
"name": "Philips Hue",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/hue",
|
"documentation": "https://www.home-assistant.io/integrations/hue",
|
||||||
"requirements": ["aiohue==4.5.0"],
|
"requirements": ["aiohue==4.6.1"],
|
||||||
"ssdp": [
|
"ssdp": [
|
||||||
{
|
{
|
||||||
"manufacturer": "Royal Philips Electronics",
|
"manufacturer": "Royal Philips Electronics",
|
||||||
|
|
|
@ -47,10 +47,10 @@ async def async_setup_entry(
|
||||||
@callback
|
@callback
|
||||||
def async_add_entity(event_type: EventType, resource: HueScene) -> None:
|
def async_add_entity(event_type: EventType, resource: HueScene) -> None:
|
||||||
"""Add entity from Hue resource."""
|
"""Add entity from Hue resource."""
|
||||||
async_add_entities([HueSceneEntity(bridge, api.scenes, resource)])
|
async_add_entities([HueSceneEntity(bridge, api.scenes.scene, resource)])
|
||||||
|
|
||||||
# add all current items in controller
|
# add all current items in controller
|
||||||
for item in api.scenes:
|
for item in api.scenes.scene:
|
||||||
async_add_entity(EventType.RESOURCE_ADDED, item)
|
async_add_entity(EventType.RESOURCE_ADDED, item)
|
||||||
|
|
||||||
# register listener for new items only
|
# register listener for new items only
|
||||||
|
|
|
@ -71,11 +71,11 @@ class HueBaseEntity(Entity):
|
||||||
# creating a pretty name for device-less entities (e.g. groups/scenes)
|
# creating a pretty name for device-less entities (e.g. groups/scenes)
|
||||||
# should be handled in the platform instead
|
# should be handled in the platform instead
|
||||||
return self.resource.type.value
|
return self.resource.type.value
|
||||||
# if resource is a light, use the name from metadata
|
|
||||||
if self.resource.type == ResourceTypes.LIGHT:
|
|
||||||
return self.resource.name
|
|
||||||
# for sensors etc, use devicename + pretty name of type
|
|
||||||
dev_name = self.device.metadata.name
|
dev_name = self.device.metadata.name
|
||||||
|
# if resource is a light, use the device name itself
|
||||||
|
if self.resource.type == ResourceTypes.LIGHT:
|
||||||
|
return dev_name
|
||||||
|
# for sensors etc, use devicename + pretty name of type
|
||||||
type_title = RESOURCE_TYPE_NAMES.get(
|
type_title = RESOURCE_TYPE_NAMES.get(
|
||||||
self.resource.type, self.resource.type.value.replace("_", " ").title()
|
self.resource.type, self.resource.type.value.replace("_", " ").title()
|
||||||
)
|
)
|
||||||
|
|
|
@ -120,7 +120,10 @@ class GroupedHueLight(HueBaseEntity, LightEntity):
|
||||||
scenes = {
|
scenes = {
|
||||||
x.metadata.name for x in self.api.scenes if x.group.rid == self.group.id
|
x.metadata.name for x in self.api.scenes if x.group.rid == self.group.id
|
||||||
}
|
}
|
||||||
lights = {x.metadata.name for x in self.controller.get_lights(self.resource.id)}
|
lights = {
|
||||||
|
self.controller.get_device(x.id).metadata.name
|
||||||
|
for x in self.controller.get_lights(self.resource.id)
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
"is_hue_group": True,
|
"is_hue_group": True,
|
||||||
"hue_scenes": scenes,
|
"hue_scenes": scenes,
|
||||||
|
|
|
@ -184,7 +184,7 @@ aiohomekit==2.4.3
|
||||||
aiohttp_cors==0.7.0
|
aiohttp_cors==0.7.0
|
||||||
|
|
||||||
# homeassistant.components.hue
|
# homeassistant.components.hue
|
||||||
aiohue==4.5.0
|
aiohue==4.6.1
|
||||||
|
|
||||||
# homeassistant.components.imap
|
# homeassistant.components.imap
|
||||||
aioimaplib==1.0.1
|
aioimaplib==1.0.1
|
||||||
|
|
|
@ -168,7 +168,7 @@ aiohomekit==2.4.3
|
||||||
aiohttp_cors==0.7.0
|
aiohttp_cors==0.7.0
|
||||||
|
|
||||||
# homeassistant.components.hue
|
# homeassistant.components.hue
|
||||||
aiohue==4.5.0
|
aiohue==4.6.1
|
||||||
|
|
||||||
# homeassistant.components.imap
|
# homeassistant.components.imap
|
||||||
aioimaplib==1.0.1
|
aioimaplib==1.0.1
|
||||||
|
|
|
@ -32,7 +32,6 @@ FAKE_LIGHT = {
|
||||||
},
|
},
|
||||||
"id": "fake_light_id_1",
|
"id": "fake_light_id_1",
|
||||||
"id_v1": "/lights/1",
|
"id_v1": "/lights/1",
|
||||||
"metadata": {"archetype": "unknown", "name": "Hue fake light"},
|
|
||||||
"mode": "normal",
|
"mode": "normal",
|
||||||
"on": {"on": False},
|
"on": {"on": False},
|
||||||
"owner": {"rid": "fake_device_id_1", "rtype": "device"},
|
"owner": {"rid": "fake_device_id_1", "rtype": "device"},
|
||||||
|
@ -93,5 +92,6 @@ FAKE_SCENE = {
|
||||||
},
|
},
|
||||||
"palette": {"color": [], "color_temperature": [], "dimming": []},
|
"palette": {"color": [], "color_temperature": [], "dimming": []},
|
||||||
"speed": 0.5,
|
"speed": 0.5,
|
||||||
|
"auto_dynamic": False,
|
||||||
"type": "scene",
|
"type": "scene",
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,6 +168,7 @@
|
||||||
"dimming": []
|
"dimming": []
|
||||||
},
|
},
|
||||||
"speed": 0.6269841194152832,
|
"speed": 0.6269841194152832,
|
||||||
|
"auto_dynamic": false,
|
||||||
"type": "scene"
|
"type": "scene"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -220,6 +221,7 @@
|
||||||
"dimming": []
|
"dimming": []
|
||||||
},
|
},
|
||||||
"speed": 0.5,
|
"speed": 0.5,
|
||||||
|
"auto_dynamic": false,
|
||||||
"type": "scene"
|
"type": "scene"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -624,14 +626,12 @@
|
||||||
},
|
},
|
||||||
"effects": {
|
"effects": {
|
||||||
"status_values": ["no_effect", "candle", "fire"],
|
"status_values": ["no_effect", "candle", "fire"],
|
||||||
"status": "no_effect"
|
"status": "no_effect",
|
||||||
|
"effect_values": ["no_effect", "candle", "fire"],
|
||||||
|
"effect": "no_effect"
|
||||||
},
|
},
|
||||||
"id": "02cba059-9c2c-4d45-97e4-4f79b1bfbaa1",
|
"id": "02cba059-9c2c-4d45-97e4-4f79b1bfbaa1",
|
||||||
"id_v1": "/lights/29",
|
"id_v1": "/lights/29",
|
||||||
"metadata": {
|
|
||||||
"archetype": "floor_shade",
|
|
||||||
"name": "Hue light with color and color temperature 1"
|
|
||||||
},
|
|
||||||
"mode": "normal",
|
"mode": "normal",
|
||||||
"on": {
|
"on": {
|
||||||
"on": true
|
"on": true
|
||||||
|
@ -666,18 +666,18 @@
|
||||||
},
|
},
|
||||||
"effects": {
|
"effects": {
|
||||||
"status_values": ["no_effect", "candle"],
|
"status_values": ["no_effect", "candle"],
|
||||||
"status": "no_effect"
|
"status": "no_effect",
|
||||||
|
"effect_values": ["no_effect", "candle", "fire"],
|
||||||
|
"effect": "no_effect"
|
||||||
},
|
},
|
||||||
"timed_effects": {
|
"timed_effects": {
|
||||||
"status_values": ["no_effect", "sunrise"],
|
"status_values": ["no_effect", "sunrise"],
|
||||||
"status": "no_effect"
|
"status": "no_effect",
|
||||||
|
"effect_values": ["no_effect", "sunrise"],
|
||||||
|
"effect": "no_effect"
|
||||||
},
|
},
|
||||||
"id": "3a6710fa-4474-4eba-b533-5e6e72968feb",
|
"id": "3a6710fa-4474-4eba-b533-5e6e72968feb",
|
||||||
"id_v1": "/lights/4",
|
"id_v1": "/lights/4",
|
||||||
"metadata": {
|
|
||||||
"archetype": "ceiling_round",
|
|
||||||
"name": "Hue light with color temperature only"
|
|
||||||
},
|
|
||||||
"mode": "normal",
|
"mode": "normal",
|
||||||
"on": {
|
"on": {
|
||||||
"on": false
|
"on": false
|
||||||
|
@ -733,10 +733,6 @@
|
||||||
},
|
},
|
||||||
"id": "b3fe71ef-d0ef-48de-9355-d9e604377df0",
|
"id": "b3fe71ef-d0ef-48de-9355-d9e604377df0",
|
||||||
"id_v1": "/lights/16",
|
"id_v1": "/lights/16",
|
||||||
"metadata": {
|
|
||||||
"archetype": "hue_lightstrip",
|
|
||||||
"name": "Hue light with color and color temperature 2"
|
|
||||||
},
|
|
||||||
"mode": "normal",
|
"mode": "normal",
|
||||||
"on": {
|
"on": {
|
||||||
"on": true
|
"on": true
|
||||||
|
@ -759,10 +755,6 @@
|
||||||
},
|
},
|
||||||
"id": "7697ac8a-25aa-4576-bb40-0036c0db15b9",
|
"id": "7697ac8a-25aa-4576-bb40-0036c0db15b9",
|
||||||
"id_v1": "/lights/23",
|
"id_v1": "/lights/23",
|
||||||
"metadata": {
|
|
||||||
"archetype": "classic_bulb",
|
|
||||||
"name": "Hue on/off light"
|
|
||||||
},
|
|
||||||
"mode": "normal",
|
"mode": "normal",
|
||||||
"on": {
|
"on": {
|
||||||
"on": false
|
"on": false
|
||||||
|
@ -810,10 +802,6 @@
|
||||||
},
|
},
|
||||||
"id": "74a45fee-1b3d-4553-b5ab-040da8a10cfd",
|
"id": "74a45fee-1b3d-4553-b5ab-040da8a10cfd",
|
||||||
"id_v1": "/lights/11",
|
"id_v1": "/lights/11",
|
||||||
"metadata": {
|
|
||||||
"archetype": "hue_bloom",
|
|
||||||
"name": "Hue light with color only"
|
|
||||||
},
|
|
||||||
"mode": "normal",
|
"mode": "normal",
|
||||||
"on": {
|
"on": {
|
||||||
"on": true
|
"on": true
|
||||||
|
@ -914,10 +902,6 @@
|
||||||
},
|
},
|
||||||
"id": "8015b17f-8336-415b-966a-b364bd082397",
|
"id": "8015b17f-8336-415b-966a-b364bd082397",
|
||||||
"id_v1": "/lights/24",
|
"id_v1": "/lights/24",
|
||||||
"metadata": {
|
|
||||||
"archetype": "hue_lightstrip_tv",
|
|
||||||
"name": "Hue light with color and color temperature gradient"
|
|
||||||
},
|
|
||||||
"mode": "normal",
|
"mode": "normal",
|
||||||
"on": {
|
"on": {
|
||||||
"on": true
|
"on": true
|
||||||
|
|
|
@ -277,7 +277,7 @@ async def test_light_added(hass, mock_bridge_v2):
|
||||||
|
|
||||||
await setup_platform(hass, mock_bridge_v2, "light")
|
await setup_platform(hass, mock_bridge_v2, "light")
|
||||||
|
|
||||||
test_entity_id = "light.hue_fake_light"
|
test_entity_id = "light.hue_mocked_device"
|
||||||
|
|
||||||
# verify entity does not exist before we start
|
# verify entity does not exist before we start
|
||||||
assert hass.states.get(test_entity_id) is None
|
assert hass.states.get(test_entity_id) is None
|
||||||
|
@ -290,7 +290,7 @@ async def test_light_added(hass, mock_bridge_v2):
|
||||||
test_entity = hass.states.get(test_entity_id)
|
test_entity = hass.states.get(test_entity_id)
|
||||||
assert test_entity is not None
|
assert test_entity is not None
|
||||||
assert test_entity.state == "off"
|
assert test_entity.state == "off"
|
||||||
assert test_entity.attributes["friendly_name"] == FAKE_LIGHT["metadata"]["name"]
|
assert test_entity.attributes["friendly_name"] == FAKE_DEVICE["metadata"]["name"]
|
||||||
|
|
||||||
|
|
||||||
async def test_light_availability(hass, mock_bridge_v2, v2_resources_test_data):
|
async def test_light_availability(hass, mock_bridge_v2, v2_resources_test_data):
|
||||||
|
|
Loading…
Add table
Reference in a new issue