diff --git a/homeassistant/components/bring/icons.json b/homeassistant/components/bring/icons.json index 7a4775066cf8babe04311a7ee14f501f4af57792..74c3b2e393b4bea2fccb08119c9744afcb09b427 100644 --- a/homeassistant/components/bring/icons.json +++ b/homeassistant/components/bring/icons.json @@ -12,6 +12,12 @@ }, "list_language": { "default": "mdi:earth" + }, + "list_access": { + "default": "mdi:account-lock", + "state": { + "shared": "mdi:account-group" + } } }, "todo": { diff --git a/homeassistant/components/bring/sensor.py b/homeassistant/components/bring/sensor.py index edc1da3d59bf925c65b0f525751ba8f476bcdf64..57ceb0995352234442c80b4e6030e3beb19b6883 100644 --- a/homeassistant/components/bring/sensor.py +++ b/homeassistant/components/bring/sensor.py @@ -40,6 +40,7 @@ class BringSensor(StrEnum): CONVENIENT = "convenient" DISCOUNTED = "discounted" LIST_LANGUAGE = "list_language" + LIST_ACCESS = "list_access" SENSOR_DESCRIPTIONS: tuple[BringSensorEntityDescription, ...] = ( @@ -73,6 +74,14 @@ SENSOR_DESCRIPTIONS: tuple[BringSensorEntityDescription, ...] = ( options=[x.lower() for x in BRING_SUPPORTED_LOCALES], device_class=SensorDeviceClass.ENUM, ), + BringSensorEntityDescription( + key=BringSensor.LIST_ACCESS, + translation_key=BringSensor.LIST_ACCESS, + value_fn=lambda lst, _: lst["status"].lower(), + entity_category=EntityCategory.DIAGNOSTIC, + options=["registered", "shared"], + device_class=SensorDeviceClass.ENUM, + ), ) diff --git a/homeassistant/components/bring/strings.json b/homeassistant/components/bring/strings.json index bce18fc6a925ed5dd018ea63c41c072317b6aaed..61121cdca60c701ba54197a5ea4c4ebe45df6a31 100644 --- a/homeassistant/components/bring/strings.json +++ b/homeassistant/components/bring/strings.json @@ -61,6 +61,13 @@ "sv-se": "Sweden", "tr-tr": "Türkiye" } + }, + "list_access": { + "name": "List access", + "state": { + "registered": "Private", + "shared": "Shared" + } } } }, diff --git a/tests/components/bring/snapshots/test_sensor.ambr b/tests/components/bring/snapshots/test_sensor.ambr index 08e554632e951183f3397bbd6f6b370aaa262fe6..513b4e6469eead65ac8b37799f5c403e5c801b52 100644 --- a/tests/components/bring/snapshots/test_sensor.ambr +++ b/tests/components/bring/snapshots/test_sensor.ambr @@ -46,6 +46,62 @@ 'state': '2', }) # --- +# name: test_setup[sensor.baumarkt_list_access-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'options': list([ + 'registered', + 'shared', + ]), + }), + 'config_entry_id': <ANY>, + 'device_class': None, + 'device_id': <ANY>, + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>, + 'entity_id': 'sensor.baumarkt_list_access', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': <ANY>, + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': <SensorDeviceClass.ENUM: 'enum'>, + 'original_icon': None, + 'original_name': 'List access', + 'platform': 'bring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': <BringSensor.LIST_ACCESS: 'list_access'>, + 'unique_id': '00000000-00000000-00000000-00000000_b4776778-7f6c-496e-951b-92a35d3db0dd_list_access', + 'unit_of_measurement': None, + }) +# --- +# name: test_setup[sensor.baumarkt_list_access-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'enum', + 'friendly_name': 'Baumarkt List access', + 'options': list([ + 'registered', + 'shared', + ]), + }), + 'context': <ANY>, + 'entity_id': 'sensor.baumarkt_list_access', + 'last_changed': <ANY>, + 'last_reported': <ANY>, + 'last_updated': <ANY>, + 'state': 'registered', + }) +# --- # name: test_setup[sensor.baumarkt_on_occasion-entry] EntityRegistryEntrySnapshot({ 'aliases': set({ @@ -279,6 +335,62 @@ 'state': '2', }) # --- +# name: test_setup[sensor.einkauf_list_access-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'options': list([ + 'registered', + 'shared', + ]), + }), + 'config_entry_id': <ANY>, + 'device_class': None, + 'device_id': <ANY>, + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>, + 'entity_id': 'sensor.einkauf_list_access', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': <ANY>, + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': <SensorDeviceClass.ENUM: 'enum'>, + 'original_icon': None, + 'original_name': 'List access', + 'platform': 'bring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': <BringSensor.LIST_ACCESS: 'list_access'>, + 'unique_id': '00000000-00000000-00000000-00000000_e542eef6-dba7-4c31-a52c-29e6ab9d83a5_list_access', + 'unit_of_measurement': None, + }) +# --- +# name: test_setup[sensor.einkauf_list_access-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'device_class': 'enum', + 'friendly_name': 'Einkauf List access', + 'options': list([ + 'registered', + 'shared', + ]), + }), + 'context': <ANY>, + 'entity_id': 'sensor.einkauf_list_access', + 'last_changed': <ANY>, + 'last_reported': <ANY>, + 'last_updated': <ANY>, + 'state': 'registered', + }) +# --- # name: test_setup[sensor.einkauf_on_occasion-entry] EntityRegistryEntrySnapshot({ 'aliases': set({