Include Itemlabel in notice string

Hi everyone I’m looking for a way to include itemLabel in notice beekng sent from OH usong sendBroadcastNotification. I’m doing this to setup my new stage of systemmonitoring. I use alot o zwave devices and have up untill now had all triggerd events being sent but since OH in general and Zwave particulary is beeing very reliable I wold conbert to only being noticed if sometgjng goes wrong.

I’ve set up a couple of rules just for testing and got it working in general. I first put up some global variables that i call itemname_lowerLimit and here i set a minimum allowed power consuption. And then I hard coded the actual measseage in each rule but to make things easier I would like to be able to retrive itemLabel into the string being sent so the string being sent looks like ItemLabel broken, in my case I have the actual location of the item in the label so in reality it could look like garage heating broken. I have no idea of where to start tryjng this since I’m not that good coder even that I do know some but am eager to learn I dont post my code yet and hope for som informative help rather than a solution.

.items

Number MyScenes "Scene Number is [%s]"

.rules

logInfo("Label", MyScenes.label.toString )

Produces following output in the log.

[INFO ] [.eclipse.smarthome.model.script.Label] - Scene Number is

Is an additional approach as, with @Josar’s approach, as you can see, sometimes the label doesn’t make sense in the context of an alert message.

There are lots of options. :slight_smile:

Nice information sad that I didn’t find it myself instead of posting a new topic. I’m currently away from home for the moment even if I could update rules remotley I would not do do due to cold weather and my garage heater depends on OH.

Hello here’s how I implemented the suggestion since my item label is Office I now get Office lamp out of order as a push notice really nice to hav I suppose. It seem like I need to have two rule for same issue. First rule trigger if lamp is consuming to little power when it recives command on and second rule triggers when power consumption drops whiule lamp is in state on. Could I make a local val for this kind of rules that makes it even faster to reproduce something like so I just need to set item name in rules first row and then i gathers that item to a val?

rule “Felrapport”

when Item z11 changed from OFF to ON
then
Thread::sleep(failTime)
if (z11_power.state < z11_lowerLimit){
sendBroadcastNotification(z11.label.toString +" fönsterlampa trasig")
}
end

rule “Felrapport 2"
when Item z11_power changed
then
if (z11.state==ON && z11_power.state < z11_lowerLimit){
sendBroadcastNotification(z11.label.toString +” fönsterlampa trasig")
}
end