HABPanelViewer 0.9.27

re. audio notification…

IMHO, here is the approach I would try first;
• 1 to make compatible in general, not just while using/in HABPanelViewer
• 2 prevent scope creep (which I’m guessing is why you are asking :blush: )
• 3 wouldn’t have to add samba/other components to sync status, etc.

Create a simple html5 app to create/play voice message files within OH html path, ex. http://openhabian:8080/static/voicenote and a message store folder like ~/voicenote/msg (o+rw) to store the recording(s).
Ex. https://developers.google.com/web/fundamentals/media/recording-audio/

The html5 app would be responsible to set/clear an OH ITEM switch like “msg_waiting”

In HABPanel, on the main screen at a button that is flashing red (animated .gif) when “msg_waiting” is ON. When button is pressed, switches to the “VoiceNote” screen/panel that has the html5 app within a frame/custom widget to play/create voice msgs, etc.

Ex. My using my front door panel
Untitled
with msg waiting button bound to “msg_waiting” item, flashing/alternating colors when ON.

Other options (just ideas):

  1. VoiceNote app could be a “binding”/module add-on
  2. Lastly, create a plug-in model for habpanelviewer where “voice-note” would be optional and others may have “plug-in” ideas to extend habpanelviewer. (I can think of other potential plugin ideas, ex. for my Doorbird to enable talkback, etc)

Just my $0.02

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

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

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

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!

Can you implement this too?

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

That’s exactly what it does

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.

On the Lenovos double tap is stock to go on.

BR

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.

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.

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

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.

5 Likes

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

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.

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.

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.

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.

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

1 Like

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