Wildcard rule (when anything changes)

Hello all,

I’ve been using OpenHAB (1.x) for quite some time now, and I feel that I’ve figured out how to do most stuff, from calculating the sun’s position to chaining rules and timers together. Unfortunately, I’m a little stumped right now, and I’m not even sure what I want is possible (without extreme messy code).

I use XMPP for status information and querying the status of items. For example, an XMPP message is sent to me when a fault condition is detected in the heating or various other systems/appliances. Equally, I can send a ‘command’ (a.k.a. text string) to my (dummy) XMPP item, and it will reply with some information based on the text I sent.

Now, for my own debugging purposes, I would like a couple of things which I will attempt to explain/describe as best I can:

  1. I would like to be able to toggle a flag somewhere (REST API, XMPP, however) that will send me any “changes” in the state of items via XMPP. E.g. BG_TEMPERATURE changed from 12.3 to 12.4 degrees or FRONT_DOOR changed to OPEN.

I know that I can add a rule for every individual item to achieve this. That would however be detrimental to the rule codebase with my 150+ items. Is there a ‘wildcard’ that I can use to make a rule that when “*” changes, an action is performed?

  1. It would be handy to be able to enable ‘debug’ on any given item on the fly, equally for XMPP. Basically, I want the same thing as mentioned above, but then for ‘updates’ instead of ‘changes’. E.g. I would sent a command to OH (“send XMPP debug FRONT_DOOR”) and every update would be reported via XMPP. Logically, I would want a ‘debug off’ command, but that’s icing on the cake.

Have I gone totally nuts, or am I missing an easy way of implementing this? Thanks in advance!

Cheers,

PelliX

Maybe you should define a group that holds all items. This group could trigger a rule on updstes and you should be able to filter the right item and send a message.

Thomas

Hey,

thanks, I even have everything in a top level group All, with a few layers after that which I implemented at the time, but without a specific usage planned.

I can’t seem to get this to work, though. I’ve tried using the All (top level) group, and a group which contains items (as opposed to other groups). Sending an update/command to these items doesn’t trigger the “Item MyGroup changed” or “Item MyGroup received update” conditions.

UPDATE: I got the group ‘updates’ working, but this only works for items within the group mentioned in the rule. As my groups are virtually static, this is not an issue. Unfortunately, this doesn’t apply to the ‘changed’ condition.
On another note, is it in any way possible to use a (string) variable as the ‘Item’ in the condition of a rule?

Am I missing something here?

Cheers,

PelliX

OK, I’ve fixed most of it myself. The way I see it, if I have a ‘Debug’ group which I can place items in on the fly (via a rule) that would do me nicely.

I’ve got the debug group and a flag, which I can toggle, enabling or disabling any debug respectively. I just can’t seem to get the items added to the group dynamically. It’s also been a long day, maybe I’m just rambling here…

PelliX