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.