How to load url's on Tv with "Selection" Switch

Hardware: RPi3b+
OS: openhabian
openHAB version:2.5M6-2.5M5

Hi, and thanks for help in advance.

I try to create a multi-selection switch in the sitemap , for that i create a virtual item :

String TvHomeCinemaUrlList       "TVLG List Url"  

then i create a rules base on the state of this “item” TvHomeCinemaUrlList

here the rule:

rule "List of url LGTV"
when Item TvHomeCinemaUrlList received command
then
                
    switch receivedCommand{
                    case 0: actions.launchBrowser("http://192.168.2.30/photo/#!Albums")//lien vers Album General Sur synology
                    case 1: actions.launchBrowser("http://192.168.2.30/photo/#!Albums/album_5452494754")//lien vers Album Trigt Sur synology
                    case 2: actions.launchBrowser("http://192.168.2.40:81/ui3.htm")//lien vers camera General
                    case 3: actions.launchBrowser("http://192.168.2.40:81/ui3.htm?group=Rue")//lien vers camera Group Rue
                    case 4: actions.launchBrowser("http://192.168.2.40:81/ui3.htm?cam=Etang_alarm")//lien vers camera etang
                    case 5: actions.launchBrowser("http://192.168.2.40:81/ui3.htm?cam=Ruelle")//lien vers camera etang
                    case 6: actions.launchBrowser("http://192.168.2.40:81/ui3.htm?cam=Noyer")//lien vers camera Noyer
                    case 7: actions.launchBrowser("http://192.168.2.49/index.php?v=d&p=dashboard&object_id=2#")//lien vers camera Jeedom
                    case 8: actions.launchBrowser("http://192.168.2.34:8080/basicui/app?sitemap=sitemapTest")//lien vers camera Jeedom
    }
end

And a Sitemap :

Selection item=TvHomeCinemaUrlList icon="tv" mappings=[0="Album Photos",1="Album Photos TriGt",2="Camera Global",3="Camera Rue",4="Camera Etang",5="Camera Ruelle",6="Camera Noyer",6="Jeedom",7="Openhab"]

So when i select for exemple “Album Photos” a send command “0” but the actions don’t fire.
i suppose the “item type” of “TvHomeCinemaUrlList” wrong i thing i need to chose some channel like for Application selection but what type ?

if i change the item “TvHomeCinemaUrlList” like this :

String TvHomeCinemaUrlList       "TVLG List Url"  {channel="lgwebos:WebOSTV:tv1:appLauncher"} 

i recieve error like …command “0” don’t exist for appLauncher.
Ok is logic, but waht type chosing ? or…i’m totaly wrong ?

thanks for your help

I’d try it with a Number Type item.
Do not link a channel to this item, you want to control the state of this item with the selection and you want the rule to perform the action!

1 Like

To add to what @opus says, when you send the command 0 from your UI to Item TvHomeCinemaUrlList, it gets passed to the channel and so to the binding, as always happens with commands. The binding does not know what to do with 0, it’s expecting a URL.

If you must use only one Item you can make a long sitemap line

Selection item=TvHomeCinemaUrlList icon="tv" mappings=["http://192.168.2.30/photo/#!Albums"="Album Photos","http://192.168.2.30/photo/#!Albums/album_5452494754"="Album Photos TriGt", ...
1 Like

Thanks a lot, so now the url is send to the item, I change this item to number and I have no error, but… My item have no channel actually, so I need to find the right Channel for sending this urls to.

Thanks again :+1:

How do we launch the browser in full screen mode?