I have become very confused on how to add items and modify site maps.
I enabled the Demo sitemap via the paper UI and I have looked at the demo.sitemap in the Eclipse smart home designer but I can not find the standard sitemap to modify.
Also one basic thing that I wanted to try as I was learning was to add a switch item for my presence that I could use in a rule to disable my alarm and turn my TV on. But I’ve spent hours looking through the documentation and forum and can not find anything. Any help would be greatly appreciated.
Presence detecting is tricky and there are dozens of ways to do it. Some people use the Network Health binding to ping their phones, others use Mqttitude or IFTTT to track geological. I use a combo of network health and some custom python scripts which detect when our phones are near based on Bluetooth.
But the basic approach is always the same. Create a Switch or Switches that are ON when presence is detected, a group to aggregate those switches into one, and in your rules either trigger on the group changes or check the group’s state to determine presence.
I’ve worked out the methods for detecting presence, I was going to use a combination of bluetooth tags, scripts on my dd-wrt router and IFTTT geo-location. Then build rules that cover senerios like my wife’s phone going flat… But to start with I just wanted to create a manual toggled switch I can change via the interface.
But my real question is. I don’t know how to create switches in openhab2 and secondly I don’t know how to create a custom sitemap.
Install openhab2 demo (download zip, extract zip)
Before you start:
edit addons.cfg ->package = demo
start openhab2 (Windows:start.bat)
Create an item in "demo.item"
Switch HouseStatus
Insert into "demo.sitemap"
Switch icon=“present” label=“House State” item=HouseStatus mappings=[OFF=“Absent”,ON=“Present”]
Insert into "demo.rules"
rule "House leave"
when
Item HouseStatus received command OFF
then
gSonosPlayer.send(PAUSE) (example)
gLight.send(OFF) (example)
…
…
end
Can you help me glue this together, I must be missing a step. My goal is to create better sitemap for use by Paper UI.
I have created a sitemap and added a switch item to it, using the item name I have taken from Paper UI (which operates the switch fine:
The error I am getting is:
18:12:59.091 [WARN ] [.classic.internal.servlet.CmdServlet] - Received command ‘TOGGLE’ for item ‘zwave’, but the item does not exist in the registry
PaperUI doesn’t use nor does it work with sitemaps. PaperUI is intended to be an administration user interface. ClassicUI and BasicUI use sitemaps.
That does not look like an Item name. That looks like a Channel ID. One must bind an Item to a Channel in a .items file. I’m told that PaperUI and/or Habmin let you create Items but most people manually edit Items files.
Things represent a device. Channels represent one way to communicate with that device. Items are the abstract concept OH uses to operate on all devices the same way.
This is what I was searching for!
I have my own sitemap working so that is all god. But it is not the default one, so I have to add the “?sitemap=” to the url, which is a bit tidy at least on the phone. So I was glad to read about the possibility to choose the default sitemap in “basicui.cfg”.
However…I cannot find any*ui.cfg. . Where is it supposed to be?
I found that replacing the : in the above id which is provided by the PaperUI, then it becomes a valid item name (ie no requirement to add in a .items file.
e.g. from Switch item=zwave:device:b905e63e:node3:switch_binary to Switch item=zwave_device_b905e63e_node3_switch_binary
Thanks Thom, I’m creating a sitemap now. Still getting used to the split-brain world of Openhab2 paperUI and text files for sitemap, items and some rules.
Great finding, does that work on all items, and you don’t need to have a .items file at all? I’m a new user and I’ve just added all my switches through Paper UI and was so frustrated when I read that you need to create an items file manually.
Would be great if one of the developers could confirm the channel -> Item naming.
If you have Simple Mode enabled in PaperUI (Configurations -> Runtime I think) OH automatically creates an Item for each Channel. The name of the Item is the same as the Channel with the “:” replaced with “_”.
If you do not have Simple Mode enabled, you must create all Items yourself. When you do not have Simple Mode enabled, you are able to create Items and link them to Channels in PaperUI. You will see an Items section under Configuration.
If you want to do something more advanced with Items (e.g. have an Item linked to more than one Channel, create Items for 1.x version bindings) you must create the Items in a .items file.