I want something simple I guess… I want to switch a light when my sensor detects presence. It worked in OH1, but not in OH2. The system is nikobus and z-wave.
It depends with me… sometimes when i switch one item, another one gets switched, but I’m not sure if this is Nikobus (and flooded bus) related of HabPanel.
In the mean time i found out why my rule was not working…
It had to be Garage_Movement_Switch in stead of Garage_Movement…
rule "Garage Aan"
when
Item Garage_Movement_Switch changed
then
if ((Garage_Movement_Switch.state == ON)) {
sendCommand(light_Garage, ON)
}
end
My item references are correct. The rules worked under 1.8.3.
I now recreated the rules with next-gen rule engine and they are working, but behaving strange from time to time since I do not kno how to apply conncurrency lock in next-gen rules and feedback is still not working when changing an item.
It does an item status update after the config file predefined interval (600s) but not after pressing a physical Nikobus button. This was working under 1.8.3
var java.util.concurrent.locks.ReentrantLock lock = new java.util.concurrent.locks.ReentrantLock()
rule "Link LPgarageStatus to LP_garage"
when
Item LPgarageStatus changed
then
lock.lock()
try {
if(LP_garage.state != LPgarageStatus.state && SystemStarting.state == OFF) {
LP_garage.sendCommand(LPgarageStatus.state.toString())
logDebug("vera", "Vera switch LPgarageStatus has been synced to state " + LPgarageStatus.state.toString() + " with Nikobus switch LP_garage")
}
} finally{
lock.unlock()
}
end
Rule adapted and working in OH2B5
import java.util.concurrent.locks.ReentrantLock
rule “Link LPgarageStatus to LPgarage”
when
Item LPgarageStatus changed
then
var ReentrantLock lock = new ReentrantLock()
lock.lock()
try {
if(LPgarage.state != LPgarageStatus.state && SystemStarting.state == OFF) {
LPgarage.sendCommand(LPgarageStatus.state.toString())
logDebug("vera", "Vera switch LPgarageStatus has been synced to state " + LPgarageStatus.state.toString() + " with Nikobus switch LPgarage")
}
} finally{
lock.unlock()
}
end
I think my issue is solved.
In my items file I had no bindings for all the buttons, therefor button feedback was not recorded.
I defined all buttons in my items file and now feedback is working.
I also noticed that in automation rules switching on a light does behave correctly when giving the ON command through a Nikobus button binding in stead of to the schakelmodule channel.
When giving the ON command to a schakelmodule channel item in a rule, the lights behave strangely (putting on/off different lights), which works correctly when giving the ON command to a Nikobus button item.
I also had probems when directly changing the channel state on the Nikobus modules. Quite often Openhab commands didn’t change the state on the modules and therefore the state in Openhab and the real state didn’t correspond anymore.
Therefore I started using virtual buttons (generieke bedieningspunten) in the Nikobus software. Now an item in my sitemap changes a virtual button and the virtual button changes the real state in the Nikobus module (which also starts the feedback process)
This works very reliable.
‘generieke bedieningspunten’. where can i find these in the nikobus software? and how to model these? i have each button as a separate item.
i also want to use my detector in the hallway as trigger for my hue lightstrips, but i can’t get my head around that how to do this. do i need a rule ?
10 years later i think nikobus wasn’t the solid investment i thought it would be. I’m for sure happy that openhab exists,I looked at domoticz and home automation because of the learning curve of openhab for an ethusiast like me who lacks the ability of programming (I have a basic if… then… ruleand that’s it, when I see your rules ) but nothing more. No bindings however for those. I can only be very grateful for the work of @davy because without that I would probably have spent the last year with RF2IR and iRule solutions in stead of ‘serious’ domotics.
I found it in meanwhile, the virt02/04/64 generics. Now time to find out how it works.
Do you have PC-link and PC-logic?You will need 1 serial port to push the virtual button (in the Nikobus software) and 1 serial port to capture at the same time the address of it (by using Openhab debug) …
@bdv: I am very happy with my Nikobus installation because it is a very stable, reliable and programmable with a screw driver and thus quite a simple system. So no regrets about my investment. However it is only thanks to @davy (much appreciiated!!) that we now can control the system with our smartphones/tablets using Openhab. i do this already for more than 2 years. It’s a pity (and shame) that Niko never offered something to make it smartphone controllable.