Bticino N4640B (IR sensor). Integration in openhab

Hi Ivan (@zar1978)
your last formatted log does not show any message related to the IR sensor with WHERE=312, so is useless.
The only strange things I also noticed in your .items configuration you have:

Switch sensore_IR_INGRESSO "Living Room IR sensor" <motion> { channel="openwebnet:bus_dry_contact_ir:7f095c6d:sensor" }

while the correct format should include the device where, like this:

Switch sensore_IR_INGRESSO "Living Room IR sensor" <motion> { channel="openwebnet:bus_dry_contact_ir:7f095c6d:312:sensor" }

note I added 312: before sensor.
Also you have to make sure the right Bridge ID is specified, it looks strange that for switch & rollershutter items you have 89f9d7f7 and then for the IR sensor you have 7f095c6d: this does not look correct at all.

So in the end to create items manually i suggest you go first to your PaperUI > Config > Things then click on your IR thing you should have added/configured by PaperUI and you will see info like this:


you can click on the COPY icon to get the correct definition of the channel you then copy this to your channel= in your item definition.

Bye
Massimo

Hi Massimo, Thanks for the reply. I tried to make the suggested changes without getting results. I also tried to delete the item and create it from the PaperUI. This is the result:

I add that ITEM must add it manually and that the address of the BRIDGE ID is inserted automatically and does not correspond with the BRIDGE ID entered for the remaining automation

Maybe something is broken/ wrong in you configuration, you said you have touched the JSONDb and that is a very delicate steps that can destroy the configuration(not a good suggestion at all).

I suggest you start from zero: remove all thing and items (both added from text files, manually and with auto discovery)
Then add the gateway manully, then add the Contact IR sensor by discovery.
If ithe IR sensor does not get discovered something is already wrong.
But you can try to add it manually but You have to select form the menu the bridge you just created.
Bye
M

I tried to reinstall everything from scratch in another folder.
I followed the guide

README

step by step. I manually added the gateway and then I started the discovery. The search finds me all the automatisms except the N4640B .

I try to add the manually Dry Contact/IR Sensor. This is the log:

2019-01-29 13:07:33.146 [DEBUG] [org.openwebnet.bus.MyHomeConnection ] - MON SENDING    ======>>>>>> *#*1##
2019-01-29 13:08:58.701 [DEBUG] [et.internal.OpenWebNetHandlerFactory] - ==OWN:HandlerFactory== createHandler()
2019-01-29 13:08:58.706 [DEBUG] [et.internal.OpenWebNetHandlerFactory] - ==OWN:HandlerFactory== creating NEW SCENARIO Handler
2019-01-29 13:08:58.706 [DEBUG] [et.handler.OpenWebNetScenarioHandler] - ==OWN:ScenarioHandler== constructor
2019-01-29 13:08:58.707 [DEBUG] [ebnet.handler.OpenWebNetThingHandler] - ==OWN:ThingHandler== initialize() thing=openwebnet:bus_dry_contact_ir:750892d8
2019-01-29 13:08:58.708 [INFO ] [bnet.handler.OpenWebNetBridgeHandler] - ==OWN:BridgeHandler== registered device ownId=25.312, thing=openwebnet:bus_dry_contact_ir:750892d8
2019-01-29 13:08:58.709 [DEBUG] [ebnet.handler.OpenWebNetThingHandler] - ==OWN:ThingHandler== associated thing to bridge with ownId=25.312
2019-01-29 13:08:58.710 [DEBUG] [et.handler.OpenWebNetScenarioHandler] - ==OWN:ScenarioHandler== initialize() thing=openwebnet:bus_dry_contact_ir:750892d8
2019-01-29 13:08:58.711 [DEBUG] [ebnet.handler.OpenWebNetThingHandler] - ==OWN:ThingHandler== handleCommand() (command=REFRESH - channel=openwebnet:bus_dry_contact_ir:750892d8:sensor)
2019-01-29 13:08:58.712 [DEBUG] [ebnet.handler.OpenWebNetThingHandler] - ==OWN:ThingHandler== Refreshing channel openwebnet:bus_dry_contact_ir:750892d8:sensor
2019-01-29 13:08:58.712 [DEBUG] [et.handler.OpenWebNetScenarioHandler] - ==OWN:ScenarioHandler== requestChannelState() thingUID=openwebnet:bus_dry_contact_ir:750892d8 channel=sensor
2019-01-29 13:08:58.712 [INFO ] [g.openwebnet.bus.MyHomeJavaConnector] - COM SENDING   ============>>>>>>>>>>>> *#25*312##
2019-01-29 13:08:58.714 [DEBUG] [g.openwebnet.bus.MyHomeSocketFactory] - ##gw-openwebnet-socket## CANNOT read from socket: read returned -1
2019-01-29 13:08:58.715 [DEBUG] [g.openwebnet.bus.MyHomeJavaConnector] - ##gw-openwebnet-connector## read returned -1
2019-01-29 13:08:58.715 [DEBUG] [g.openwebnet.bus.MyHomeJavaConnector] - ##gw-openwebnet-connector## let's try with a NEW SESSION...
2019-01-29 13:08:58.716 [INFO ] [g.openwebnet.bus.MyHomeSocketFactory] - ##gw-openwebnet-socket## Trying openCommandSession() socket....  (192.168.1.35:20000)
2019-01-29 13:08:58.725 [DEBUG] [org.openwebnet.bus.MyHomeConnection ] - ##gw-openwebnet-conn## ... starting HANDSHAKE ... 
2019-01-29 13:08:58.734 [DEBUG] [org.openwebnet.bus.MyHomeConnection ] - COM RECEIVED   <<<<<<====== *#*1##
2019-01-29 13:08:58.735 [DEBUG] [org.openwebnet.bus.MyHomeConnection ] - COM SENDING    ======>>>>>> *99*0##
2019-01-29 13:08:58.741 [DEBUG] [org.openwebnet.bus.MyHomeConnection ] - COM RECEIVED   <<<<<<====== *#160790776##
2019-01-29 13:08:58.741 [DEBUG] [org.openwebnet.bus.MyHomeConnection ] - COM SENDING    ======>>>>>> *#1165230079##
2019-01-29 13:08:58.747 [DEBUG] [org.openwebnet.bus.MyHomeConnection ] - COM RECEIVED   <<<<<<====== *#*1##
2019-01-29 13:08:58.747 [INFO ] [g.openwebnet.bus.MyHomeSocketFactory] - ##gw-openwebnet-socket## ... CONNECTED command session 192.168.1.35:20000
2019-01-29 13:08:58.747 [INFO ] [g.openwebnet.bus.MyHomeJavaConnector] - COM SENDING   ============>>>>>>>>>>>> *#25*312##
2019-01-29 13:09:00.767 [INFO ] [g.openwebnet.bus.MyHomeSocketFactory] - COM RECEIVED  <<<<<<<<<<<<============ *#*0##
2019-01-29 13:09:03.146 [DEBUG] [org.openwebnet.bus.MyHomeConnection ] - ##gw-openwebnet-conn## sending MON keepalive ACK
2019-01-29 13:09:03.147 [DEBUG] [org.openwebnet.bus.MyHomeConnection ] - MON SENDING    ======>>>>>> *#*1##
2019-01-29 13:09:06.069 [INFO ] [ebnet.handler.OpenWebNetThingHandler] - ==OWN:ThingHandler== Thing state request timer expired, still unknown. Setting thing=openwebnet:bus_dry_contact_ir:750892d8 to OFFLINE
2019-01-29 13:09:06.071 [DEBUG] [ebnet.handler.OpenWebNetThingHandler] - ==OWN:ThingHandler== Thing OFFLINE
2019-01-29 13:09:27.347 [DEBUG] [g.openwebnet.bus.MyHomeJavaConnector] - ##gw-openwebnet-connector## readMonitoring() SocketTimeoutException: Read timed out
2019-01-29 13:09:27.348 [DEBUG] [org.openwebnet.OpenGatewayBus$a     ] - ##gw-openwebnet-BusReceiveThread## SocketTimeoutException on readMonitoring: Read timed out
2019-01-29 13:09:27.348 [DEBUG] [org.openwebnet.OpenGatewayBus$a     ] - ##gw-openwebnet-BusReceiveThread## ^^^ sending CMD message to see if gw is still reachable...
2019-01-29 13:09:27.348 [INFO ] [g.openwebnet.bus.MyHomeJavaConnector] - COM SENDING   ============>>>>>>>>>>>> *#13**15##
2019-01-29 13:09:27.507 [INFO ] [g.openwebnet.bus.MyHomeSocketFactory] - COM RECEIVED  <<<<<<<<<<<<============ *#13**15*200##
2019-01-29 13:09:27.634 [INFO ] [g.openwebnet.bus.MyHomeSocketFactory] - COM RECEIVED  <<<<<<<<<<<<============ *#*1##
2019-01-29 13:09:27.935 [DEBUG] [org.openwebnet.OpenGatewayBus$a     ] - ##gw-openwebnet-BUSReceiveThread## ^^^ ... CMD was answered, gw is still reachable!

Caution. The images refer to the last attempt to manually add the device, while the LOG on the first attempt

I believe the N4640B sensor is not designed to function as a presence sensor, but only to work with the burglar alarm system.

For this reason I can not configure it with Openhab.
Thank you all for the support

Ivan last test you can do is to use the official opwenwenet client from BTicino (search other threads in this forum for info and dowload link) , connect to your gateway, activate event mode on the client and then pass in front of your sensor and see if any event message is sent on the bus when you pass in front of it.

If no message in sent , then no, you cannot integrate this device with OH and the OpenWebNet Binding.

Bye
Massi