Fully Kiosk Browser integration

I just started playing around with Fully Kiosk Browser (FKB) and as it has a nice REST API I was wondering if there is a binding available to nicely interact with OH2. Since there is none, I made use of HTTP binding in order GET and POST some values that made sense in my setup.

I’m using Fire HD 10 tablets wall mounted with HABpanel to interact with Openhab. When having FKBs PLUS license (well spent 6 Euros), you can use motion detection, REST API and some other good stuff that makes FKB a swiss army knife. I really like it and just started to play around.

Since I havent found much OH2 related FKB docu, I’d like to start an items/rules sharing thread so that other can participate in grabbing info as well as adding their use-cases and item definitions.

So to start here are my items:

 // Switch Display ON & OFF
 Switch eg_flur_tablet_display
   "Tablet Display"
   (gEgTablet)
   { http=">[ON:POST:http://192.168.23.140:2323/?cmd=screenOn&password=password] >[OFF:POST:http://192.168.23.140:2323/?cmd=screenOff&password=password]" }

 // GET Display status info from device and update switch above based on .rules file
 // As per: https://docs.openhab.org/addons/transformations/jsonpath/readme.html
 String eg_flur_tablet_display_json
   "Tablet Display JSON [%s]"
   (gEgTablet)
   { http="<[http://192.168.23.140:2323/?cmd=deviceInfo&password=password&type=json:30000:JSONPATH($.isScreenOn)]" }

 // Screenbrightness in % (set & get)
 Dimmer eg_flur_tablet_brightness
   "Tablet Helligkeit [%d %%]"
   (gEgTablet)
   { http=">[*:POST:http://192.168.23.140:2323/?cmd=setStringSetting&key=screenBrightness&value=%2$s&password=password] <[http://192.168.23.140:2323/?cmd=deviceInfo&password=password&type=json:30000:JSONPATH($.screenBrightness)]" }

 // Timer in seconds, when screen shoud go off again
 Dimmer eg_flur_tablet_ScreenOffTimer
   "Tablet Screen Off Timer [%d sec]"
   (gEgTablet)
   { http=">[*:POST:http://192.168.23.140:2323/?cmd=setStringSetting&key=timeToScreenOffV2&value=%2$s&password=password] <[http://192.168.23.140:2323/?cmd=listSettings&password=password&type=json:30000:JSONPATH($.timeToScreenOffV2)]" }

 // GET battery level from device
 Number eg_flur_tablet_bat
   "Tablet Battery [%s %%]"
   (gEgTablet,gBattery)
   { http="<[http://192.168.23.140:2323/?cmd=deviceInfo&password=password&type=json:30000:JSONPATH($.batteryLevel)]" }

In case you turn on the display via other means (motion detection, REST webpage, etc), it would be helpful if OH recognizes this and updates the Switch item accordingly. Thus you have to query the JSON and switch the item with the following rule:

 rule "eg_flur_tablet_display_json: convert JSON to Switch"
 when
   Item eg_flur_tablet_display_json changed
 then
   logInfo("eg_flur_tablet_display_json","Has value: " + eg_flur_tablet_display_json.state.toString)
   if(eg_flur_tablet_display_json.state.toString == "true"){
     eg_flur_tablet_display.postUpdate(ON)
   } else {
     eg_flur_tablet_display.postUpdate(OFF)
   }
 end

image

Having all this in a nice small binding using one thing item per tablet would be really handy. Since I’m not a real developer others might pick this up. I’ve seen similar intergrations for e.g. HASS.
Hope this helps.
Best Seb

7 Likes

Very nice. About to start with my fire device this week. It would be great to also post your settings for FKB. I get the impression one of the tricky things is to disable screen lock, so anything around that would be good too.

I did the exact same thing but with the exec binding and the command CURL … Your things look cleaner

Hey @david,
I havent changed much in FKB settings yet other than ordering the license and enabling “motion detection” as well as “remote admin”. I’m still about to tweak the motion settings since the device wakes up badly during night times. Once I have a working config, I’m happy to share.

@Dominic_Bonneau your curl items inspired me to start this thread. Thanks for that. I’m still checking if HTTP binding config can help tp optimize the config efforts. Then it might be even cleaner to setup. Will share the results later.

My main use-case is the abilty to control the tablet from OH via FKB. I have some rules so that the “Screen on time” is shorter at night times and I also reduce the brightness at night.
When walking through the dark corridor at night I dont want the tablet to scream at me in 100% brightness for 5mins. But during day times, the tablet should be turned on longer and brighter.

I am also playing with a fire tablet (fire7) as wall mounted control unit with FKB.

In spite of the problem with the unlock-screen and the advertisement everything works fine so far. i just think, that loading times are bad with the FKB - do you have similar problems at refresh?

