Need some Openhab settings for a magnetic contact

I thought that just the count line was disappearing from your Sitemap, not the whole thing. If you have a completely blank Sitemap like that it means you have an error in your Sitemap syntax and openHAB can’t parse it. Are there any errors in the logs? I highly recommend getting Designer. It will tell you immediately what the error might be.

Once installed there is a small folder icon in the upper left that you click on and browse to the configurations folder for openHAB.

To do what we are doing here. If you are doing MQTT you only need the MQTT addon. The count and fake group stuff uses core openHAB, no extra addons required. And even if that were the case, you you have the items on your sitemap, they just won’t have a value.

Yes, even if the rules are not working correctly and even if the Items are not working, so long as the sitemap is syntactically correct you will see them on the sitemap. The fact that your entire sitemap is blank indicates there is a syntax error on your sitemap.

Everything I do with the other rules has to do with how I process the events in my rules. Those that are members of gAlarmDoors send me an alert if they are opened when no one is home. Those that are members of gReminderDoors send me an alert if the door remains open for more than hour. Etc. But none of these extra groups have anything to do with the Sitemap and if I take them out my example still works.

You really need to get Designer. My best guess is this is a syntax error which Designer will find automatically but which are exceptionally difficult to find manually.

Al right, finally i managed to install OH 1.7.1, dont ask me how, long story. I think i have to make a small list with all useful small Rasberry commands …

When i tested your example i didn’t have anything else in the items, rules or the sitemap but only your example so its “normal” to not have anything else on the web. I told you, if i use this frames example its just simply not appearing on the sitemap.
I used your example in OH designer and you don’t have any error so normally this should work for me if is working for you but no, it’s not working.

  1. New OH 1.7.1 installed on PC and RPI
  2. OH Designer installed
  3. Your latest example even it doesn’t have any error, in my case it doesn’t display the “fake” group ContactsCount
  4. Tests to be continued …

Thanks for reply.

Playing with Openhab Designer I found out that there was an error in the first frame eg you gave me and the error was at the visibility part.

Instead of:
Text item=ContactsCount icon=“contact-open” visibility=[Contacts.state==“OPEN”]
Text item=ContactsCount icon=“contact-open” visibility=[Contacts.state!=“OPEN”]
It should be:
Text item=ContactsCount icon=“contact-closed” visibility=[Contacts==“OPEN”]
Text item=ContactsCount icon=“contact-open” visibility=[Contacts!=“OPEN”]
So the difference is that “.state” should not be there.
Now the line appear on the web and counts the contacts but the icon always stay like a contact-closed no matter if i open or close different contacts or if I go in the frame and go out, the icon is always contact-closed.

Than analizyng your very last eg I saw that the number item (in my case ContactsCount) should be in the visibility instead of the group called Contacts and so I modified it like this:
Text item=ContactsCount icon=“contact-open” visibility=[ContactsCount>0]
And this:
Text item=ContactsCount icon=“contact-closed” visibility=[ContactsCount==0]
And yuuuuuupppppyyyyyyyyy is working like a charm on the phone or on the PC it’s displaying in real time open or close contact!!!
I would like to apply this for the switches too, something like this: turning on a switch from my phone to see in the SwitchesCount frame that 1 switch is on and the icon is switch-on and so on. If no switch is on to see 0 and the icon switch-off but unfortunately I’m facing the same problem meet in the contacts case, following the same principle I modified the ContactsCount rule but I think there may be some errors. Right now its reacting in the same way as the ContactsCount.
Can you please give me a link where I can download the latest OH Designer? Even if I don’t understand any eventually errors I have, at least I can share them with others hoping for any advice.
THANKS again Rich.

All the best!


Remember the states for Switches are ON and OFF as opposed to OPEN and CLOSED. Beyond that it should work exactly the same.

Among other places it is on the Getting Started page.

Hey Rich are you still here? i think you are familiar with this words: cant make it work but really i tried during last days to make something and nothing related to the counting tab for the switches.
I followed the same working example with the contacts like this:


