mapdb in openhab2?

501 views
Skip to first unread message

ashish nagar

unread,
Dec 3, 2014, 7:30:25 AM12/3/14
to open...@googlegroups.com

Using paperui, added item to the group.  Noticed that the demo.items file does not update.  The data is going in /userdata/mapdb/storage.mapdb..

1. What is the concept behind mapdb?  does eclipse smart home uses mapdb to store all the changes?  

2. What is the relation between demo.items and mapdb? If demo.items is manually updated, the framework automatically find the updates.

3. Which part of the openhab updates mapdb  i.e openhab2, eclipse smarthome framework, or paperUI.


I like to do following:

1. Write custom binding with discovery support or use existing binding like hue or wemo which has discovery support.
2. Discovered items are visible in Inbox. what is the Inbox concept? 
3. PaperUI has button (+) to add Inbox item as a thing - Is there an documentation to see the api call to do this?
2. Add and configure discovered thing as Item   - do I have to add item information like item name, item type, and binding info in demo.config or is there any way to automate this step?
3. Once item binding is set, start controlling the device using UI

Regards,

Ashish

Kai Kreuzer

unread,
Dec 5, 2014, 4:55:40 PM12/5/14
to open...@googlegroups.com
Yes, mapdb is used as an alternative provider for items (and things, links etc.) besides the DSL files. While the DSLs are treated as a read-only input by the user/admin, the mapdb entries can be changed through the REST API, which is used by the Paper UI.

Note that a binding should never ever directly manipulate entries in mapdb by itself. It must also not create items by itself. All it should do is to create DiscoveryResults (for "Things", see https://github.com/eclipse/smarthome/blob/master/docs/sources/architecture/discovery.md) and handle events for thing channels.

What items exist and how they are linked to channels is up to the application, not the binding. There is e.g. an optional item provider in openHAB 2 (https://github.com/openhab/openhab2/blob/master/bundles/core/org.openhab.core/src/main/java/org/openhab/core/internal/item/ThingItemUIProvider.java), which dynamically creates items for all channels of all things - this is probably what you might want to use. You can see a screencast using this here: https://www.youtube.com/watch?v=zEspMCncg90

We will work on the documentation of this stuff, sorry that it is not yet available.

Regards,
Kai
Reply all
Reply to author
Forward
0 new messages