Add screen on/off switch to Fully Kiosk Browser integration (#76957)

This commit is contained in:
Charles Garwood 2022-08-18 07:33:38 -04:00 committed by GitHub
parent 07ba3c1383
commit 1aef60c81c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -66,6 +66,13 @@ SWITCHES: tuple[FullySwitchEntityDescription, ...] = (
off_action=lambda fully: fully.disableMotionDetection(),
is_on_fn=lambda data: data["settings"].get("motionDetection"),
),
FullySwitchEntityDescription(
key="screenOn",
name="Screen",
on_action=lambda fully: fully.screenOn(),
off_action=lambda fully: fully.screenOff(),
is_on_fn=lambda data: data.get("screenOn"),
),
)

View File

@ -61,6 +61,17 @@ async def test_switches(
await call_service(hass, "turn_off", "switch.amazon_fire_motion_detection")
assert len(mock_fully_kiosk.disableMotionDetection.mock_calls) == 1
entity = hass.states.get("switch.amazon_fire_screen")
assert entity
assert entity.state == "on"
entry = entity_registry.async_get("switch.amazon_fire_screen")
assert entry
assert entry.unique_id == "abcdef-123456-screenOn"
await call_service(hass, "turn_off", "switch.amazon_fire_screen")
assert len(mock_fully_kiosk.screenOff.mock_calls) == 1
await call_service(hass, "turn_on", "switch.amazon_fire_screen")
assert len(mock_fully_kiosk.screenOn.mock_calls) == 1
assert entry.device_id
device_entry = device_registry.async_get(entry.device_id)
assert device_entry