navigating in the different screens is a bit faster, i just dont know why the refresh takes so long.

you can have a look at it here - do you have similar problems with the fire10?

Hey @e36Alex,
I think my Fire 10 is faster. From starting the app until Habpanel is loaded with the welcome screen, it takes a second, I think.
Keep in mind that depending on the page you load, Habpanel queries OH for every single configured item to have the status. I would recommend using chrome toolbar and check where delays come from.
I swapped my Fire 7" to the 10" version. I might be able to compare startup speeds this weekend.

thanks for your reply - it would be great, if you could benchmark the loading times. another thing is, that calling habpanel from habpanelviewer oder silkbrowser is much faster than the refresh at FKB.

I’m also using Fully Kiosk with it’s powerful REST API and I’d like to share my setup - not yet pinned to the wall, I’m waiting for something like this to arrive.
I’m gonna use a Acer Iconia One 10 (B3-A40) which has the ability to turn on the screen when double-tapping on it. This is very important for me as I’m gonna use the screensaver feature of Fully to display a slideshow of family photos only on interval 18:00-22:00 (12:00-22:00 in weekends) and, in the rest, the tablet will be with the screen off.
When it’s in “photoframe” mode a single touch is enough to go to OH UI and, when screen if off, a double-tap will be needed to wake the screen.
Also, when someone rings the doorbell, the tabel will wake up (or exit from screensaver), display a fedd fromt he fron door camera and announce, using Fully TSS, that Someone is at the front door.

To interface with OH I’m using the HTTP binding and HTTP actions.
HTTP binding is configure like below to refresh the deviceInfo:

# http.cfg
wallpanel_deviceInfo.url=http://wallpanel:2323/?pwd=XXXXX&cmd=deviceInfo&type=json
wallpanel_deviceInfo.updateInterval=1000

As the Fully screenBrightness accepts values in the [0…255] interval and a dimmer item from openHAB has [0…100] I wanted to transform between those two and I’m using a JS transformation and a rule - see details below.

wallpanel.items:

Group gWallpanel (All)

Number Wallpanel_batteryLevel "Battery [%d%%]" <battery> (gWallpanel) {http="<[wallpanel_deviceInfo:600000:JSONPATH($.batteryLevel)]"}
Switch Wallpanel_screenOn "Screen" <tablet> (gWallpanel) {http="<[wallpanel_deviceInfo:10000:JS(wallpanel_isScreenOn.js)] >[ON:POST:http://wallpanel:2323/?password=XXXXXX&cmd=screenOn] >[OFF:POST:http://wallpanel:2323/?password=XXXXXX&cmd=screenOff]"}
Dimmer Wallpanel_screenBrightness "Brightness [%d]" (gWallpanel) {http="<[wallpanel_deviceInfo:10000:JS(wallpanel_screenBrightness.js)]"}
Number Wallpanel_screenOffTimer "Screeensaver/OFF [%d s]" <tabletoff> (gWallpanel)

String Wallpanel_displayURL
String Wallpanel_TTS
Switch Wallpanel_Notification

wallpanel_isScreenOn.js:

(function(json){
    var deviceInfo = JSON.parse(json);
    if (deviceInfo.isScreenOn) {
        return 'ON';
     } else {
         return 'OFF';
     }
})(input)

wallpanel_screenBrightness.js:

(function(json){
    var deviceSettings = JSON.parse(json);
    return Math.round(parseInt(deviceSettings.screenBrightness) / 2.55);
})(input)

wallpanel.rules:

import java.net.URLEncoder

rule "Wallpanel_Schedule_photoFrameON"
when
    Time cron "0 0 18 ? * MON,TUE,WED,THU,FRI *" or
    Time cron "0 0 12 ? * SAT,SUN *"
then
    sendHttpPostRequest('http://wallpanel:2323/?password=XXXXX&cmd=setStringSetting&key=timeToScreenOffV2&value=0') 
    sendHttpPostRequest('http://wallpanel:2323/?password=XXXXX&cmd=setStringSetting&key=timeToScreensaverV2&value='+Wallpanel_screenOffTimer.state.toString)
    Wallpanel_screenOn.sendCommand(ON)
end

rule "Wallpanel_Schedule_photoFrameOFF"
when
    Time cron "	0 0 22 1/1 * ? *"
then
    sendHttpPostRequest('http://wallpanel:2323/?password=XXXXX&cmd=stopScreensaver') //exit screensaver
    sendHttpPostRequest('http://wallpanel:2323/?password=XXXXX&cmd=setStringSetting&key=timeToScreenOffV2&value='+Wallpanel_screenOffTimer.state.toString)
    sendHttpPostRequest('http://wallpanel:2323/?password=XXXXX&cmd=setStringSetting&key=timeToScreensaverV2&value=0')
    Wallpanel_screenOn.sendCommand(OFF)
