Add config and diagnostic entities (#57528)

* Add config entity concept

* Rename is_config_entity to entity_category

* Add test

* Add 'diagnostic' entity category
This commit is contained in:
Erik Montnemery 2021-10-14 10:04:26 +02:00 committed by GitHub
parent 24509503bb
commit 4b3d423767
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 69 additions and 14 deletions

View file

@ -809,3 +809,23 @@ async def test_attribution_attribute(hass):
state = hass.states.get(mock_entity.entity_id)
assert state.attributes.get(ATTR_ATTRIBUTION) == "Home Assistant"
async def test_entity_category_property(hass):
"""Test entity category property."""
mock_entity1 = entity.Entity()
mock_entity1.hass = hass
mock_entity1.entity_description = entity.EntityDescription(
key="abc", entity_category="ignore_me"
)
mock_entity1.entity_id = "hello.world"
mock_entity1._attr_entity_category = "config"
assert mock_entity1.entity_category == "config"
mock_entity2 = entity.Entity()
mock_entity2.hass = hass
mock_entity2.entity_description = entity.EntityDescription(
key="abc", entity_category="config"
)
mock_entity2.entity_id = "hello.world"
assert mock_entity2.entity_category == "config"