mirror of
https://github.com/home-assistant/core.git
synced 2025-07-07 13:27:09 +00:00
Set the default upgrade icon for the MQTT device to the default icon for Home Assistant instead of the icon for the MQTT integration (#144295)
* Set the default upgrade icon for the MQTT device to the default icon for Home Assistant instead of the icon for the MQTT integration * Set the default upgrade icon for the MQTT device to the default icon for Home Assistant instead of the icon for the MQTT integration * Set the default upgrade icon for the MQTT device to the default icon for Home Assistant instead of the icon for the MQTT integration * Set the default upgrade icon for the MQTT device to the default icon for Home Assistant instead of the icon for the MQTT integration * Fix failed tests * Fix failed tests * Cleanup unused helper option * ruff --------- Co-authored-by: jbouwh <jan@jbsoft.nl>
This commit is contained in:
parent
a169d6ca97
commit
f07265ece4
@ -105,10 +105,7 @@ class MqttUpdate(MqttEntity, UpdateEntity, RestoreEntity):
|
||||
@property
|
||||
def entity_picture(self) -> str | None:
|
||||
"""Return the entity picture to use in the frontend."""
|
||||
if self._attr_entity_picture is not None:
|
||||
return self._attr_entity_picture
|
||||
|
||||
return super().entity_picture
|
||||
return self._attr_entity_picture
|
||||
|
||||
@staticmethod
|
||||
def config_schema() -> VolSchemaType:
|
||||
|
@ -1875,7 +1875,6 @@ async def help_test_entity_icon_and_entity_picture(
|
||||
mqtt_mock_entry: MqttMockHAClientGenerator,
|
||||
domain: str,
|
||||
config: ConfigType,
|
||||
default_entity_picture: str | None = None,
|
||||
) -> None:
|
||||
"""Test entity picture and icon."""
|
||||
await mqtt_mock_entry()
|
||||
@ -1895,7 +1894,7 @@ async def help_test_entity_icon_and_entity_picture(
|
||||
state = hass.states.get(entity_id)
|
||||
assert entity_id is not None and state
|
||||
assert state.attributes.get("icon") is None
|
||||
assert state.attributes.get("entity_picture") == default_entity_picture
|
||||
assert state.attributes.get("entity_picture") is None
|
||||
|
||||
# Discover an entity with an entity picture set
|
||||
unique_id = "veryunique2"
|
||||
@ -1922,7 +1921,7 @@ async def help_test_entity_icon_and_entity_picture(
|
||||
state = hass.states.get(entity_id)
|
||||
assert entity_id is not None and state
|
||||
assert state.attributes.get("icon") == "mdi:emoji-happy-outline"
|
||||
assert state.attributes.get("entity_picture") == default_entity_picture
|
||||
assert state.attributes.get("entity_picture") is None
|
||||
|
||||
|
||||
async def help_test_publishing_with_custom_encoding(
|
||||
|
@ -211,10 +211,7 @@ async def test_value_template(
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes.get("installed_version") == "1.9.0"
|
||||
assert state.attributes.get("latest_version") == "1.9.0"
|
||||
assert (
|
||||
state.attributes.get("entity_picture")
|
||||
== "https://brands.home-assistant.io/_/mqtt/icon.png"
|
||||
)
|
||||
assert state.attributes.get("entity_picture") is None
|
||||
|
||||
async_fire_mqtt_message(hass, latest_version_topic, '{"latest":"2.0.0"}')
|
||||
|
||||
@ -324,10 +321,7 @@ async def test_value_template_float(
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes.get("installed_version") == "1.9"
|
||||
assert state.attributes.get("latest_version") == "1.9"
|
||||
assert (
|
||||
state.attributes.get("entity_picture")
|
||||
== "https://brands.home-assistant.io/_/mqtt/icon.png"
|
||||
)
|
||||
assert state.attributes.get("entity_picture") is None
|
||||
|
||||
async_fire_mqtt_message(hass, latest_version_topic, '{"latest":"2.0"}')
|
||||
|
||||
@ -949,9 +943,5 @@ async def test_entity_icon_and_entity_picture(
|
||||
domain = update.DOMAIN
|
||||
config = DEFAULT_CONFIG
|
||||
await help_test_entity_icon_and_entity_picture(
|
||||
hass,
|
||||
mqtt_mock_entry,
|
||||
domain,
|
||||
config,
|
||||
default_entity_picture="https://brands.home-assistant.io/_/mqtt/icon.png",
|
||||
hass, mqtt_mock_entry, domain, config
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user