Webview inside Group item

Hi people i need help, i want move Webview item inside Group, google has’t provided answer for my question ))) Can some one help me please ?

my home.items

Group GSM “Mobile network”
String gsmSMSrec “Received sms message [%s]” (GSM)

my home.sitemap

Group item=GSM
Webview url=“http://0.0.0.0/dot.php

Is it possible to declared Webview into items ?
Thanks in advance

No, this isn’t possible. Please forget about groups when designing an UI, this is crap. You can’t control the order of group members (well, in fact you can by listing all items in one file, but this way only one order per group), you can’t setup special appearance as color changing label, hiding items dependent on an item state, special label and so on.
The only solution is to write down the entire sitemap, so instead of

Group item=myGroup

just write

Text label="Mobile network" {
    Text item=gsmSMSrec
    Webview url=“http://0.0.0.0/dot.php”  //pretty sure the ip is wrong ;)
}

In fact, you even could use

Group item=GSM {
    Webview url=“http://0.0.0.0/dot.php”  //pretty sure the ip is wrong ;)
}

but be aware that you loose control over your item(s).

1 Like

Thanks a lot for answer, yes IP is wrong :slight_smile: just sample :slight_smile:

By the way, can you please help me with installation of IpCamera add-on, i could find this add-on in the Paper UI > Add-ons section, is it possible to install it manually ?

No, sorry, you will need a compiled jar for (manual) installation. As I don’t use this binding, I have no idea.

1 Like

Ok thanks,

Last questio :slight_smile: do you know who to create rule to monitor state ip thought Network binding ?
For instance i have following rule:
rule “Test mqtt”
when
Item errorMSG received update
then
if (errorMSG.state==“HELLO”)
{
sendPushbulletNote("mymail@mail.com",“IT WORKED”, “Mode is ON”)
}
end

How to make same thing to detect network ip down or up with Network Binding add-on , thanks in advance :slight_smile:

Just install the network binding and create an item:
thing:

Thing network:pingdevice:mydevice "My Device" @ "Ping" [ hostname="ip.or.hostname", port=0, retry=1, timeout=5000, refresh_interval=60000, use_system_ping="false", dhcplisten="false" ]

item:

Switch myPingDevice "My Device" { channel="network:pingdevice:mydevice:online" }

rule:

rule myPingRule
when
    Item myPingDevice changed
then
    logInfo("ping","myPingDevice changed state to {}",myPingDevice.state)
end
1 Like

That awesome and easy thank a lot for help :slight_smile:
i will test it right now :slight_smile:

Another least question :slight_smile:
Is possible same way as

myPingDevice.state

pass MQTT message ?:

rule “Test mqtt”
when
Item errorMSG received update
then
if (errorMSG.state==“HELLO”)
{
sendPushbulletNote("mymail@mail.com",“IT WORKED”, “to here ?”)
}
end

Thanks a again :slight_smile:

I don’t know exactly what’s the goal.
item:

String MyMQTTitem "MQTT item" { mqtt="< [mybroker:topic/to/message:state:default]" }

rule:

rule myMQTTmessage
when
    Item MyMQTTitem changed
then
    val string sMessage = "The Message was '" + MyMQTTitem.state.toString + "'"
    sendPushbulletNote("mymail@mail.com",“IT WORKED”, sMessage)
end
1 Like

That great, thanks a lot for help, i don’t want bother you again, could you please provide reference or some documentation for that configuration ? :slight_smile:
One more before i stop asking ))) Can i parse MQTT message and add between message some String value, for instance :
thought MQTT i receiving time online main controller like that - 2:23:22 can i change it to 2 Day : 22 Hours : 22 Minute or better to do it from controller side?

And is it wait to get system time and date from server , to show current date and time ?

Works great, only what i changed is :

Item securMSG received update

Thanks a lot, you help me a lot.

should be easy…

val string sDay = myItem.state.toString.split(':').get(0)
val string sHour = myItem.state.toString.split(':').get(1)
val string sMinute = myItem.state.toString.split(':').get(2)
val string sMessage = sDay + " Day" + if(sDay!="1") "s" + " : " + sHour + " Hour" + if(sHour!="1") "s" + " : " + sMinute + " Minute" + if(sMinute!="1") "s"

If there is a leading 0 for hours and minutes, you will have to add a 0 to the if-statement:

val string sMessage = sDay + " Day" + if(sDay!="1") "s" + " : " + sHour + " Hour" + if(sHour!="01") "s" + " : " + sMinute + " Minute" + if(sMinute!="01") "s"

For current Time and Date, you should use the ntp binding.

In question of code reference, there is a lot of stuff (code examples) in the community, but no reference, as no one has written a reference yet. You can get some information under https://www.openhab.org/docs/configuration/rules-dsl.html though, and there are some links in the document for further information.

1 Like
val string sDay = myItem.state.toString.split(':').get(0)
val string sHour = myItem.state.toString.split(':').get(1)
val string sMinute = myItem.state.toString.split(':').get(2)
val string sMessage = sDay + " Day" + if(sDay!="1") "s" + " : " + sHour + " Hour" + if(sHour!="1") "s" + " : " + sMinute + " Minute" + if(sMinute!="1") "s"

Where i should declare this code, in rules ? or it possible direct in item ?

my home.item:

String timeOnline "Time Online [%s]" <time> {mqtt="<[broker:/monitor/main/timeOnline:state:default]"}

my home.sitemap:

    Frame label="Main Controller Status" {
    Text item=timeOnline
    }

Thanks :slight_smile:

When it comes to vars and vals, we’re always talking about rules…

If you want the same thing in the label, you will have to use a Java Script:

String timeOnline "Time Online [%s]" <time> {mqtt="<[broker:/monitor/main/timeOnline:state:JS(timetotext.js)]"}

and in ./transformations/timetotext.js:

(function(dataString) {
    val sArray = dataString.split(':');
    val reply = sArray[0] + " Day" + if(sArray[0] != "1") "s" + " : " + sArray[1] + " Hour" + if(sArray[1] != "01") "s" + " : " + sArray[2] + " Minute" + if(sArray[2] != "01") "s";
    return reply;
})(input)

I did not test this script!

Thanks, a don’t want play with JavaScript easy changed it on the controller side :slight_smile:
I found some tricks who to forward all log to syslog server but couldn’t understand where this code should be located:

How to redirect your log entries to the syslog

You just need to add some lines to your logback.xml.

Like:

&lt;appender name="SYSLOG" class="ch.qos.logback.classic.net.SyslogAppender"&gt; &lt;syslogHost&gt;localhost&lt;/syslogHost&gt; &lt;facility&gt;AUTH&lt;/facility&gt; &lt;suffixPattern&gt;{}openhab: [%thread] %logger %msg&lt;/suffixPattern&gt; &lt;/appender&gt; &lt;root level="INFO"&gt; &lt;appender-ref ref="SYSLOG" /&gt; &lt;/root&gt;

Link:

can you please help me with that ?

This is outdated, as we’re on OH2! The logging is completely different to OH1. There are several postings in the community, just do a little search :wink:

1 Like