Displaying door status and mapping

I am trying to update my simple 1.8 system to Openhab2 (2.0.0.b4). It took a while but eventually I have MQTT, GPIO and weather (from html file) working on my Raspberry Pi. However, I can’t get the simple door contact and map function to work, I guess it’s done a different way now?

For example

Contact Contact_FF_Lounge “Door [MAP(en.map):%s]” (FF_Lounge, Doors) {mqtt="[mybroker:home/contact:state:default]"}

works on 1.8 in that an MQTT message OPEN or CLOSED changes the door icon and gets mapped to Open or Closed.

How do I get this simple function to work on Openhab2?

MAP transformation is not installed by default, go to PaperUI -> Extensions -> Transformations and install it.

1 Like

Thank you very much for your prompt response. Yes that works though I have to refresh the page to see the change. I did check the bindings tab to see if there was something to do with maps but missed the transformation tab!

Send MQTT message icon doesn’t change and displays CLOSED. Refresh page in browser, icon changes and correctly displays closed.

Mike

That’s an old issue and maybe still on your system because you are using the beta4 which is by now very old.
Think about upgrading to the latest snapshot

Actually, it may instead be related to this other thread.

Apparently in OH 2 the icon names have to match the transformed state instead of the original state.

Though I’m not positive that is the case here since both “OPEN” and “Open” should map to the same icon file since the icon files need to be all lower case (yet another thread on that one that I can’t find at the moment.

@mikyh, please do upgrade to the snapshot instead of the Beta4. If that doesn’t fix it come back and we will see if it is the issue sited above.

I upgraded my PC version to the latest snapshot a few days ago but couldn’t get it working with my configuration. None of the bindings worked. The log was full of the following error.

2016-11-29 09:59:35.847 [WARN ] [sitemap.internal.SitemapProviderImpl] - Filename home.sitemap does not match the name demo of the sitemap - please fix this as you might see unexpected behavior otherwise.

Until I’m more experienced I’ll stick to the b4 release!

I am running the latest snapshot as of last Friday. I have been transitioning from OH1 to OH2 for the last two weeks (and updating almost every day – except for when the Debian builds were broken). I have never had an old install of OH2.

This is how the current build of OH2 behaves.

Nick Waterton P.Eng.
National Support Leader - Nuclear Medicine, PET and RP
GE Healthcare

M+1 416 859 8545
F +1 905 248 3089
E nick.waterton@med.ge.commailto:nick.waterton@med.ge.com

2300 Meadowvale Boulevard
Mississauga, ON L5N 5P9 Canada

GE imagination at work

That is an easy fix and one you will have to do eventually anyway.

Just change your sitemap at the top from

sitemap demo label="Demo" {

to
sitemap home label=“Demo” {

And that is a warning, not an error. Warnings can usually be safely ignored until you have time to figure out what is going on.

Upon an upgrade you have to reinstall the bindings. This problem is being worked so it won’t be necessary forever but for now what happens is the bindings get removed when you upgrade and require being reinstalled. The easiest way to work around that is to put the bindings you use into services/addons.cfg. Then upon an upgrade all your bindings will automatically be reinstalled.

Given that the problem you are seeing could be caused by either the known bug in B4 or by the behavior I describe above, or by something else I don’t think we will be able to narrow it down and help until you move to the latest snapshot.

1 Like

Now have the snapshot working on a windows PC and can confirm the door icon and mapping occur without having to refresh the browser. Many thanks for everyone’s help.

Mike

Spoke too soon. Everything worked fine until I stopped the service and then several hours later started it. According to the log all the bindings, the basic ui etc automatically uninstalled.

I did take snapshots of the openhab directory whilst I tested each of the bindings I used in my project (ntp, astro, MQTT, weather, map) and trying these did the same thing.

I’m away from home and my Raspberry Pi so am testing it on Windows just for experience, I won’t actually be using it on a windows PC. It is however frustrating and feel I must be doing something wrong.

I’m using a new Windows 10 Pro PC, the snapshot of the 27th Nov and Java 32bit. Procedure:

  1. Unzip snapshot to c:\openhab
  2. Copy my conf folder as working on beta4
  3. Change demo in top line of sitemap to home
  4. Run start.bat
  5. Browse to sitemap home and it displays everying correctly
  6. Add each binding using Paper Ui
  7. Browse to sitemap home and it displays everying correctly and all bindings work
  8. Close cmd window
  9. Run start.bat, all bindings are uninstalled.

I’ve also tried adding the jar’s to the addon folder as well and get similar results.

Mike

OK, it sounds like part or all of the userdata folder is not surviving restarts of OH for some reason.

I’m not sure what to do about that. If you were on a Pi I’d point at a bad SD card. Since you are on Windows ???

I can make your pain a little easier though. If you move the installation of your add-ons to addons.cfg they will automatically be installed on every reboot even if the userdata folder gets wiped out.

See the following for some things you can do:

It will ease your pain, not fix the problem though.

that fix it thanks