end

rule "Wallpanel_Notification"
when
    Item Wallpanel_Notification changed to ON
then
    if(Wallpanel_displayURL.state != NULL){
        if(Wallpanel_screenOn.state != ON) {
            logWarn("DEBUG","Wallpanel - turning ON screen...")
            Wallpanel_screenOn.sendCommand(ON)
            Thread::sleep(250)
        }

        sendHttpPostRequest('http://wallpanel:2323/?password=XXXXXX&cmd=stopScreensaver')

        sendHttpPostRequest('http://wallpanel:2323/?password=XXXXX&cmd=loadURL&url=' + URLEncoder::encode(Wallpanel_displayURL.state.toString,'UTF-8'))
        Thread::sleep(100)
        Wallpanel_displayURL.postUpdate(NULL)
    }
    if(Wallpanel_TTS.state != NULL){
        sendHttpPostRequest('http://wallpanel:2323/?password=XXXXX&cmd=textToSpeech&text=' + Wallpanel_TTS.state.toString.replaceAll(" ","+"))
        Thread::sleep(100)
        Wallpanel_TTS.postUpdate(NULL)
    }
    Wallpanel_Notification.postUpdate(OFF)
end

rule "Wallpanel_screenBrightness"
when
    Item Wallpanel_screenBrightness received command
then
    val new_brightness = Math::round((Wallpanel_screenBrightness.state as Number).intValue * 2.55).intValue
    //logWarn("DEBUG","new_brightness = [" + new_brightness + "]")
    sendHttpPostRequest('http://wallpanel:2323/?password=XXXXXX&cmd=setStringSetting&key=screenBrightness&value=' + new_brightness)
end

The rules are pretty much self explanatory…
One thing I miss is the ability to set volume level through REST, but the developer said that maybe this would be added in a future release.

4 Likes

Did it arrive at the end? What is your experience with this magnet thing? Useful?

Cheers!

hi guys,

can you confirm this app also runs on the new fire tablet, they are now off for valentines day here:

what i want to have is motion detection - turn on when someone steps in front of panel - does this work?

Hey @waitz_sebastian, thanks for the info! Did you find the REST API parameter to see wether the pad is charging? And how did you get about the screen unlocking? Did you root your Tablet? I am trying hard but the thread I found from xda developers does not work properly… if you could point me to somewhere else I would be reeeallly happy :wink:

Thanks in advance!

Hey @Klimbim,
I havent checked for param if device is charging. In the past I used the “current battery status” and started charging when it dropped below 10% and stopped at 99%. But currently my device is always connected.
But you can check the Rest API docs here.

For “unlock by motion or sound detection” I indeed had to root the device. There was a quite lengthy thread on xda-developers about HD10 depending on which firmware you are currently on.
Since I rooted the device long time ago and set the config to “never update” I dont have current insights if the device is root’able at all with current firmware.

1 Like

Thanks!

Did anyone try to let the device unlock when woken on motion? I rooted my fire tablet HD10 but it still is locked after detecting a motion. I granted all privileges but it doesn’t show up as sudouser for instance. I simply think the app does not request a sudo access to be able to unlock the screen… I also tried to turn off and on the screen via REST API and it ended up with a lock screen as well.

Anyone any idea? Any other app recommended?

Did anyone try another app that shuts down the tablet and reboots it after a while for instance? This could save energy as well during the day when you don’t need it…

Thanks in advance!

Hey @Mario.o thanks for the hint. Finally I achieved it with unlocking the device.

However I must admit that I was really unhappy with fully kiosk browser and running habpanel in the browser; I had lags everytime, the page woulnd’t reload, the gauges and indicator were not update and and and; the device was running all time so this coulnd’t be the cause for it.

Does anyone have similar bad experiences with habpanel as smarthome center display system?

Cheers
Klim

Nope, running fine with FKB.

Very pleased with Fully Kiosk. I actually started with a cheap PoE 10 screen from hopestar (China) so I could have a video entry system to see whos at the door and talk to them if needed. I use a Ring Doorbell and Tasker opens the ring app fullscreen video if the doorbell is rung.

The remainder of the time I have screen motion turn on the screen and display Habpanel weather, thermostats and a few switches. I also have Habpanel display moode audio UI if I want to listen to radio.

Thanks for the contributions for working the REST API above… I think I will try these also.

Stuart

Hmm interesting, seems that only I experienced those problems. Any idea where I could start debugging?

Try filtering the items:

1 Like

Hi,

does anyone use the mqtt feature? I get it to connect to mosquitto but doesnt understand syntax how to publish topics e.g. screen off