Just more Confused

Following on from my original question.

I have created a munber of things and I can see the values in the Paper UI (in Control -> Other - with some formatting strangeness for the real number values).

Now I’m trying to display values in the BASIC UI, I have looked at the Docs for ‘SiteMaps’ and ‘Items’ but I’m only getting more confused.

So far have failed to display any values at all and cannot seem to find the solution.

I have configured the default sitemap to be home.

My items/default.items looks like:

Number Temperature { mqtt="mqtt:topic:1df42274:Temperature" }
Number Power {mqtt="<[mosquitto:emon/emonpi/power1:state:default]"}

and my sitemap/home.sitemap:

sitemap home label="My home" {
    Frame label="Date" {
        Text item=Date
    }
    Frame label="EmonPi" {
        Text item=Power label="Power [%.1f W]"
        Text item=Temperature label="Temperature [%.1f °C]"
    }
}

in the Basic UI I get

image

The only thing I see in openhab.log is:

Cannot retrieve item ‘Date’ for widget org.eclipse.smarthome.model.sitemap.sitemap.Text

Any idea what I am missing or doing wrong ?

This is old configuration, for MQTT binding version 1
It will not work with MQTT binding version 2, which uses Things and channels.

If you have created your Things in PaperUI … why not create Items in PaperUI?

If only I knew or could fathom out or find the information on how to do so.

Openhab appears to be a very steep learning curve to me or perhaps I’m looking in the wrong place or the answers I need are hard to find (because it seems I keep finding the old ways to do things).

That might be because you are searching this forum only! Speaking about MQTT, before there was a version 2 binding nobody stated that they were talking about the first version. When a version 2 was out, the people talking about that version stated it in the post, however a search for “MQTT” would and does reveal the post about the older version as well. And there are lots of post about that!

Why not look into the (actual) documentation! Scroll to the top of any page in the forum and the line will show links to Documentation and Addons.

About halfway down this -


it describes how to create Items starting from the channel you want to link it to.

I strongly advise NOT to follow the suggestion to use Simple Mode given there - it invariably leads to tears later when your ambitions grow beyond “hello world”.

I’m afraid that is true. Stick with it, it will make sense.

1 Like

I looked at that page probably 3 weeks or more ago and got totally lost - and i seem to be in the same situation now.

I have got as far as adding the Network Device that corresponds to My Phone, at which point I see

But now I have no idea about what to do next

I’m not even sure this is going to help when it comes to my EmonPi device which I’ve manged to get showing in the Paper UI

but not in the Basic UI.

I’m confused too. You started off talking about MQTT and temperature sensing.

But the “My Phone” thing you ae showing now is a network ping device.

What are we trying to achieve here?

IPhone:
You have created a “thing” which represents the IPhone-device in openHAB. Now you need to created an “item” and link it to a channel of the thing. The item can be shown on an UI. By clicking on the empty circle of a channel you can create an item and link it.
In order to show the item on an UI you need to write an .sitemap file and include the above created item. Showing any item of your network thing will work the same way.

I’m more interested in the MQTT stuff relating to the EmonPi.

But all the pages I’ve looked (including the one I followed above) at to try to move forward are about adding different things - I was hoping that was going to progress to something that makes sense when it comes to the EmonPi stuff - but at the moment I have no idea where it is heading.

Aghhh!!! - so we are back to manually editing a sitemap file - which I thought was the wrong way !

If you want to show any of the values of the emonPI on an UI create a sitemap file and include the related item. That is all that is needed to show them.
If you want to do more with those values (like persisting AKA saving values and showing charts of them or reacting automatically on specific values more reading/learning is needed.

It that NOT where I started in this thread ?

Yes. The sitemap describes what “stuff” to display on BasicUI, and how to display it.
The only “stuff” that BasicUI deals in is Items.
sitemaps are really a legacy from openHAB version 1, and editing the file is still done the legacy way for now.

Okay, so you need both a sitemap, and you need Items for it to work with.

Items can be created and linked to Thing channels in the legacy way, from editing files. You need to be precise here, it can be frustrating.
Or
Items can be created by point’n’click in PaperUI

Choose which way you would like to proceed. This is not a forever commitment.

I am not really that bothered about which way to do it (I might ultimatley be interested in both, but at present I really do not know) - the suggestion at the start of the thread was that I should be using the UI.

At present I’m really only trying to get a basic understanding of how to get information presented from the EmonPi device in openHab. (someone I have contact with and is more used to all this IoT stuff suggested I look at openHab as a way of showing stuff from the MQTT output of the EmonPi).

It sort of works as it is in the PaperUI (but still not convinced I have got the hang of the basics here) however the formattiing goes a bit strange when some of the numbers have many decimals places (like the Power Used in my screen shot above) and I might want to do something such that only a few decimal places are shown.

I was kind of hoping that using the Basic UI might achieve something with better formatting than the results I’m seeing so far in the Paper UI.

That is what BasicUI is for, a user facing UI. PaperUI is an admin’s toolbox, no prettiness.

Alright, you’ve already done the hard part with binding, Things, and channels.

Get up the Thing that represents this emonpi,with its channels, on your PaperUI, like you did with the Phone thing…
Click the big blue blob next to the channel you want to create an Item for.
Make your Item, give it a sensible name.
Use that sensible name to refer to it in your sitemap.

I’m stepping in because items for the emonPi should already be created (otherwise PaperUI control wouldn’t show those channes!).
@G0LGS check on PpaerUI under Configuration-Items, they should be listed there!

They are - so I need to fathom out how to get those in a sitemap to show in the Basic UI ?

So I’m back to using my Phone again - as it would appear to be the simplest option (and the example in the Docs uses such a device), but I’m only more confused.

In PaperUI I got to Configration > Things > My Phone why does it appear to always show:

image

Even when WiFi on my Phone is off ?

but under Paper UI -> Control -> Home it correct shows the ‘switch’ as off:

image

and having added to items/default.items:

Switch Presence_MyPhone "My Phone" <network> { channel = "network:device_10_44_100_197:online" }

and to sitemaps/home.sitemap

sitemap home label="My home" {
        Switch item=Presence_MyPhone label='My Phone'
}

Under Basic UI the ‘Switch’ always appears to be ‘off’ (even when the WiFi is on and it appears on in PaperUI).

image

Online for a thing states that the connection from the device to the thing has (once) been made. Nothing more! The phone might be activly in WiFi net or not, the thing repirts online. The state of the .online channel could be on or off, the thing will be online. Confusion, yes.
The switch on BasicUI shows off if your phone is not actively in the WiFi network. Although the phone might be in range, if you are not using it, the phone might go into “deep sleep” (Although the WiFi is switched on) resulting in not being in the network. That way it shows as offline on BasicUI

Tips -

Make that

Switch Presence_MyPhone "My Phone [%s]" <network> { channel = "network:device_10_44_100_197:online" }

at least temporarily, and it will give you a text display of state in your UI.
Useful for distinguishing OFF from NULL (not set)

You don’t need the label= in the sitemap Switch line, if you are happy with the default label you already assigned to the Item.
But you can override that if you wish.