Fully Kiosk Browser Custom Component

EDIT: This integration is now part of HA Core, you no longer need to install a custom component.

I’ve got Fully Kiosk Browser running on 4 Kindle Fire tablets, and it’s a pain to use rest_command’s with secrets to mask my passwords for that many instances, so I whipped up a quick and dirty custom component to control some common Fully Kiosk Features. It can be installed through HACS by adding a custom repository:

Once the component is installed, you can add it as a config flow. One config flow per tablet.

Currently provides a switch entity to turn the Fully screensaver on and off, a light entity to control the screen brightness and turn it on/off (if your device supports it). There’s also a basic media_player entity so you can have it play sound files, and a couple sensors and binary_sensors.

Requires the Pro version of Fully Kiosk Browser for remote administration & some device control functions.

Hope some people find it useful. If there’s an API command you’d like included, feel free to create an issue on GitHub or submit a PR.

15 Likes

Excellent! I was afraid I would have to write something like this myself :stuck_out_tongue: Thanks a lot!

Nice job. Thanks for this!

I think this should get more attention! I only found instructions on how to do it with REST and stumbled upon this by accident.

Thanks! Saved me a lot of time :blush:

1 Like

I just started using this. Integration is easy to setup, works great so far!

1 Like

I have some problems, I think since the last HA update? (105.6) but I also have updated the fully kiosk browser app …

Logger: homeassistant.components.light
Source: custom_components/fullykiosk/light.py:38
Integration: Light (documentation, issues)
First occurred: 2:34:50 PM (1 occurrences)
Last logged: 2:34:50 PM

Error while setting up fullykiosk platform for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 201, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 310, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 481, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 522, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    sstate = self.state
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 667, in state
    return STATE_ON if self.is_on else STATE_OFF
  File "/config/custom_components/fullykiosk/light.py", line 38, in is_on
    return self.coordinator.data["isScreenOn"]
KeyError: 'isScreenOn'
Logger: homeassistant.components.switch
Source: custom_components/fullykiosk/switch.py:73
Integration: Switch (documentation, issues)
First occurred: 2:34:50 PM (1 occurrences)
Last logged: 2:34:50 PM

Error while setting up fullykiosk platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 201, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 310, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 481, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 522, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 320, in _async_write_ha_state
    sstate = self.state
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 667, in state
    return STATE_ON if self.is_on else STATE_OFF
  File "/config/custom_components/fullykiosk/switch.py", line 73, in is_on
    return self.coordinator.data["currentFragment"] == "screensaver"
KeyError: 'currentFragment'

What version of Fully are you on? I’m wondering if they changed the API responses in an update.

Can confirm, newer versions of Fully changed a couple of the API responses. Will work on getting a patch out.

1.42.2 (fire edition) on a Fire HD 8 plus 2020

thanks! one problem/investigation less on my Sunday HA todo list :slightly_smiling_face:

By “config flow”, do you mean through the Integrations section of the UI?

I don’t see any notifications of new devices detected, and I don’t see any integrations matching the text “kiosk” or “fully” in the integrations list in the UI after installing the fullykiosk component.

Here are the main things I’ve done:

  • Installed FullyKiosk 1.39.2-fire on my Fire Tablet (10")
  • Verified I can access HA in the FullyKiosk browser
  • Remote Administration, Motion Detection, and Javascript Interface in the settings for FullyKiosk.
  • Installed homeassistant-fullykiosk via HACS on HA 2021.3.1
  • Restarted HA and confirmed I see the You are using a custom integration fullykiosk which has not been tested by Home Assistant. message in the logs

Do I need an entry in my configuration.yaml file or something else to get the integration/device to be accessible?

Don’t need anything in configuration.yaml. It should show up in the “Add Integration” list after an HA restart. I’ve seen instances where that list gets cached by the browser though, so you may have to force-reload the page (Ctrl-F5 on most browsers) to get it to show up.

That was it. Clearing the browser cache did the trick. Thanks for the quick response!

One other question: now that I got the integration loaded, I have one device and 14 entities for my tablet. However, the light entity (friendly name:Fire Tablet Screen) is showing up as unavailable. Any particular settings in Fully or on the device that I have to enable to get the integration to be able to see/control the light entity?

Problem solved… just in case anyone else encounters the light entity being unavailable: Once I updated FullyKiosk to v1.43.1-fire, the light entity became available and is able to turn on/off the screen and report its status.

Thanks for creating this component @cgarwood!

Thanks @cgarwood for this component. I just setup Fully Kiosk Browser on an Amazon Tablet HD 8 (10th gen) and it’s working great so far.

One question regarding the play_audio service - is there any way to play from a file path off the host machine (i.e. from the /media folder)?

I haven’t tried it myself, but it should be possible by passing a URL to play_sound like file:///sdcard/path/to/file.mp3

Based on this info from the Fully website:

You can use a file URL to address local files each time an URL is required in Fully. The full file URL looks like file:///sdcard/path/to/file.html Note the triple slash and that /sdcard usually refers to internal storage. You can use the file picker in URL dialog boxes to pick the file from storage. You can also select a file on external SD card. The path to external SD card will be saved in settings as /sd_ext and replaced by the real path on each device dynamically. Note that Fully Kiosk doesn’t support any write access to external SD card due to restrictions in Android OS.

Note the any links to local files or embedding local files from HTTP/HTTPS documents are disabled by Android Webview for some security reasons. But you can use the Localhost File Access option in Advanced Web Settings in order to access local files using https://localhost/… or http://localhost/… address. The full URL for a local file should look like https://localhost/sdcard/path/to/file.mp4. So you can for example embed the local video/image files in your HTTPS website.

1 Like

Appreciate the info. Can’t seem to get this to work. I have Home Assistant running in a docker container with my audio file (mp3) in /config/media within the container itself. Attempting to use the play_audio service with: file:///config/media/double-beep-beep.mp3 and nothing happens. If I put in an actual audio file of a web hosted mp3, it works, so I know it’s definitely an issue with the path I’m using.

Anyone else with HA in a docker container able to play an audio file hosted within the container itself (well, on the host machine but I just have the config folder mounted).

Edit: Thinking about this, I’m guess using file:/// is trying to play an audio file on the tablet itself which is probably the issue since I’m trying to play an audio file on my Home Assistant host machine.

Edit 2: Ah, figured out an easy way. Created a folder called www in /config and added the double-beep-beep.mp3 file to that www folder. From there, I can just access the mp3 using http://my-server-ip:8123/local/double-beep-beep.mp3.

ah yeah, thought you wanted to play from the tablet, not the HA instance. The /config/www and http://ha-server/local/sound.mp3 is the way to go :smile:

1 Like

Anyone else using this integration experiencing an issue where the connection to your tablet will repeatedly drop and reconnect? You can see the tablet entities in HA become unavailable for several seconds then come back as well as “Timeout fetching…” errors in the HA logs. I made a post about it here.

same here with the cache, now showing up , thanks :slight_smile:

this integration is a life saver, damn fire hd tablets are always getting messed up after a while with FKB, a simple automation of a daily restart of FKB fixed this perfectly , thank you!