Group Switches // the group with 3 switches
Number  SwitchesCount "Status lumini [%s]" <switch> // a number item for the rule
Switch LEDSwitch01 "Living room [%s]" (Switches) //first switch
Switch LEDSwitch02 "Dormitor 1 [%s]" (Switches) //second switch
Switch LEDSwitch03 "Dormitor 2 [%s]" (Switches) //third switch


rule "Update SwitchesCount"
       Item Switches received update
       val numOn = Switches.members.filter(switch | switch.state == ON).size

The sitemap:

Frame label="Lumini"
Text item=SwitchesCount label="Lumini aprinse [%s]" icon="whites-on" visibility=[SwitchesCount>0]{
Frame {
       Switch item=LEDSwitch01
       Switch item=LEDSwitch02
       Switch item=LEDSwitch03
Text item=SwitchesCount label="Lumini aprinse [%s]" icon="whites-off" visibility=[SwitchesCount=0]{
Frame {
       Switch item=LEDSwitch01
       Switch item=LEDSwitch02
       Switch item=LEDSwitch03

And the result is that the Switchescount tab in my case called “Lumini aprinse” don’t appear on the sitemap. The only thing that can be seen is the frame label called “Lumini” as you can see in the picture below:

If i make the items like this:

Group:Switch:OR(OFF,ON) Switches
Switch LEDSwitch01 "Living room [%s]" (Switches) //first switch
Switch LEDSwitch02 "Dormitor 1 [%s]" (Switches) //second switch
Switch LEDSwitch03 "Dormitor 2 [%s]" (Switches) //third switch

and deletetin the numer item it display the wanted tab like this:

inside the tab:

but it doesn’t count and i know why, its because i deleted the number item Switchescount from above because in that case the tab didn’t appear!
I downloaded the OH Designer 1.7.1 and it doesn’t show any mistake in any of the items, rule or sitemap files.
There is still something i would like to mention here. I think there is something weird happening here because i don’t know how i made the contacts work! i think there is a “must have” the sensors connected and the system ON before you start the Openhab server! I’m almost sure i tried this configuration i have for the contacts before and i couldn’t test it because the system was not started and so how to test it if there are no sensors transmitting data. The system i have now is based on two codes that transmit and listen one each other, the first is kinda gateway loaded in the Rasberry Pi and the second one in the Arduino using these modules called nRF24L01+. The Openhab server refreshes only when receive any info from any of the sensors so every time after a reboot i have to open a contact or to hold the DHT to increase the temp to make them appear in the OH webpage.
So, i’m thinking that maybe because i don’t have any buttons connected that’s why i cant see them in OH.
The bad news is that the sketches i have cant work with buttons on the breadboard, only send commands from OH!

I suspect the problem is that SwitchesCount is not being initialized. When an item is uninitialized it is set to a special Uninitialized state so it is neither >0 nor =0 so both frames remain invisible.

If you do indeed have a problem where your switches are not communicating with openHAB then the rule is never being run and SwitchesCount is never being set to a numerical value.

I don’t know how feasible this is for you but the way I’ve solved this problem where openHAB needs to receive data from a remote sensor before it shows up is to:

  1. Make sure I have persistence set up and use restoreOnStartup. This will make sure that anything that had a value before openHAB closed down gets that value restored, avoiding it remaining in an Uninitialized state. You should be able to this.

  2. Set up a polling mechanism so openHAB can ask the remote sensors to send the current state . I do this by having a MQTT topic that all the sensors subscribe to which openHAB sends a message to when it starts (using a rule triggered on “System started”). When the sensors see a message on this queue they publish their current state to their respective topics. This way if the state changed while openHAB is down I’ll get the current state.

I don’t know how easy this will be for you to implement though with your current Arduino sketches. I have Raspberry Pis driving my sensors right now so two-way communication is a snap. I think the nRFL24L01+ modules can receive as well as transmit so it should be technically feasible, but you will need the code for it.

One thing you can do is have two sitemaps, one for debugging and one for day-to-day use. On the debug one never hide anything and put pretty much all of your items on it so you can see what state everything is in at any given time and you don’t have to worry about something being hidden because of a bad value. Just create a new debug.sitemap file in your sitemaps folder and in your browser use that name in the URL as opposed to what you are currently using or point your phone’s client at the other sitemap. Any item that is in an Uninitialized state will have a value of “–” on the sitemap. That will at least give you access to the switches until you get the states being reported.

This is what i have in the persistence file:

Strategies {
everyDay    : "0 0 0 * * ?"
everyHour   : "0 0 * * * ?"
everyMinute : "0 * * * * ?"
Items {
* : strategy = everyChange, restoreOnStartup
Node01Temperature, Node01Humidity, Node01Light : strategy = everyMinute

but this is related only to the charts i have (my case).
Do i need to add here all items and to set the restoreONStartup strategy?

Could you please share the rule you are using (if you think it works for me) on “System Started”? if not, don’t know what …

About the sitemap, i’m afraid i didn’t understand. You say i need to make another file called sitemap1 for example and to copy everything inside on it and than to start it on one of my devices to see what? How could i see the counting switches in this map? sorry to say this but i don’t get it!

Where you from? Germany? have a good night than :slight_smile:

You have it already configured to restoreOnStartup. The line that starts with "* : strategy " basically says for all your items save every change and restore the state on startup. Then the next line adds an additional strategy of everyMinute for the Node01 items you list.

I can share it but in openHAB it is pretty simple. The real work takes place on the sensors themselves where they read the topic and publish their current state. This really isn’t an openHAB thing. All the rule does is post “update” to an MQTT topic.

rule "Get update at startup"
    System started

A sitemap is basically one view of your home automation system. You can have multiple views. Each view is defined by its own sitemap file. So my suggestion is create a separate debug.sitemap file that is ugly and does not include fancy stuff like the visibility flag or color changes or lots of Frames but does include just about every single Item you have defined. You use this sitemap as you are building your system and debugging your system to see what everything is set to at any given time. You use the other sitemap as your main interface when you use your home automation.

For example, if you had this debug sitemap you could quickly look at the SwitchesCount item and see it is set to “–” which means it is undefined. And because you are not using visibility or anything else fancy everything will show up no matter what its state it, even if it is uninitialized. That would immediately tell you why nothing is showing up on your other sitemap. It is just an idea and may not make sense for you to do it this way.

I personally treat my main sitemap as a debug sitemap and activate all my home automation based on events rather than needing a user interface. The only things that I routinely need to use a user interface for is to override the lights (e.g. it is cloudy but the weather forecast says its sunny so I want to turn on the lights) and trigger the garage door openers.

I actually live in the US, up in the mountains of Colorado. It won’t be night for some hours yet. :slight_smile:

Alright, thanks I’ll try to apply this to my project to see what’s happening than but was hoping if I have this switch items defined in OH together with the rule and the sitemap with frames, at least the counter should work so when I turn one of the lights ON from OH to see in the SwitchesCount that 1 light is ON and so on… But it doesn’t!

Your name sounds like a German name or near and about the hour I think you will go to sleep in maybe 5 hours? Here is 2:33 in the morning :slight_smile:
Colorado sounds like a very nice place to live :wink:

It actually is working, as far as I can tell, but until one of your switches gets turned on the rule that sets SwitchesCount never gets triggered and thus SwitchesCount remains uninitialized. And as long as SwitchesCount remains uninitialized it won’t show up on your sitemap.

My name is actually Slovenian. My dad’s side of the family immigrated to the US in the late 19th century. And having moved to Colorado from Texas a year ago I can say it is a wonderful place to live in comparison.

Hi Rch,

Still got not solution for the switch counter and i think i really need to have the Arduino and Raspberry sketches modified to give the users the possibility to switch the relay state from On to OFF using a button installed on the breadboard and so i asked some other guys from a Romanian forum to help me with that because this guy here doesn’t really want to help. I don’t know if they will help but its worth trying :smile: so i’ll leave it for the moment.
In the mean time i would like to ask you to come back to the FrontDoor switch item because (this one with the key eg) at this moment i found a way to make it work combing different eg from here (those once you gave me) but it doesn’t work as it should be working.
I have this sitemap:

Switch item=FrontDoorProxy mappings=[ON="UNLOCK"] visibility=[FrontDoor=="OFF"]
//Switch item=FrontDoorProxy mappings=[OFF="LOCKED"] visibility=[FrontDoor!="ON"]

I made the second sentence as a comment because i used to see two buttons on the web which is not normal.
This items:

Switch FrontDoor "Yala Usa Acces" <key> { mqtt=">[mymosquitto:home/bedroom/light:command:ON:1],>[mymosquitto:home/bedroom/light:command:OFF:0]"}
Switch FrontDoorProxy "Yala Usa Acces" <key> { mqtt=">[mymosquitto:home/bedroom/light:command:ON:1],>[mymosquitto:home/bedroom/light:command:OFF:0]"}

And this rule:

rule "Update FrontDoorProxy"
    Item FrontDoor changed
    if(FrontDoor.state == ON) {
        createTimer(now.plusSeconds(5), [| FrontDoorProxy.sendCommand(ON)])
    } else {

Just to be mentioned, this config above work pretty well but it doesn’t work as it should be working this means it doesnt change the text or the color of the FrontDoor button.

Now i was thinking to this solution:
The door strike i have right now is a fail secure one and has memory so this means whenever the strike receive command open (from a button) it will keep the door unlocked until the door is physically open and closed again. Than the strike will be locked again.
So I was thinking to use the Front door contact item:

Contact	Node01Door	"Usa Acces [%s]"	<frontdoor>	(All, Contacts, TempHum)		{ mqtt="<[mymosquitto:home/bedroom/door:state:MAP(]" }

and to make a solution like this: The button normal state should be in BLUE color and to have a label LOCKED or UNLOCK (it doesn’t really matter). When the button is pressed, it should open the door strike, change the OH button state to RED color and the label UNLOCKED until the magnetic contact will be open and closed, so the door button should stay RED and UNLOCKED until the contact item will be closed again and only after the magnetic contact will be closed.
A a review:

  • The magnetic contact will be installed on the door and has an item on the OH called Node01Door
  • The door strike is fail secure and has memory and stays open until you open and close again the door
  • The OH button should change color from blue to red whenever the button is pressed
  • The OH button should change the label form LOCKED to UNLOCKED and stays like that until the magnetic contact installed on the door will receive the next closed state.

Thank you in advance for your patience.

PS: I tried already different combination as i said above but as usually something is not working …

I’m sorry he isn’t willing to help but I have to agree with his statement:

You’ve asked for my help on every step and for minor things - I’m afraid you may not be ready to take on a project of this size or type. There are online tutorials and books that can help you become more familiar with programming in general and C++ in specific. It’s usually best to build a foundation of the basics before you take on more advanced projects.

I’ve said some of the same things.

Is there a reason both the FrontDoor and FrontDoorProxy are both listening to an MQTT topic, the same MQTT topic, and a topic for your home/bedroom/light?

Typically a proxy doesn’t have anything between the “{ }” and it sends/receives command through the rules.

The purpose of a proxy is to provide a layer of separation from the “real” item because that item doesn’t provide some capability (e.g. never gets set to OFF), gets lots and lots of events most of which can be ignored (e.g. motion sensor), or has an odd way to communicate that you can’t or don’t want to do through Items bindings.

Here FrontDoor and FrontDoorProxy are the same thing.

From looking at your rule, I wonder if what you are trying to do is receive the state through Front_Door and send a command through Front_Door_Proxy, which would be correct. However, Front_Door is configured to send messages, not receive. See the MQTT Binding docs, pay attention to “direction.”

As I’ve said in numerous places, I personally don’t really use the sitemap that much and you are trying to do some really advanced things with the sitemap, things which I haven’t done and don’t have time right now to go experiment with to figure out. Unfortunately, I also think you are focusing on the sitemap right now when your Items are clearly not working as you need them to.

You need to first make sure your items are working as they should (watch the logs and make sure things change state as they should when events occur). Then make sure your rules are working (logInfo helps here). Finally, start working on the sitemap to make everything appear as you want. Start by just putting your items on the sitemap in a simple manner. Don’t try to get fancy until you know everything else is working.

For example, in the above there is no difference between Front_Door and Front_Door_Proxy so that should be a clue something is not right. Secondly, since Front_Door is configured to only send messages it never gets set to anything so your rule never fires. Nothing on your sitemap will work until this other stuff works.

I don’t want to add fuel to the fire, I am new to OpenHAB (coming from Ninjablocks) and as much as I like the UI (which a lot of people complain about?) I think a good HA system has to work without any UI/Sitemap: I like my lights to switch on because it’s dark, there’s someone in the room, something happened… not because I had to pull my phone out, had to give it my fingerprint, had to search for that app, had to search for that item…

This is exactly my philosophy as well. An HA system should just work or it isn’t very automated. :slight_smile: I do use the sitemap for debug though. It can be convenient to are the state of everything and have manual switches to kick things off when building and debugging.

@federic0 You’re perfectly right! Sometimes things should react depending on different things like is dark turn the outside lights on but in order to do that you don’t really need OH! You can do it by programming some micro controllers like an Arduino and he will be doing all the job for you.
However, sometimes it’s becoming annoying to have a system that reacts every time it feels so like you are living your home for a week and you don’t want to turn on all the outside lights but only a few of them and so you have to have the possibility to switch them manually either from the wall buttons or the OH interface.
@rlkoshak I see you’ve read my topic on that forum. You should know than that site is for beginners and contains tutorials step by step on how to do different things. I followed it since I bought my Raspberry and with this site help I was able to fire it up.
This is out of topic here but since the site he posted is exactly for the beginners and where he explain very well how to I believe it is normal to receive questions like mine about different things. If he could make those eg for a single switch (on my suggestion) this means he can do it for two and so I would be able to develop it without any help further but he doesn’t want to do it as he did it for the sensors. Because I had more that one single sensor eg I develop it and now I have more that ten sensors reporting different things.
When you make a site like this guy have you have to expect the this kind of questions on the forum and you have to be a pro active one because this is why you have this site! To help this kind of people.
If you remember on the beginning of this long conversation I was asking for help here for OH settings for a few contacts and this was because at that moment I was following a different solution from MySensors. Moving on the geeks site I had to change every thing and I did it because I found a lot more that I needed in my “advanced” project.
I don’t want to make from this a day job or something, I just want to understand HOW TO to install see different things in function using OH.
As I said previously, I appreciate all the detailed and quick answers you gave on this topic, they helped me a lot and probably without your help I would not be able to have what I have right now!
No more for the questions :frowning:

Let me try to explain why I and the other forums are becoming frustrated and less willing to help.

There is an old saying in English that goes:

Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime.

Forums like this are here to help users “learn to fish.” But over and over again you have demonstrated that you have no interest in learning to fish, you want us to just give you the fish.

You will be able to find people to bend over backwards to help you if you show a willingness to figure this out on your own. We will help solve problems and give you examples forever (giving fish) so long as you show that you are trying to pick up the basics and learning how these things actually work (learning to fish). You have failed to do that though and that is where our frustration comes from. If you never learn to fish we are stuck feeding you our fish forever.

I don’t want to belittle the effort you have put in nor what you have managed to achieve. But by this point you should be able to do all of the things I outlined in this post. Had you built up these skills you would be able to at least figure out what is wrong with your switches right now, if not how to fix them on your own. But you don’t want to learn these basic skills. You just want it to work. To quote you from that other forum:

It will take me moths to figure out. More over I would like to add a few buttons on the breadboard to control this two LEDs that are controlled through Openhab and this will take maybe years to make it work without your help.

You are right, it might take months or years to figure it out. But here’s the thing. All of the rest of us spent the months and years learning the basics so we can figure out how to make this stuff work. Why do you feel you don’t need to do the same? DIY electronics and home automation is hard and it requires a whole lot of skills (programming, soldering, Arduino development, systems administration, network configuration, etc). This means studying from books, taking classes, going through tutorials to build basic and often useless things (e.g. making a light blink on an Arduino board), etc. And each and every person on this forum except you has spent the time or is currently spending the time to learn all of these skills. But you just want to cobble together a bunch of examples you find like lego blocks and have us figure out why it doesn’t work because figuring it out on your own will take too long.

Actually you do. I can’t easily, for example, have my lights turn on during the day only when the weather says it is cloudy and it is daytime and only when someone is detected home. This is the power of openHAB and this requires no user interface. But, should I want to override that behavior I need only have a sitemap with one simple switch per light. Similarly I have simple buttons to trigger the garage doors. That is my entire sitemap. Everything else (e.g. setting the thermostat, detecting when someone is home, sending alerts when doors are open and closed when it is night or noone is home, sending alerts when certain doors have been left open for over an hour, etc) all happen automatically in the background and I don’t have them on the sitemap except when I’m debugging.

Agreed. But because needing to manually override the automation is a relatively rare occurrence I (and probably @federic0 as well) spend little time making a dynamic sitemap with color changing buttons and changing icons and charts and such. I primarily use my sitemap for debugging my system so the fewer fancy tricks I employ the better. Most of the fancy stuff I’ve done in the past (e.g. my weather setup) was mainly created so I could learn more about how openHAB works. I don’t use them now.

I am very familiar with the site. It is indeed for beginners. However, before posting to that site’s forum I believe they expect that you have gone through all of the tutorials on the site. Did you actually follow that site’s tutorials? Because a lot of the things you asked about in that thread are clearly explained in the tutorials. They also expect you to have some basic foundational knowledge, in that site’s case, some basic C/C++ programming skills. You don’t go to a beginner’s calculus site without knowing arithmetic.

If you search their forum and this forum you will find that your questions are not typical. Most of the questions are short, very specific to one particular problem (e.g. how do I set a timer, why isn’t this binding working, etc), are specific to openHAB and demonstrate that the asker has spent time trying to understand and solve the problem themselves. When someone provides an answer that is basically “go read this site, or look at this tool” the asker then goes and actually looks at those sites, reads and understands them, and if they still have problems they come back with even more specific questions and things they have tried. Your questions basically are “I want it to do X. I downloaded a bunch of random stuff from the internet. It isn’t working. Show me how to fix it. I don’t understand how it works and I don’t want to try because it will take too long for me to figure it out myself.”

These sites can also expect the users of the site to use the information actually already posted to the site (e.g. the actual tutorials, the wiki, etc) to help solve and answer questions in addition to asking basic questions on the forum. Your questions on that site indicate you either did not do all the tutorials or did not understand them. Had you done so, a lot of the questions you ask you could and should have figured out yourself. Like HAFG said on that site:

Asking other people to spend their own free time on your project should be a rare occasion, and only when you’ve tried everything else already.

Part of “everything else” is actually learning how all of the technologies you are using work and that may sometimes mean stepping back and getting something simpler and more basic working first. For example, if you had to could you code an Arduino to flash an LED from scratch? Maybe you should learn how to do that first before adding a button to your boards wired to relays and sensors. Maybe create a learning system and follow the tutorials on that home automation website. Maybe download the demo configs for openHAB and make sure you understand how everything in it works.

I don’t want to make this my day job either. But I actually spent the time to build a body of knowledge about openHAB and how openHAB (and the other technologies I’m using) works and how to make it do what I want it to do. I spent months experimenting and building gradually more and more complex home automation capabilities before I was able to contribute to these forums and even now I learn something new almost every day. You have expressed no willingness to do the same that everyone else has done. You want us to do it for you. And not only do you want us to do it for you, you have chosen a very complex Arduino based system of custom sensors and actuators rather than starting with something simple and building up to something more complex.

If you don’t want to learn how this stuff works then I suggest you go buy a commercial solution or pay someone to build the system for you. I’ve seen at least two cases on these forums where people have paid someone else to help code and configure openHAB for them. I think you are reaching the limit of how many “I don’t understand any of this, fix it for me” type questions that the people of these forums are willing to answer.

By this point you should have built an understanding of how some of this stuff works and more importantly how to figure out why something isn’t working on your own. But you don’t and have no interest in spending the time to learn that.

I’ve spent probably 20 hours on this one thread, 20 hours that I could have spent helping 30 other people on this forum or spent working on my own system. And I would be willing to spend another 20 hours if I thought that you were spending the effort so that you wouldn’t need to rely on others to figure out your system for you. But I see no end. You are not willing to start with the basics to learn the systems. This is unsustainable.

It is now time for you to step back and start with the basic tutorials and build up your basic knowledge of Arduino, coding, and openHAB. You have reached the end of what you can do without that base knowledge. And my time will be better spent helping others “learn to fish” rather than continuing to “give you a fish.”

In the future, if you have a specific openHAB question I suggest posting a new topic. When you do make sure to include as much detail as possible and make sure to demonstrate that you have a basic understanding of how things work.


Alright, I see that this conversation becomes too personal and helpless.
There are a lot of people who are college graduates in this field and still face problems in programming different programs so I could stay learning “how to fish” until there will be no fish to fish and I would just learn how to hold the pole, that’s it! In other words, even I tried, it’s like impossible for me to go further without someone explanations about how and what, but I’m sure you know better than me after the time you spent learning.
I would like to thank you for these 20 hours spent to help me instead of helping the others…
Probably if I will not find a solution in the near future, becoming more and more frustrated, I’ll search for someone who can sell me some examples based on this solution I currently have or similar if for those who can help is too difficult to do it. All I wanted to do was to have some more relays and some buttons integrated in the project and some “fancy” OH configurations. I didn’t ask no one to build a plain for me, just to give me some examples.
All the best!


I’m trying to have these rule worked but I have that message

rule “Update time sensors”
Item Interrupteurs received update
Thread::sleep(250) // give persistence time to populate lastUpdate
val mostRecent = Interrupteurs?.members.sortBy[lastUpdate].last as SwitchItem
logInfo(“Activite”, "Most recent is " +

I used persistence db4.o


2015-10-27 21:49:00.552 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule ‘Update time sensors’
java.lang.NullPointerException: null
at org.eclipse.xtext.xbase.lib.ListExtensions$ ~[na:na]
at java.util.TimSort.countRunAndMakeAscending( ~[na:1.8.0]
at java.util.TimSort.sort( ~[na:1.8.0]
at java.util.Arrays.sort( ~[na:1.8.0]
at java.util.Collections.sort( ~[na:1.8.0]
at org.eclipse.xtext.xbase.lib.ListExtensions.sortInplaceBy( ~[na:na]
at org.eclipse.xtext.xbase.lib.IterableExtensions.sortBy( ~[na:na]
at sun.reflect.GeneratedMethodAccessor175.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke( ~[na:1.8.0]
at java.lang.reflect.Method.invoke( ~[na:1.8.0]
at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation( ~[na:na]

Wonderful post and your are right. Hopefully a few other candidates are reading this too … :rage:

I hope I didn’t offend someone in this forum.
I’m new into openhab, and i’m also “french” and maybe my english isn’t good enough to explain clearly my problem. I always add good support from you experts and hope to continue so.
I posted my need of help becauseI saw in this thread and I would like to use your explanations for the rules that search for the lastupdate and have the item identified.

So, if I made a mistake, I’m sorry and please correct me for the next time.