Skip to content

Commit f07265e

Browse files
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 <[email protected]>
1 parent a169d6c commit f07265e

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

homeassistant/components/mqtt/update.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,7 @@ class MqttUpdate(MqttEntity, UpdateEntity, RestoreEntity):
105105
@property
106106
def entity_picture(self) -> str | None:
107107
"""Return the entity picture to use in the frontend."""
108-
if self._attr_entity_picture is not None:
109-
return self._attr_entity_picture
110-
111-
return super().entity_picture
108+
return self._attr_entity_picture
112109

113110
@staticmethod
114111
def config_schema() -> VolSchemaType:

tests/components/mqtt/common.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,6 @@ async def help_test_entity_icon_and_entity_picture(
18751875
mqtt_mock_entry: MqttMockHAClientGenerator,
18761876
domain: str,
18771877
config: ConfigType,
1878-
default_entity_picture: str | None = None,
18791878
) -> None:
18801879
"""Test entity picture and icon."""
18811880
await mqtt_mock_entry()
@@ -1895,7 +1894,7 @@ async def help_test_entity_icon_and_entity_picture(
18951894
state = hass.states.get(entity_id)
18961895
assert entity_id is not None and state
18971896
assert state.attributes.get("icon") is None
1898-
assert state.attributes.get("entity_picture") == default_entity_picture
1897+
assert state.attributes.get("entity_picture") is None
18991898

19001899
# Discover an entity with an entity picture set
19011900
unique_id = "veryunique2"
@@ -1922,7 +1921,7 @@ async def help_test_entity_icon_and_entity_picture(
19221921
state = hass.states.get(entity_id)
19231922
assert entity_id is not None and state
19241923
assert state.attributes.get("icon") == "mdi:emoji-happy-outline"
1925-
assert state.attributes.get("entity_picture") == default_entity_picture
1924+
assert state.attributes.get("entity_picture") is None
19261925

19271926

19281927
async def help_test_publishing_with_custom_encoding(

tests/components/mqtt/test_update.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,7 @@ async def test_value_template(
211211
assert state.state == STATE_OFF
212212
assert state.attributes.get("installed_version") == "1.9.0"
213213
assert state.attributes.get("latest_version") == "1.9.0"
214-
assert (
215-
state.attributes.get("entity_picture")
216-
== "https://brands.home-assistant.io/_/mqtt/icon.png"
217-
)
214+
assert state.attributes.get("entity_picture") is None
218215

219216
async_fire_mqtt_message(hass, latest_version_topic, '{"latest":"2.0.0"}')
220217

@@ -324,10 +321,7 @@ async def test_value_template_float(
324321
assert state.state == STATE_OFF
325322
assert state.attributes.get("installed_version") == "1.9"
326323
assert state.attributes.get("latest_version") == "1.9"
327-
assert (
328-
state.attributes.get("entity_picture")
329-
== "https://brands.home-assistant.io/_/mqtt/icon.png"
330-
)
324+
assert state.attributes.get("entity_picture") is None
331325

332326
async_fire_mqtt_message(hass, latest_version_topic, '{"latest":"2.0"}')
333327

@@ -949,9 +943,5 @@ async def test_entity_icon_and_entity_picture(
949943
domain = update.DOMAIN
950944
config = DEFAULT_CONFIG
951945
await help_test_entity_icon_and_entity_picture(
952-
hass,
953-
mqtt_mock_entry,
954-
domain,
955-
config,
956-
default_entity_picture="https://brands.home-assistant.io/_/mqtt/icon.png",
946+
hass, mqtt_mock_entry, domain, config
957947
)

0 commit comments

Comments
 (0)