I have three segments:
- Segment 5 = Basement. Currently no modules. Only LCN-PKE (PCHK) is located there.
- Segment 6 = First Floor (this is my flat) with 18 modules. One of them sends key to PCHK.
- Segment 7 = Second Floor (another flat) with 18 modules
This is how it looks in LCN-PRO when I program a new key:
I cannot select “—” as segment and module ID 4 as it leads to an error “Invalid target segment”.
I can select segment “3”, “5” or “6” and module ID 4. This was one thing I wondered about when reading the openHAB documentation for the LCN binding.
I added the following line into log4j2.xml:
<Logger level="TRACE" name="org.openhab.binding.lcn"/>
I tried with segment 3, 5 and 6.
Test with segment 3 (all segments)
14:42:58:708 - S006_M022 EG Wohnen GT12 → S000_M004 Send keys: 1 - - - - - - - C=HIT
2021-05-29 14:42:58.847 [INFO ] [openhab.event.ChannelTriggeredEvent ] - lcn:module:0242fb441d47:S006M022:hostcommand#sendKeys triggered C1:HIT
2021-05-29 14:42:59.403 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'hm51-4' failed: An error occurred during the script execution: Cannot assign a value in null context. in hm51
This looks quite promising, doesn’t it? hm51-4 is the rule from my previous post.
Test with segment 5 (with LCN-PKE / PCHK)
15:10:00:721 - S006_M022 EG Wohnen GT12 → S000_M004 Send keys: 1 - - - - - - - C=HIT
2021-05-29 15:09:59.074 [TRACE] [g.lcn.internal.connection.Connection] - Received: '+M004006022.STH080001'
2021-05-29 15:09:59.095 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'hm51-4' failed: An error occurred during the script execution: Cannot assign a value in null context. in hm51
Test with segment 6 (same as module)
No log entry in LCN-PRO so probably not working.
From the LCN-PRO perspective it does not seem to make a difference if I choose segment 3 or 5.
Update: It works now after I adjusted the rule to set the scene. I still don’t know why the event can now be handled by OpenHAB. Pressing the physical button (instead of sending command via LCN-PRO) is crucial like you stated. I tested this, too. Yesterday I updated OpenHABian and rebooted it several times today… maybe that fixed it. Thanks a lot!
rule "Glastaster Wohnzimmer: Hue Lichtszene schalten"
Channel "lcn:module:0242fb441d47:S006M022:hostcommand#sendKeys" triggered "C1:HIT"
Wohnen_Lichtszene.sendCommand("Rm14ZRlOARTix23") // Gedimmt (31 %)