HABPanelViewer

android
habpanel
Tags: #<Tag:0x00007f6ce92825a0> #<Tag:0x00007f6ce9282460>

(Dani) #181

I’ve used a workaround to be able to display non-public calendar in an iframe widget in this app.

For this I’ve misued the server url function to load first google website. You’ll get an error message that habpanel html was not found (or something similar), but after clicking on the google logo at the top I was able to use google sign-in. Once the login was completed I’ve changed back to the server url and voila - iframe now also displays the embedded non-public calendar.

It may be useful for some people who are dealing with similar issues.

Regards


(Bogumil J.) #182

@vbier how can I force refresh items like Connected Item, Battery Level Item or the whole app? They don’t refresh in my case after I restart OpenHAB. It wolud be great to have possibility of restarting app or refresh page via openhab item.


(Volker Bier) #183

By adding the code and creating a pull request. There is currently no way to do this.

Edit: I am currently thinking about changing device control to have a single String Item that allows to send the different commands to HABPanelViewer. This would allow to have a RESTART command that allows to restart HABPanelViewer (which would trigger sending of all device sensor values to openHAB) easily.

It could also be used to add other functionality for controlling the device, e.g.

  • turn bluetooth ON / OFF
  • trigger propagation of sensor values (which would fit you use case better, but is more difficult to implement)
  • control HABPanelViewer features, like enabling or diabling motion detection

(Bogumil J.) #184

I’m not software developer unfortunately :frowning_face: I can help with testing as I have 5 tablets and use your great app on them.

This seems to be good idea!


(Hallo Ween) #185

Can you implement this too?

Screen goes off (only black, not completely off) and after touching it, it is on again.


(scott dee) #186

That’s exactly what it does


(Hallo Ween) #187

I think now screen is off and i have to press power button to wake the tablet again?

I´m currently at work, so i can´t test it.

I want to only tap on the blank screen and tablet screen should be on again.


(Daniel) #188

On the Lenovos double tap is stock to go on.

BR


(Hallo Ween) #189

This may work on your lenovo. On my two tablets it isn´t working like this.

If the screen is off, i have to push the power button. Or i can do this with an openhab switch, i have configured an item inside HabPanelViewer.

But i don´t want to press a button first, i want to only touch the screen. If i have guests at my home, they should also be able to activate the screen.


(scott dee) #190

not sure how my reply ended up on this thread…sorry. halloween: i asked him to implement this feature in HPV and he wasn’t interested.


(scott dee) #191

as i said in the other topic, this can be done in FKB and I do exactly what you’re asking.
HPV does not do this and when I asked, @vbier, wasn’t interested in implementing it (and that’s fine, that’s not a complaint).


(Volker Bier) #192

I have done a bigger rewrite of the code that implements device control. There is now a version that only has a single String item in which openHAB can send commands to HABPanelViewer.

This version is not tested extensively, but I have been using it at home without problems for a few days.

It has a command SCREEN_DIM that does dim the screen to lowest brightness (with a listener for touch events that restores brightness) and a command KEEP_SCREEN_ON that disables the screen lock. If you want you can try if that works for you.

I have also added some more commands with additional functionality (as described in the in-app help):

  • RESTART: makes HabPanelViewer restart
  • SCREEN_ON: turns on the device screen
  • KEEP_SCREEN_ON: turns on the device screen and prevents the system from turning off the screen
  • ALLOW_SCREEN_OFF: allows the system to turn of the screen
  • SCREEN_DIM: dims the screen as much as possible and restores the brightness on touch event
  • MUTE: mutes the device
  • UNMUTE: restores the volume to the level the device had when it was muted
  • SET_VOLUME n: sets the device volume to n, being an integer between 0 and device max volume.
  • FLASH_ON: turns on the flashlight of the back-facing camera
  • FLASH_OFF: turns off the flashlight of the back-facing camera
  • FLASH_BLINK: blinks the flashlight of the back-facing camera with an interval of one second
  • FLASH_BLINK n: blinks the flashlight of the back-facing camera with an interval of n milliseconds
  • BLUETOOTH_ON: turn bluetooth on
  • BLUETOOTH_OFF: turn bluetooth off
  • ADMIN_LOCK_SCREEN: activates the lock screen (requires the app to be set as device admin in the settings)

The new architecture allows to add arbitrary commands more easily. You can find the apk on github only as it currently is in a separate branch:
https://github.com/vbier/habpanelviewer/raw/rewriteControlCode/app-debug.apk

It would be nice if some people could test this and report back in order to make a decision if this mechanism is better than the old one so I can merge it into master branch and have @miker release it on google.


(scott dee) #193

Thank you for doing that. Some of those additions looks pretty useful.
keep up the good work


(siegi simma) #194

Gave it a try.

Samsung tablet SM-T113
Android version: 4.4.4

Installation -> ok
HABPanel deshboard -> ok
"Habpanel viewer - status" -> ok
"Habpanel viewer - settings" -> App stops immediately

Maybe my Android version is to old.
so no further testing possible.


(Volker Bier) #195

Okay, I missed a point in the code that still accessed the old preferences that do no longer exist in the new version. This either worked because I still had the preference values from my previous install, or android 4.4 crashes and >4.4 copes with the problem.

Either way, I have fixed this and updated the apk.


(siegi simma) #196

I have tested my situation:
Switch ON tablet with external motion sensor. Allow tablet to switch OFF if no motion detected.
For this i used the commands; KEEP_SCREEN_ON, ALLOW_SCREEN_OFF)

Everything works fine -> congratulations

With the new version i need 2 rules now (no problem).

/*************************************************************
* Create commands for habpanel viewer
*************************************************************/
rule "HPV KeepScreenON"
    when
        Item BewegungGang_EG changed to OPEN		
    then
		hpViewerCommand.sendCommand("KEEP_SCREEN_ON")
end

rule "HPV AllowScreenOFF"
    when
        Item BewegungGang_EG changed to CLOSED		
    then
		hpViewerCommand.sendCommand("ALLOW_SCREEN_OFF")
end


It would be nice to have the last executed command shown on the status page.

remark:
With this solution (sending commands in a variable) i think it is necessary to use a timer in the rules (to prevent sending commands too fast). I have seen you reset the command after execution, but this doesn’t help much in rules which are triggered by events. Maybe this should be mentioned in the help file.


(Volker Bier) #197

You can also use admin_lock_screen in case you have no security set up on your device. This should turn off the screen immediately.

Regarding commands in quick succession, i would expect openHAB to not skip any updates. But I have not tested this. I will do some tests tomorrow.


(Volker Bier) #198

I have added a command UPDATE_ITEMS to the test version in case you want to check that out.


(Bogumil J.) #199

Thanks vbier! I will check it out once I get some free time. Cheers!


(Sjcliffe) #200

Great work @vbier! I’m running this on two Nexus 7 tablets.

One thing I’ve noticed is that if I turn the screen off with SCREEN_DIM then SCREEN_ON doesn’t actually turn the screen back on - it still needs a touch to do this.

I was using ADMIN_LOCK_SCREEN and SCREEN_ON to turn the screen off and on but my tablet looses Wifi connectivity when it sleeps (despite the fact I have Keep Wifi on during sleep set to always in the Android settings) so the SCREEN_ON doesn’t work reliably.