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
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