diff --git a/custom_components/fullykiosk/const.py b/custom_components/fullykiosk/const.py index a7a13c7..65a2ae7 100644 --- a/custom_components/fullykiosk/const.py +++ b/custom_components/fullykiosk/const.py @@ -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 diff --git a/custom_components/fullykiosk/manifest.json b/custom_components/fullykiosk/manifest.json index 446e287..d5cfcd5 100644 --- a/custom_components/fullykiosk/manifest.json +++ b/custom_components/fullykiosk/manifest.json @@ -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": [], @@ -15,4 +15,4 @@ "@cgarwood" ], "version": "0.1.4" -} \ No newline at end of file +} diff --git a/custom_components/fullykiosk/media_player.py b/custom_components/fullykiosk/media_player.py index bf6a604..4a55c9e 100644 --- a/custom_components/fullykiosk/media_player.py +++ b/custom_components/fullykiosk/media_player.py @@ -29,6 +29,7 @@ SERVICE_RESTART_APP, SERVICE_SET_CONFIG, SERVICE_START_APPLICATION, + SERVICE_TO_BACKGROUND, SERVICE_TO_FOREGROUND, ) @@ -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) @@ -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() diff --git a/custom_components/fullykiosk/services.yaml b/custom_components/fullykiosk/services.yaml index afa5f87..34c41be 100644 --- a/custom_components/fullykiosk/services.yaml +++ b/custom_components/fullykiosk/services.yaml @@ -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.