Set brand icon as entity picture on update entities (#69200)

Co-authored-by: Joakim Sørensen <ludeeus@ludeeus.dev>
This commit is contained in:
Franck Nijhof 2022-04-03 20:38:05 +02:00 committed by GitHub
parent bd1d7bdbb7
commit b644e7ed0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 8 deletions

View file

@ -12,7 +12,13 @@ from homeassistant.components.update.const import (
ATTR_RELEASE_URL,
ATTR_TITLE,
)
from homeassistant.const import ATTR_DEVICE_CLASS, ATTR_ENTITY_ID, STATE_OFF, STATE_ON
from homeassistant.const import (
ATTR_DEVICE_CLASS,
ATTR_ENTITY_ID,
ATTR_ENTITY_PICTURE,
STATE_OFF,
STATE_ON,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.event import async_track_state_change_event
from homeassistant.setup import async_setup_component
@ -37,6 +43,10 @@ def test_setup_params(hass: HomeAssistant) -> None:
state.attributes[ATTR_RELEASE_SUMMARY] == "Awesome update, fixing everything!"
)
assert state.attributes[ATTR_RELEASE_URL] == "https://www.example.com/release/1.0.1"
assert (
state.attributes[ATTR_ENTITY_PICTURE]
== "https://brands.home-assistant.io/_/demo/icon.png"
)
state = hass.states.get("update.demo_no_update")
assert state
@ -46,6 +56,10 @@ def test_setup_params(hass: HomeAssistant) -> None:
assert state.attributes[ATTR_LATEST_VERSION] == "1.0.0"
assert state.attributes[ATTR_RELEASE_SUMMARY] is None
assert state.attributes[ATTR_RELEASE_URL] is None
assert (
state.attributes[ATTR_ENTITY_PICTURE]
== "https://brands.home-assistant.io/_/demo/icon.png"
)
state = hass.states.get("update.demo_add_on")
assert state
@ -57,6 +71,10 @@ def test_setup_params(hass: HomeAssistant) -> None:
state.attributes[ATTR_RELEASE_SUMMARY] == "Awesome update, fixing everything!"
)
assert state.attributes[ATTR_RELEASE_URL] == "https://www.example.com/release/1.0.1"
assert (
state.attributes[ATTR_ENTITY_PICTURE]
== "https://brands.home-assistant.io/_/demo/icon.png"
)
state = hass.states.get("update.demo_living_room_bulb_update")
assert state
@ -69,6 +87,10 @@ def test_setup_params(hass: HomeAssistant) -> None:
state.attributes[ATTR_RELEASE_URL] == "https://www.example.com/release/1.93.3"
)
assert state.attributes[ATTR_DEVICE_CLASS] == UpdateDeviceClass.FIRMWARE
assert (
state.attributes[ATTR_ENTITY_PICTURE]
== "https://brands.home-assistant.io/_/demo/icon.png"
)
state = hass.states.get("update.demo_update_with_progress")
assert state
@ -81,6 +103,10 @@ def test_setup_params(hass: HomeAssistant) -> None:
state.attributes[ATTR_RELEASE_URL] == "https://www.example.com/release/1.93.3"
)
assert state.attributes[ATTR_DEVICE_CLASS] == UpdateDeviceClass.FIRMWARE
assert (
state.attributes[ATTR_ENTITY_PICTURE]
== "https://brands.home-assistant.io/_/demo/icon.png"
)
async def test_update_with_progress(hass: HomeAssistant) -> None: