[newbie] strugging to create sitemaps

Hi guys,

Completely new to openHAB (and raspberry too).

Okay so i’ve installed openHABian on a PI3, the “hassle free ISO”. everything’s fine, i’m trying to follow the tutorial and i can’t, for the life of me, have My basicUI up and running, it keeps telling me

It seems like you have not defined any sitemaps yet. To build one, please check the documentation for guidance.

I’m following this guide, except i do not have Zwave device, so i skipped that part.

http://docs.openhab.org/tutorials/beginner/sitemap.html

here’s my .items and .sitemap files

$ more conf/items/default.items

Switch Presence_Phone_Gyz "Gyz's Phone" <network> { channel="network:device:192_168_1_61:online" }

$ more conf/sitemaps/default.sitemap

sitemap default label="This is a title"
{
Switch item=Presence_Phone_Gyz label="Gyz's Phone"
}

Do you see anything wrong here ?

There is no need to redefine the label, if already set through items file.
If changing the label to "Gyz's Phone [%s]" you would see the item’s state as text. As this item (network binding) is read only, I would suggest not to use a Switch but a Text widget, so:

default.items:

Switch Presence_Phone_Gyz "Gyz's Phone [%s]" <network> { channel="network:device:192_168_1_61:online" }

and default.sitemap

sitemap default label="This is a title"
{
    Text item=Presence_Phone_Gyz
}

Please try http://openhabianpi:8080/basicui/app?sitemap=default to open the sitemap. (openhabianpi would be the ip of your pi3)

1 Like

Hi Udo, thanks for the help, unfortunately didn’t solved my issue.

Realised at first i created those file in /conf instead of /home/openhabian/conf. Now i’ve put back everything in place, tried without your changes, not working

then tried your changes, but still not working.

The files belong in /etc/openhab2/

This folder structure is exported via samba as openHAB-conf.

1 Like

You can also look here

@guillaumeb your problem is the location of your configuration. How did you reach the idea that you have to create any kind of conf folder? Please see here: http://docs.openhab.org/installation/linux.html#file-locations

Just as stated by @job the configuration is located under /etc/openhab2/ and you can access this folder via samba under \\openhabianpi\openHAB-share. Be sure to mount that folder as described at http://docs.openhab.org/installation/linux.html#mounting-locally

In general I’d suggest to read through http://docs.openhab.org/installation/openhabian.html and follow the links provided there.

The generator mentioned by @Branden_Smale is a new tool to help create a starting point for your home. However I’d suggest to first understand the fundamentals.

Good luck and feel free to ask further questions after reading through the links above.

Because it is a bit misunderstandable in the tutorial he is using:

Maybe it should be stated somehow this “conf” folder is a logical one, not a physical folder.
The physical location of the logical “conf” folder for openHABian is “/etc/openhab2”.

Ah! Right, this plays right into the hand of https://github.com/openhab/openhab-docs/issues/189 - which I’ve promised to take care of long ago :sweat_smile:

Hi everyone, Thank you for helping

How did you reach the idea that you have to create any kind of conf folder?

That’s what i understood i had to do because of that part of tutorial

But before that, you have to create an items file. Both the items and the sitemap files are edited in your editor of choice. The files’ location is in the “conf” directory of openHAB:

conf/items ← *.items files
conf/sitemaps ← *.sitemap files

After a fresh installation these directories are empty (except for the readme files), so you have to create a file there. We’ll use “default.items” as the items file and “default.sitemap” as the sitemap file in this tutorial.

i understood there had to be a conf folder somewhere, not that “conf/” meant “/etc/openhab2/”

Any how, I’ve moved everything where it belongs ( /etc/openhab2/items and /etc/openhab2/sitemap) and now I do see the default sitemap available in BasicUI.

I don’t get it, in your example, isn’t Presence_Phone_Gyz still a Switch Type ? If i apply your modification (ie insert [%s] in label) the only difference i can see is a ON text next to the slider

