I changed it to that new style. This is where I am now.
09:39:48.214 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'Switch_C' received command OFF
09:39:48.219 [INFO ] [ome.core.thing.internal.ThingManager] - Not delegating command 'OFF' for item 'Switch_C' to handler for channel 'rfxcom:lighting4:238adf67:17733:command', because handler is not initialized (thing must be in status UNKNOWN, ONLINE or OFFLINE).
09:39:48.221 [INFO ] [ome.core.thing.internal.ThingManager] - Not delegating update 'OFF' for item 'Switch_C' to handler for channel 'rfxcom:lighting4:238adf67:17733:command', because handler is not initialized (thing must be in status UNKNOWN, ONLINE or OFFLINE).
When I press the original remote:
09:40:06.521 [DEBUG] [g.rfxcom.handler.RFXComBridgeHandler] - Message received: Raw data = 09130000044551013970, Packet type = LIGHTING4, Seq number = 0, Sub type = PT2262, Device Id = 17493, Command = ON_1(1), Pulse = 313
09:40:06.522 [WARN ] [mon.registry.AbstractManagedProvider] - Could not update element with key rfxcom:lighting4:238adf67:17493 in ManagedThingProvider, because it does not exists.
Iām not at home now but you can try whether you can see newly added item via the paperUI at the list of things.
Also you can check if errors occur during loading the updated things file, so update things file and in the meanwhile monitor the log for any errors or warnings.
Did you maybe create you two bridges which both connect to the same com-port?
10:53:03.999 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'home.things'
10:53:04.000 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'home.things' is either empty or cannot be parsed correctly!
10:53:04.002 [ERROR] [.core.internal.folder.FolderObserver] - Error handling update of file 'C:\openHAB2\conf\things\home.things': null.
java.lang.NullPointerException
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.getAllThingUIDs(GenericThingProvider.java:929)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.modelChanged(GenericThingProvider.java:884)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:207)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:120)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:272)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.access$1(FolderObserver.java:265)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver$WatchQueueReader.processWatchEvent(FolderObserver.java:146)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.core.service.AbstractWatchQueueReader.run(AbstractWatchQueueReader.java:122)[98:org.eclipse.smarthome.core:0.9.0.b4]
at java.lang.Thread.run(Unknown Source)[:1.8.0_121]
10:53:04.026 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'home.things'
10:53:04.034 [DEBUG] [g.rfxcom.handler.RFXComBridgeHandler] - Handler disposed.
10:53:04.035 [DEBUG] [rnal.connector.RFXComSerialConnector] - Disconnecting
10:53:04.042 [DEBUG] [rnal.connector.RFXComSerialConnector] - Serial port event listener stopped
10:53:04.042 [DEBUG] [rnal.connector.RFXComSerialConnector] - Interrupt serial listener
10:53:04.042 [DEBUG] [rnal.connector.RFXComSerialConnector] - Close serial out stream
10:53:04.043 [DEBUG] [rnal.connector.RFXComSerialConnector] - Close serial in stream
10:53:04.043 [DEBUG] [rnal.connector.RFXComSerialConnector] - Close serial port
10:53:09.035 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occured while calling thing updated at ThingHandler 'org.openhab.binding.rfxcom.handler.RFXComBridgeHandler@be6d06': null
java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(Unknown Source)[:1.8.0_121]
at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:188)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:81)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:65)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.thing.internal.ThingManager.thingUpdated(ThingManager.java:518)[105:org.eclipse.smarthome.core.thing:0.9.0.b4]
at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyTrackers(ThingRegistryImpl.java:227)[105:org.eclipse.smarthome.core.thing:0.9.0.b4]
at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutUpdatedElement(ThingRegistryImpl.java:150)[105:org.eclipse.smarthome.core.thing:0.9.0.b4]
at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutUpdatedElement(ThingRegistryImpl.java:1)[105:org.eclipse.smarthome.core.thing:0.9.0.b4]
at org.eclipse.smarthome.core.common.registry.AbstractRegistry.updated(AbstractRegistry.java:167)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:57)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListenersAboutUpdatedElement(AbstractProvider.java:82)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.access$4(GenericThingProvider.java:1)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$21.accept(GenericThingProvider.java:1044)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$21.accept(GenericThingProvider.java:1)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at java.util.ArrayList.forEach(Unknown Source)[:1.8.0_121]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThingsFromModelForThingHandlerFactory(GenericThingProvider.java:1054)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.access$1(GenericThingProvider.java:1008)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$1$1.accept(GenericThingProvider.java:236)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$1$1.accept(GenericThingProvider.java:1)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at java.util.concurrent.ConcurrentHashMap$KeySetView.forEach(Unknown Source)[:1.8.0_121]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$1.apply(GenericThingProvider.java:239)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$1.apply(GenericThingProvider.java:1)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.config.core.BundleProcessorVetoManager.applyActionFor(BundleProcessorVetoManager.java:121)[94:org.eclipse.smarthome.config.core:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$6.accept(GenericThingProvider.java:320)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$6.accept(GenericThingProvider.java:1)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at java.lang.Iterable.forEach(Unknown Source)[:1.8.0_121]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThingsFromModel(GenericThingProvider.java:323)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.modelChanged(GenericThingProvider.java:870)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:207)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:99)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:272)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.access$1(FolderObserver.java:265)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver$WatchQueueReader.processWatchEvent(FolderObserver.java:146)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.core.service.AbstractWatchQueueReader.run(AbstractWatchQueueReader.java:122)[98:org.eclipse.smarthome.core:0.9.0.b4]
at java.lang.Thread.run(Unknown Source)[:1.8.0_121]
10:53:09.037 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'rfxcom:bridge:238adf67' has been updated.
10:53:09.038 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'rfxcom:lighting4:238adf67:17493' has been updated.
10:53:09.039 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'rfxcom:lighting4:238adf67:17685' has been updated.
10:53:09.040 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'rfxcom:lighting4:238adf67:17733' has been updated.
10:53:09.040 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'rfxcom:lighting4:238adf67:17745' has been updated.
Yes I can see the things as āuninitializedā in Paper UI, and my bridge is āonlineā. I removed the bridge and other items that were added through paper UI before.
First thank you @martinvw for your efforts on this! Good work!
I had some time to test this today. I had the similar problems that @westward had - so I had to add the bridge first manually to Things file and after that I could add bridge also manually from PaperUI, but after that seems to work ok.
Of course I had to discover all Ligthning4 things again, because the device id changes. Everything seems to work ok. I will run this binding on my production openhab also for few days and report if I see issues.
One question about the device id. If I have this in rfxmgr:
I would just use the debug logging for rfxcom or the inbox, you can not easily say it without having the raw message. I think the rfxmgr defines something else as the device-id then the binding does.
I renamed ā238adf67ā in things and items to āusb0ā. I see it changed in Paper UI and there is still only one rfxcom transceiver listed. So that seems to be OK.
Keeps saying āhandler is not initializedā in the logs when I use the switch from the sitemap.
11:41:01.011 [ERROR] [.core.internal.folder.FolderObserver] - Error handling update of file 'C:\openHAB2\conf\things\home.things': null.
java.lang.NullPointerException
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.getAllThingUIDs(GenericThingProvider.java:929)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.modelChanged(GenericThingProvider.java:884)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:207)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:120)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:272)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.access$1(FolderObserver.java:265)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver$WatchQueueReader.processWatchEvent(FolderObserver.java:146)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.core.service.AbstractWatchQueueReader.run(AbstractWatchQueueReader.java:122)[98:org.eclipse.smarthome.core:0.9.0.b4]
at java.lang.Thread.run(Unknown Source)[:1.8.0_121]
11:41:01.020 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'home.things'
11:41:01.028 [DEBUG] [g.rfxcom.handler.RFXComBridgeHandler] - Handler disposed.
11:41:01.029 [DEBUG] [rnal.connector.RFXComSerialConnector] - Disconnecting
11:41:01.029 [DEBUG] [rnal.connector.RFXComSerialConnector] - Serial port event listener stopped
11:41:01.029 [DEBUG] [rnal.connector.RFXComSerialConnector] - Interrupt serial listener
11:41:01.029 [DEBUG] [rnal.connector.RFXComSerialConnector] - Close serial out stream
11:41:01.029 [DEBUG] [rnal.connector.RFXComSerialConnector] - Close serial in stream
11:41:01.030 [DEBUG] [rnal.connector.RFXComSerialConnector] - Close serial port
11:41:06.029 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occured while calling thing updated at ThingHandler 'org.openhab.binding.rfxcom.handler.RFXComBridgeHandler@1bfa484': null
java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(Unknown Source)[:1.8.0_121]
at org.eclipse.smarthome.core.common.SafeMethodCaller.callAsynchronous(SafeMethodCaller.java:188)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:81)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.common.SafeMethodCaller.call(SafeMethodCaller.java:65)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.thing.internal.ThingManager.thingUpdated(ThingManager.java:518)[105:org.eclipse.smarthome.core.thing:0.9.0.b4]
at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyTrackers(ThingRegistryImpl.java:227)[105:org.eclipse.smarthome.core.thing:0.9.0.b4]
at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutUpdatedElement(ThingRegistryImpl.java:150)[105:org.eclipse.smarthome.core.thing:0.9.0.b4]
at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.notifyListenersAboutUpdatedElement(ThingRegistryImpl.java:1)[105:org.eclipse.smarthome.core.thing:0.9.0.b4]
at org.eclipse.smarthome.core.common.registry.AbstractRegistry.updated(AbstractRegistry.java:167)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:57)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.core.common.registry.AbstractProvider.notifyListenersAboutUpdatedElement(AbstractProvider.java:82)[98:org.eclipse.smarthome.core:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.access$4(GenericThingProvider.java:1)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$21.accept(GenericThingProvider.java:1044)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$21.accept(GenericThingProvider.java:1)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at java.util.ArrayList.forEach(Unknown Source)[:1.8.0_121]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThingsFromModelForThingHandlerFactory(GenericThingProvider.java:1054)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.access$1(GenericThingProvider.java:1008)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$1$1.accept(GenericThingProvider.java:236)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$1$1.accept(GenericThingProvider.java:1)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at java.util.concurrent.ConcurrentHashMap$KeySetView.forEach(Unknown Source)[:1.8.0_121]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$1.apply(GenericThingProvider.java:239)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$1.apply(GenericThingProvider.java:1)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.config.core.BundleProcessorVetoManager.applyActionFor(BundleProcessorVetoManager.java:121)[94:org.eclipse.smarthome.config.core:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$6.accept(GenericThingProvider.java:320)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider$6.accept(GenericThingProvider.java:1)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at java.lang.Iterable.forEach(Unknown Source)[:1.8.0_121]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.createThingsFromModel(GenericThingProvider.java:323)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.thing.internal.GenericThingProvider.modelChanged(GenericThingProvider.java:870)[133:org.eclipse.smarthome.model.thing:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.notifyListeners(ModelRepositoryImpl.java:207)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.ModelRepositoryImpl.addOrRefreshModel(ModelRepositoryImpl.java:99)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.checkFile(FolderObserver.java:272)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver.access$1(FolderObserver.java:265)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.model.core.internal.folder.FolderObserver$WatchQueueReader.processWatchEvent(FolderObserver.java:146)[122:org.eclipse.smarthome.model.core:0.9.0.b4]
at org.eclipse.smarthome.core.service.AbstractWatchQueueReader.run(AbstractWatchQueueReader.java:122)[98:org.eclipse.smarthome.core:0.9.0.b4]
at java.lang.Thread.run(Unknown Source)[:1.8.0_121]
11:41:06.032 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'rfxcom:bridge:usb0' has been updated.
11:41:06.033 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'rfxcom:lighting4:usb0:switch_17493' has been updated.
11:41:06.035 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'rfxcom:lighting4:usb0:switch_17685' has been updated.
11:41:06.036 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'rfxcom:lighting4:usb0:switch_17733' has been updated.
11:41:06.037 [INFO ] [smarthome.event.ThingUpdatedEvent ] - Thing 'rfxcom:lighting4:usb0:switch_17745' has been updated.
This seems to work better, no more uninitialized handlers, I however did not mean to make the on/off commands required, so some work is required there. I think the pulse is optional, Iāll put it is a review comment of myself to the PR, Iāll fix it later.
Alright, now we are getting somwhere. Iām planning to switch to Paper UI + sitemap/rules only, but for now Iād like to get it working so we can at least squash the remaining bugs from your changesā¦
You used OFF_0 for onCommand too, I assume this needs to be ON_1 looking at the enum in your code.
I changed my things, the switch is not operating yet, the āhandler uninitializedā messages are gone.
I had some errors until I restarted openhab. Now itās working! Anything else you want me to try/do before I switch over to srict paper ui + sitemaps/rules (without items/things files)?
Maybe you could also define the pulse as expected. Do you have debuging output for on/off switching? Maybe we can tell whatās wrong from that debug information.
@all I have a new version because of some code review comments and I noted that if you changed the configuration ie reversed on/off for example that was overwritten if a new message came in.
I have some of these: Free Shipping! External antenna Wireless PIR Sensor 315MHZ or 433MHz PIR Motion Sensor Detector For gsm pstn Home Security Alarm http://s.aliexpress.com/nAVnqAbm?fromSns=Copy to Clipboard
(from AliExpress Android)
They have the PT2262 chip with jumpers or DIP switches.
Basically all the PT2262 will work. Those are the cheapest.
Donāt use those sensors for detecting permanent presence (for example pointing into your living room) because they will transmit on every detected move and will drain battery fast.
They usually only send ON commands and never OFF. Hence most are only called āalarm sensorā. Leaving the room or closing a door will not be transmitted to openhab. You would have to use the expire binding.
Thanks for the suggestion!
The battery point is interesting - are there any cheap sensors that solve this? Iām unsure whatās best - I assume if not on every move, there needs to be a particular time interval. Ideally a specific datetime - but this is not possible with cheap sensors (or even expensive sensors) anywayā¦