Rules for Discovered Things

Hello Friends. I have a custom binding that does its own discovery. I would like to add some rules for things that it produces.

  1. Currently there is no way to do that from PaperUI, correct?

  2. How to I address these discovered Things from the rules file? (All the examples in the wiki use the name from the config file, which I do not use with discovery)

This is a kind of workaround solution but you can use the REST API to see what items are in your setup.

http://< your ip >:8080/rest/items

Once you’ve got the item name (which is usually < thing uid >_< channel >) you can use them in rules.

This is not possible.
Rules are defined on the application layer (the items), which the user has to define.
The Things are only a helping construct for the user to link his items to some physical device.

Thank you for the tip. I was able to find the binding_thing_channel concatenated name in the rest api output.

One more question - does the framework monitor changes in the rules file, or do I have to restart?

Kai, will there be an ability in the future maybe, for rules to be specified through the web interface?

This reminds me of some erratic behavior I have been seeing whilst developing my OH2 binding. The automatic creation of items from a channel…is expected functionality and is here to stay? Sometimes I’ve noticed my Thing’s channels haven’t linked to items and I have to manually add the link in the UI.

No, this was rather a hack for some quick results - in the recent builds of OH2, this is deactivated, so it is up to the user to create items and link them to their device (what people are doing in OH1 as well).

Not for the openHAB 1 like rules (in *.rules files), but for the new rule engine, yes. This is currently worked on in Eclipse SmartHome, see e.g. https://github.com/eclipse/smarthome/pull/726

Doesn’t that take away from the aim to make OH2 more plug and play than OH1? Personally the fact that devices could be discovered and I could use them with zero, to little, configuration was what drew me to OH2 over OH1.

This is the case for me as well.

The uppermost priority is to have OH2 be backward compatible with OH1 and taking away the freedom to define items from the user would be a tough limitation in functionality. I am thinking about a kind of “easy mode” for beginners, where items are automatically derived. But this needs some more work on the concepts and implementation, which I won’t have time to solve in short term.

Is it worth having some sort of issue raised to discuss ideas?

I’m a big believer that wider user adoption will be driven through having a system that “just works” for the most part. Having read quite a few forums posts the big turn off for people that would like to try home automation is the steep learning experience before any sort of gratification.

The user experience for someone installing OH, adding/enabling the correct binding and being able to control their lights or wall sockets etc without any configuration is much more appealing to having to sit down with an editor or configuration page.

On the other-hand I can also see the need/usefulness of being able to manually configure things, channels and items which, to be honest, I’m mainly using for ‘virtual’ or ‘proxy’ items. So I guess I’m hoping for a world where both of these features can co-exist.

Granted I know that OH2 is WIP and things are subject to change with little(no) notice, was there a reason the automatic item generation was turned off now? i.e. was it stopping/delaying progression of some other development?

How can I add this to my OpenHab2 installation?

This is not yet integrated with OH2. Will probably provide it as an experimental feature in the coming weeks.