openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.87k stars 3.58k forks source link

Don't manage to have rules working with enOcean #412

Closed jrcourtois closed 8 years ago

jrcourtois commented 8 years ago

I manage to do this in openhab 1, but when I try to do the same (switching lights on when pressing an enocean button), in openHab 2, it just does not work.

When I stop my openhab I got infinite loop of this message, so I don't know if it is linked or not, but does any one already faced this issue ?

2015-10-09 16:42:39 [INFO ] [opencean.core.eep.RockerSwitch:58   ] - Current State: buttonAI=null, buttonAO=Released, buttonBI=null, buttonBO=null
2015-10-09 16:42:39 [INFO ] [org.opencean.core.ESP3Host    :15   ] - Received RadioPacket with value Released
2015-10-09 16:42:39 [DEBUG] [.e.internal.bus.EnoceanBinding:276  ] - Received new value Released for device at EnoceanParameter: {id="00:25:87:86", channel="A", parameter="O"}
2015-10-09 16:42:39 [DEBUG] [b.e.i.profiles.StandardProfile:76   ] - Received new value OFF for items [B2Up (Type=SwitchItem, State=Uninitialized)]
2015-10-09 16:42:39 [ERROR] [org.opencean.core.ESP3Host    :78   ] - Errorjava.lang.NullPointerException: null
    at org.openhab.core.events.EventPublisherDelegate.postUpdate(EventPublisherDelegate.java:77)
    at org.openhab.binding.enocean.internal.profiles.StandardProfile.valueChanged(StandardProfile.java:77)
    at org.openhab.binding.enocean.internal.bus.EnoceanBinding.valueChanged(EnoceanBinding.java:289)
    at org.opencean.core.ParameterChangeNotifier.receivePacket(ParameterChangeNotifier.java:47)
    at org.opencean.core.ESP3Host.notifyReceivers(ESP3Host.java:52)
    at org.opencean.core.ESP3Host.run(ESP3Host.java:73)

my conf.items

Switch B1Down "B1 du bas" (Enocean) {enocean="{id=00:25:87:86, eep=F6:02:01, channel=B, parameter=I}"} 
Switch B1Up "B1 du haut" (Enocean) {enocean="{id=00:25:87:86, eep=F6:02:01, channel=B, parameter=O}"} 
Switch B2Down "B2 du bas" (Enocean) {enocean="{id=00:25:87:86, eep=F6:02:01, channel=A, parameter=I}"}
Switch B2Up "B2 du haut" (Enocean) {enocean="{id=00:25:87:86, eep=F6:02:01, channel=A, parameter=O}"}

my rules the first one works ok

rule "Initialize light states"
    when
        System started
    then
        sendCommand(Switching, ON)
end

rule "Light off"
    when
        Item B1Down changed to OFF
    then
        sendCommand(Switching, OFF)
end
rule "Lights off 2"
    when
        Item B2Up received command
    then
        sendCommand(Switching, OFF)
end
rule "Lights on"
    when
        Item B1Up received update
    then
        sendCommand(Switching, ON)
end
rule "Lights on 2"
    when
        Item B2Down received update
    then
        sendCommand(Switching, ON)
end
kaikreuzer commented 8 years ago

Which version of openHAB 2 are you using? It looks like an old one. Could you try with the current snapshot at https://openhab.ci.cloudbees.com/job/openHAB2/?

jrcourtois commented 8 years ago

That fixes the enocean issue. Thanks

kaikreuzer commented 8 years ago

Cool :-)

sanjaytamakuwala commented 8 years ago

Hi jrcourtois,

I am a New Beginner in OpenHAB and I have created the Enocean.items file for the Enocean Switches and it is getting detected very well but when I am trying to control the Blinds, I am not able to.

FYI... I have used Your Rules file for My project as I do not have any Idea about how to set a Rulel!! I am getting the following Errors while using Your Rule file:

> 2016-08-07 13:38:48.199 [INFO ] [runtime.busevents ] - I_DOWN_CH_B state updated to ON
> 2016-08-07 13:38:48.241 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Lights on 2': The name 'Switching' cannot be resolved to an item or type.
> 2016-08-07 13:38:48.983 [INFO ] [runtime.busevents ] - I_DOWN_CH_B state updated to OFF
> 2016-08-07 13:38:49.041 [ERROR] [o.o.c.s.ScriptExecutionThread ] - Error during the execution of rule 'Lights on 2': The name 'Switching' cannot be resolved to an item or type.

Could You please let me know that How to create a Rules for the Enocean EEP Profiles? Please let me know, in case of any Query! Also please let me know, if there is any Enocean related sample Rules file such that I can Understand the Fundamentals about the Creating a Rule...

Thanks and Awaiting Your Reply.