Fix for deviceless entities in Hue integration (#59820)
This commit is contained in:
parent
902da4daf8
commit
4820acb897
3 changed files with 15 additions and 3 deletions
|
@ -36,9 +36,7 @@ class HueBaseEntity(Entity):
|
|||
self.bridge = bridge
|
||||
self.controller = controller
|
||||
self.resource = resource
|
||||
self.device = (
|
||||
controller.get_device(resource.id) or bridge.api.config.bridge_device
|
||||
)
|
||||
self.device = controller.get_device(resource.id)
|
||||
self.logger = bridge.logger.getChild(resource.type.value)
|
||||
|
||||
# Entity class attributes
|
||||
|
|
|
@ -240,6 +240,8 @@ async def test_grouped_lights(hass, mock_bridge_v2, v2_resources_test_data):
|
|||
assert entity_entry
|
||||
assert entity_entry.disabled
|
||||
assert entity_entry.disabled_by == er.DISABLED_INTEGRATION
|
||||
# entity should not have a device assigned
|
||||
assert entity_entry.device_id is None
|
||||
|
||||
# enable the entity
|
||||
updated_entry = ent_reg.async_update_entity(
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
"""Philips Hue scene platform tests for V2 bridge/api."""
|
||||
|
||||
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .conftest import setup_platform
|
||||
from .const import FAKE_SCENE
|
||||
|
||||
|
@ -39,6 +41,16 @@ async def test_scene(hass, mock_bridge_v2, v2_resources_test_data):
|
|||
assert test_entity.attributes["brightness"] == 100.0
|
||||
assert test_entity.attributes["is_dynamic"] is False
|
||||
|
||||
# scene entities should not have a device assigned
|
||||
ent_reg = er.async_get(hass)
|
||||
for entity_id in (
|
||||
"scene.test_zone_dynamic_test_scene",
|
||||
"scene.test_room_regular_test_scene",
|
||||
):
|
||||
entity_entry = ent_reg.async_get(entity_id)
|
||||
assert entity_entry
|
||||
assert entity_entry.device_id is None
|
||||
|
||||
|
||||
async def test_scene_turn_on_service(hass, mock_bridge_v2, v2_resources_test_data):
|
||||
"""Test calling the turn on service on a scene."""
|
||||
|
|
Loading…
Add table
Reference in a new issue