Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

add service to_background #66

Merged
merged 8 commits into from
Dec 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions custom_components/fullykiosk/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
SERVICE_SET_CONFIG = "set_config"
SERVICE_START_APPLICATION = "start_application"
SERVICE_TO_FOREGROUND = "to_foreground"
SERVICE_TO_BACKGROUND = "to_background"

UPDATE_INTERVAL = 30
4 changes: 2 additions & 2 deletions custom_components/fullykiosk/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"documentation": "https://github.com/cgarwood/homeassistant-fullykiosk",
"issue_tracker": "https://github.com/cgarwood/homeassistant-fullykiosk/issues",
"requirements": [
"python-fullykiosk==0.0.10"
"python-fullykiosk==0.0.11"
],
"ssdp": [],
"zeroconf": [],
Expand All @@ -15,4 +15,4 @@
"@cgarwood"
],
"version": "0.1.4"
}
}
10 changes: 10 additions & 0 deletions custom_components/fullykiosk/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
SERVICE_RESTART_APP,
SERVICE_SET_CONFIG,
SERVICE_START_APPLICATION,
SERVICE_TO_BACKGROUND,
SERVICE_TO_FOREGROUND,
)

Expand Down Expand Up @@ -97,6 +98,10 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
SERVICE_TO_FOREGROUND, {}, "async_fullykiosk_to_foreground"
)

platform.async_register_entity_service(
SERVICE_TO_BACKGROUND, {}, "async_fullykiosk_to_background"
)

async_add_entities([FullyMediaPlayer(coordinator)], False)


Expand Down Expand Up @@ -183,6 +188,11 @@ async def async_fullykiosk_start_app(self, application):
await self.coordinator.fully.startApplication(application)
await self.coordinator.async_refresh()

async def async_fullykiosk_to_background(self):
"""Bring the fullykiosk browser app back to the background."""
await self.coordinator.fully.toBackground()
await self.coordinator.async_refresh()

async def async_fullykiosk_to_foreground(self):
"""Bring the fullykiosk browser app back to the foreground."""
await self.coordinator.fully.toForeground()
Expand Down
14 changes: 14 additions & 0 deletions custom_components/fullykiosk/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,20 @@ to_foreground:
integration: fullykiosk
domain: media_player

to_background:
name: To Background
description: Bring the Fully Kiosk Browser app to the background.
fields:
entity_id:
description: Name(s) of entities on which to bring the app to the background.
example: "media_player.amazon_fire_media_player"
name: Entity
required: true
selector:
entity:
integration: fullykiosk
domain: media_player

volume_set:
name: Set Volume
description: Set a Fully Kiosk Browser volume level.
Expand Down