i’m running OpenHab Android on some older Android devices, used for door intercom (hikvisoon), they have a customized launcher, but i’m able to install .apk on it… Since they are slow, i need to use baisuc UI, it runs well
The problem is, there is no back button on the android device itself, so once the app is open, i cant close it anymore… i cant go back to the home screen
Is there a way to create buttons/items in basicUI that can for example close the app using intent? Or can i start another app from a widget?
No, the Android app doesn’t support anything like that.
I looked a little to see if something could be done using Tasker but I don’t see anything there that would work with OH Items either.
The “swipe from the left side of the screen” gesture has been supported by Android for several versions now, is that possibly an option? “Swipe from the bottom” is the gesture to return home. I can’t remember the last time I’ve had an Android phone with a home button.
With tasker you could potentially intercept a volume/power button press or a tap pattern (e.g. double tap on the screen) to go home or go back. But that would be independent of OH.
Swiping up down left right, doesn’t provide me anything to get back to home screen, it’s like indeed openhab is in somekind of fullscreen, while that setting is OFF…
A gesture double tap is indeed an alternative approach using tasker/automatte…
But I was opening it could be done in Openhab itself…
Is it btw possible to to open another sitemap page with a widget?
I have 2 , instead of going to menu, it was better to have a shorrcut button…
Yes it is possible.
You just have to enable debugging on you android device.
Then you can install the ‘adb binding’ and you can control your device running the App using your openhab-instance.
See here:
aha, both interesting, gonna read about the debug bridge indeed!!
about that UI command item:
Similar to the [UI command Item in Main UI (opens new window)](https://next.openhab.org/docs/mainui/about#ui-command-item)you can use a String Item to control the Sitemaps. Whenever the configured Item receives a command, the app reacts on this command. Examples:
above is not clear to me? so i make a string item , that item is visible in basicUI on my page, and that makes it clickable to open another page? (sitemap) ?
Yes, this should work: Define a new string item. Than you can define command options in the metadata of you item.
In the settings of your app you can define the item that is used to control the sitemap.
There is just one problem: At the moment I can not find the setting to define the item. I am pretty sure it was there before…? Maybe an update deleted it?
Hmm I never used this feature so maybe someone else can help?
You are jumping between using the term “widget” and “sitemap”. Sitemaps do not have widgets. Widgets are a MainUI only thing. Sitemaps have a fixed number of “elements”.
For sitemaps see Sitemaps | openHAB. There’s several options available but I suspect a Switch element with mappings is going to be what you want to use.
On my android app, i enabled the “UI setting”, named the field also “switchsitemap”
the on my sitemap, i add an switch element, so turning on/off should browse to page 0 or page 1 ?
Sorry for the confusion. The command option is used when you use the main UI.
Problem here is that the ‘=’ used in the sitemap, is here interpreted as ‘label’. So it might not work ‘out of the box’. So you can delete this.
I think you are on a good way.
Like Rich is saying you need a mapping in the sitemap so you can chose between. See here:
indeed, its partially working, instead of an switch element, i added a button grid for test, with 4 buttons like below, but indeed i struggle with the =
the first 2 buttons always navigate to site0
the 3th and 4th button dont do anything, they are also labeled strange like site0" and site1"
not sure how i can fix that ? i need the “=” since its part of the url (navigate) ?
Yes, this is the address like it is also shown in in the browser (url).
Sorry I am not that much into defining sitemaps and can not help you with that.
The workaround would be to make a rule (blockly) where you can send the command sting directly to your “switchsitemap” item. Like a statemachine. For example you create a number item.
Depending on the state of your numer item you send the command string to your “switchsitemap” item.
But this is just an idea…
hmm, still new to openhab, so i need to learn that…
but for test, i now edited my “string” UI item, with just 1 command, even that fails because of the “=” between it… for test i used site1 … when pressing the button , it just takes the default sitemap, in my case “site0” …
so your workaround is probably also not going to work? i cant even define a correct string item with the correct command options?
ok, but the UI item i create in the first place, needs to be a string item? like described in the manual? or can i just create an number item? so i can use your alternative approach ?
do i need to use that blockly also? can it not be done without ? just send a command like “navigate:/basicui/app?sitemap=site1” to the item?
I don’t think that this is working, but you can give it a try.
For the start this might be the easiest way… (To send your string with “=” to the item).
There might be an other way using transformations. But i am also not very good in this.
Remark: This might only work when you want to send data to a channel of a binding. But in your case you ‘only’ want to send the right string to an item. So this will not work I think.