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

Commit

Permalink
add service to_background (#66)
Browse files Browse the repository at this point in the history
* add service to_background

maybe fix this issue #64

* Update const.py

* Update media_player.py

* Update sensor.py

* Update sensor.py

* Update media_player.py

* Update media_player.py

* Update manifest.json

bump to python-fullykiosk 0.0.11 version
  • Loading branch information
chpego authored Dec 27, 2021
1 parent 0e9e743 commit 2d81a68
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
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 @@ -184,6 +189,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

0 comments on commit 2d81a68

Please sign in to comment.