This only reflect the state of the slider at the right (if i slide it off and refresh the page, network icon goes red and text changes to OFF) what i’d like is to have this line reflect if my phone is or isn’t connected to network, i tried turning off / on it’s WiFi but changes are not reflected on this line. (i did check when turning on WiFi on my phone that it was given the same IP as before and i waited enough time for openhab to poll phone connection status)

I think this is exactly the problem i was struggeling in the beginning.

The Switch & Group widgets used in the sitemap just have the same name as the Switch & Group items in the *.items file. These are different objects.

The idea, as i understand it, is to use a Text-widget in the UI to display the state of the Switch-item. (Instead of using a Switch-widget to display and allow modification of the Switch-item.)

sitemap default label="This is a title"
{
Text item=Presence_Phone_Gyz label="Gyz presence is [%s]"
}

Your sitemap will be as follows

After the default url pops up add this…

?sitemap=NAME OF YOUR SITEMAP

so end of …app?sitemap=…

Arrgh… sorry, my typo… I’ve corrected my posting, in case of someone finds it later…

Okay, i think i get it a little bit better now, tell me if i got this straight.

so in this case i have a thing called gyz’s phone created from the network binding

That thing has two channel, online and time.

in default.item i declared an item called Presence__Phone__Gyz, of the type Switch, that reflects the state of the channel online, of my thing gyz’s phone

In sitemap, i define how i want my UI to present me this information. I’m only displaying the item Presence__Phone__Gyz and i use for that a type Text, since all I care is knowing if the state is ON or OFF.

is it better to define label in .items or .sitemap ? which one has prevalence ?

So once again if i get it straight, what paperUI does, is let me create things and link item, and when i go to control it automatically create the .item and .sitemap with one frame per things, that display an item for each channel of that thing. is that it ?

Right now, my sitemap for BasicUI is OK (as in it loads and i get to see the item represented as text), but the item state is always OFF, even when my phone is connected to my network

here’s my files

Switch Presence_Phone_Gyz "Gyz's Phone [%s]" <network> { channel="network:device:192_168_1_61:online" }
sitemap default label="Awesome title"
{
  Frame label="Cool Frame"
  {
    Text item=Presence_Phone_Gyz
  }
}

see anything wrong ?

I would always define the label in the item most detailed (including type & location), and override it in a sitemap if neccessary.

For example if you have a functional view of all your temperatures for example, it is neccessary to include the location in the label, but maybe not “temperature”. If you view all sensors/switches of a special location, it is neccessary to include the sensor type (temperature) more than the location.

Better not think of PaperUI day to day UI. It is more of an configuration UI. You only are able to group items by location (defines the tabs on top) , everything else is undefined.

Regarding the presence via network, some devices work for me, some not. My phone does not work, my smarttv works perfectly. Some devices just don’t answer on all requests, maybe the router decouples wlan devices from the lan. Try another device on your lan to check if it is device or connection dependent.

The idea of defining the label in .items file is, you can use items more than once in a sitemap, and you can use items in more sitemaps, so, no need to redefine the label over and over again.

But of course, the label defined in .items is only a “default” label for this item, so you are free to change the label,
e.g. if you have a sitemap which lists all your lights in a subpage, and other subpages for every single room, then you certainly would prefer a label which includes the room’s name for the former and a label without the room’s name for the latter.

In question of false state of an item, please keep in mind that sometimes the UI is not updated properly, so please try to reload the page. If this does not help, take a look at openhab.log, if there are errors and events.log if the item was ever updated.

I second that explanation. The Item label should be unique and meaningful while the Sitemap element label should be specific. Here is an example of how I do assign labels, on the example of one temperature sensor:

  • item label: Living room Heater1 Temperature Probe
  • sitemap label inside the “Left Heater” frame: Temperature
  • sitemap label inside the “Temperatures” frame: Living room (left)

I see, this all make perfect sense,

Thank you for explanation