Skip to content

Commit e5f163f

Browse files
mr-deamonCopilot
andauthored
Add clear cache button to Fully Kiosk integration (home-assistant#150943)
Co-authored-by: Copilot <[email protected]>
1 parent 060f748 commit e5f163f

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

homeassistant/components/fully_kiosk/button.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ class FullyButtonEntityDescription(ButtonEntityDescription):
6262
entity_category=EntityCategory.CONFIG,
6363
press_action=lambda fully: fully.loadStartUrl(),
6464
),
65+
FullyButtonEntityDescription(
66+
key="clearCache",
67+
translation_key="clear_cache",
68+
entity_category=EntityCategory.CONFIG,
69+
press_action=lambda fully: fully.clearCache(),
70+
),
6571
)
6672

6773

homeassistant/components/fully_kiosk/strings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
},
7070
"load_start_url": {
7171
"name": "Load start URL"
72+
},
73+
"clear_cache": {
74+
"name": "Clear browser cache"
7275
}
7376
},
7477
"image": {

tests/components/fully_kiosk/test_button.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ async def test_buttons(
7474
)
7575
assert len(mock_fully_kiosk.loadStartUrl.mock_calls) == 1
7676

77+
entry = entity_registry.async_get("button.amazon_fire_clear_browser_cache")
78+
assert entry
79+
assert entry.unique_id == "abcdef-123456-clearCache"
80+
await hass.services.async_call(
81+
button.DOMAIN,
82+
button.SERVICE_PRESS,
83+
{ATTR_ENTITY_ID: "button.amazon_fire_clear_browser_cache"},
84+
blocking=True,
85+
)
86+
assert len(mock_fully_kiosk.clearCache.mock_calls) == 1
87+
7788
assert entry.device_id
7889
device_entry = device_registry.async_get(entry.device_id)
7990
assert device_entry

0 commit comments

Comments
 (0)