Hi
how can I display a message on the panel when a certain situation occurs?
Hi
how can I display a message on the panel when a certain situation occurs?
You could try posting the required text into a String item and show that on your panel.
How can i show it in the Openhab Panel?
Do you really want to display such message on your normal UI? Why not send a notification to a device? Such would be displayed in the notification area of that device. See Cloud Notification
Interesting
But i’d like to have a message on the panel because i want to use e tablet dedicated fixed on the wall
How are your currently displaying values / strings / numbers / statuses on your panel?
I want to display a string when the shutter is completly closed
Ok…
Sorry that I’m (we are) not spoon feeding you the answer, but it is far better for you to be clear about what you want, so that you can find the answer by learning, rather than simply following instruction.
So…
How is this status information currently available to you?
How (exactly) do you want to display it in (which) UI?
I know when a shutter is completly opened or closed. In this situation i want to display on the panel this information.
In particular i have an item type number.
I want to display on the panel " The shutter is completly opened" in the case 1)
“The shutter is completly closed” in the case 2)
I hope that now it is clear.
I report the 2 rules. The first to close the shutter and the second to open:
var Timer tApertura = null
rule "chiusura"
when
Item LivingRoom_Light1 changed to ON
then
var Number x = 0
var Number y = 0
var Number z = 0
//logWarn("Alarm", "The {} dovrebbe essere zero", Auto.state)
if (Auto.state == 0) {
Auto.postUpdate(1)
// logWarn("Alarm", "The {} dopo messo a 1", Auto.state)
//
z = (Percentuale.state)
logWarn("Alarm", "Quanto vale Percentuale parte 2? {}", Percentuale.state)
logWarn("Alarm", "Quanto vale z? {}", z)
if (z == 0) {
z = 24
logWarn("Alarm", "Quanto vale z2? {}", z)
logInfo("AVVISO", "LA SERRANDA E' GIA' TUTTA ABBASSATA")
LivingRoom_Light1.sendCommand(OFF)
return;
}
if (z <= 24) {
Percentuale.postUpdate(0)
y = (24 - z).intValue
tApertura?.cancel
tApertura = createTimer(now.plusSeconds(y)) [|
LivingRoom_Light1.sendCommand(OFF)
]
return;
}
}
//
if(DimmerCam.state instanceof Number)
x = ((DimmerCam.state as Number) * 0.24).intValue
logWarn("Alarm", "Quanto vale x? {}", x)
// y è la variabile che ci dice quanti secondi ci mancano
// per chiudere totalmente la serranda
// logWarn("Alarm", "Quanto vale Percentuale parte 1? {}", Percentuale.state)
z = (Percentuale.state)
logWarn("Alarm", "Quanto vale Percentuale parte 2? {}", Percentuale.state)
logWarn("Alarm", "Quanto vale z? {}", z)
if (z == 0) {
z = 24
logWarn("Alarm", "Quanto vale z2? {}", z)
logInfo("AVVISO", "LA SERRANDA E' GIA' TUTTA ABBASSATA")
LivingRoom_Light1.sendCommand(OFF)
return;
}
if (z <= x) {
Percentuale.postUpdate(0)
y = (x - z).intValue
tApertura?.cancel
tApertura = createTimer(now.plusSeconds(y)) [|
LivingRoom_Light1.sendCommand(OFF)
]
return;
}
y = (z - x)
z = y
logWarn("Alarm", "Quanto vale z4? {}", z)
Percentuale.postUpdate(z)
logWarn("Alarm", "Quanto vale z2Percentuale parte 3? {}", Percentuale.state)
//
tApertura?.cancel
tApertura = createTimer(now.plusSeconds(x)) [|
LivingRoom_Light1.sendCommand(OFF)
]
end
rule "apertura"
when
Item LivingRoom_Light2 changed to ON
then
//
var Number x = 0
var Number y = 0
var Number z = 0
//
//logWarn("Alarm", "The {} dovrebbe essere zero", Auto.state)
if (Auto.state == 0) {
Auto.postUpdate(1)
// logWarn("Alarm", "The {} dopo messo a 1", Auto.state)
//
z = (Percentuale.state)
logWarn("Alarm", "Quanto vale PercentualeApertura parte 2? {}", Percentuale.state)
logWarn("Alarm", "Quanto vale z? {}", z)
if (z == 24) {
// z = 24
logWarn("Alarm", "Quanto vale z2? {}", z)
logInfo("AVVISO", "LA SERRANDA E' GIA' TUTTA ALZATA")
LivingRoom_Light2.sendCommand(OFF)
return;
}
if (z <= 24) {
Percentuale.postUpdate(24)
y = (24 - z).intValue
tApertura?.cancel
tApertura = createTimer(now.plusSeconds(y)) [|
LivingRoom_Light2.sendCommand(OFF)
]
return;
}
}
//
if(DimmerCam.state instanceof Number)
x = ((DimmerCam.state as Number) * 0.24).intValue
//
logWarn("Alarm", "Quanto vale x? {}", x)
// y è la variabile che ci dice quanti secondi ci mancano
// per aprire totalmente la serranda
// logWarn("Alarm", "Quanto vale Percentuale parte 1? {}", Percentuale.state)
z = (Percentuale.state)
logWarn("Alarm", "Quanto vale PercentualeApertura parte 2? {}", Percentuale.state)
logWarn("Alarm", "Quanto vale z? {}", z)
if (z == 24) {
// z = 24
logWarn("Alarm", "Quanto vale z2? {}", z)
logInfo("AVVISO", "LA SERRANDA E' GIA' TUTTA ALZATA")
LivingRoom_Light2.sendCommand(OFF)
return;
}
if (z >= x) {
Percentuale.postUpdate(24)
y = (z - x).intValue
tApertura?.cancel
tApertura = createTimer(now.plusSeconds(y)) [|
LivingRoom_Light2.sendCommand(OFF)
]
return;
}
y = (z + x)
z = y
logWarn("Alarm", "Quanto vale z4? {}", z)
Percentuale.postUpdate(z)
logWarn("Alarm", "Quanto vale z2PercentualeaP parte 3? {}", Percentuale.state)
//
tApertura?.cancel
tApertura = createTimer(now.plusSeconds(x)) [|
LivingRoom_Light2.sendCommand(OFF)
]
end