Add screen on/off switch to Fully Kiosk Browser integration (#76957)
This commit is contained in:
parent
07ba3c1383
commit
1aef60c81c
2 changed files with 18 additions and 0 deletions
|
@ -66,6 +66,13 @@ SWITCHES: tuple[FullySwitchEntityDescription, ...] = (
|
||||||
off_action=lambda fully: fully.disableMotionDetection(),
|
off_action=lambda fully: fully.disableMotionDetection(),
|
||||||
is_on_fn=lambda data: data["settings"].get("motionDetection"),
|
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"),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,17 @@ async def test_switches(
|
||||||
await call_service(hass, "turn_off", "switch.amazon_fire_motion_detection")
|
await call_service(hass, "turn_off", "switch.amazon_fire_motion_detection")
|
||||||
assert len(mock_fully_kiosk.disableMotionDetection.mock_calls) == 1
|
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
|
assert entry.device_id
|
||||||
device_entry = device_registry.async_get(entry.device_id)
|
device_entry = device_registry.async_get(entry.device_id)
|
||||||
assert device_entry
|
assert device_entry
|
||||||
|
|
Loading…
Add table
Reference in a new issue