LCN send key to HA

hi,
how can i receive key from LCN? What is my trigger?
Thanks

What LCN events are available to listen to in Developer Tools / Events?

i can see no LCN events

Quote from “LCN - Home Assistant

Alternatively, an LCN-PKE coupler can be used which offers two PCHK licenses. With this setup sending and receiving commands to and from LCN modules is possible.

but how

You need to send the hit command to the LCN-PKE/VISU in LCN-PRO as send key (old command).
Then in HA you define an automation with a the lcn device → receive send keys → key (the key you
send in LCN-PRO like a2) and the action hit. Then define the action in HA for it.

sorry, but I didn’t understand it.
I have a LCN-PKE but my Keys from a TU4H I couldn’t implement in HA

Hello,
i have a question regarding sendkey. Was able to configure and use in until i changed my PK module to a new LCN-VISU module.
Since changing the module i´m not able to use sendkey in homeassistant (in the meantime i also updated HA a few times).
maybe someone has an idea what i´m missing:

connected lcn-pck monitor to lcn-visu and check events:
if i press the configured button i receive the event:

20:18:50:667 - M070 EG Wohnzi. Tür Süd → M004 Sende Tasten: 1 - - - - - - - A=kurz

have configured an automation in HA:

eventtype:
lcn.send_keys:
segment_id: 0
module_id: 70
key: A1
action: HIT

config in automation.yaml:
- id: '1674148847373'
  alias: TV-EIN
  description: ''
  trigger:
  - platform: event
    event_type: lcn.send_keys
    event_data:
      segment_id: 0
      module_id: 70
      key: A1
      action: HIT
  condition: []
  action:
  - type: toggle
    device_id: 70f4547398bcd61016baf8497c0ab08d
    entity_id: switch.eg_shelly_whz_channel_2
    domain: switch
  mode: single

but since changing the module this automation does not work.

many thanks
Chris

Hi @tango38317,

as far as I can see your event_type and event_data should be:

trigger:
- platform: event
  event_type: lcn_send_keys   # note the underscore instead of the dot
  event_data:
    segment_id: 0
    module_id: 70
    key: a1       # has to be lowercase
    action: hit   # has to be lowercase

To be honest, I don’t know if the case sensitivity has changed during the last versions. :man_shrugging:

Andre

Hi @alengwenus,

i have reconfigured it back to

platform: event
event_type: lcn_send_keys
event_data:
  segment_id: 0
  module_id: 70
  key: a1
  action: hit

but its not working. is there a way to enable logging to check what is comming in to HA?

initial i have had it correctly configured, changed it to upper case and maybe i also changed event type. but it seems, its not working since changing from PK to VISU - but not sure, my pk module was not working last few month, and this days i ordered the VISU and replaced PK module.

output again from monitor.
S000_M070 to M004 Send keys: 1 - - - - - - - A=HIT
and VISU Module ID is 4 (default).
many thanks
Chris

Hi @tango38317,
for logging you can add the following lines to the configuration.yaml:

logger:
  default: info
  logs:
    homeassistant.components.lcn: debug
    pypck: debug

Also please refer to the logger documentation how to view the logs: Logger - Home Assistant
Now you should see all PCK commands which are received/sent by the VISU in your logs.
For the send_keys event I would expect something like: +M004000070.STH065001

Hi @alengwenus ,
i enabled the logging, checked logfile and compared it to lcn-monitor logging.
if press or test the buttun i see following lines:

LCN-MONITOR

16:02:52 [PCHK] S000_LPRO to M004 Send keys: 1 - - - - - - -  A=HIT
16:02:52 [PCHK] $M000001.STH065001

homeassistant.log:

2024-08-10 15:47:32.820 DEBUG (MainThread) [pypck.connection] from 27480b604ec25fe28a2282fcbc5404ad: $M000001.STH065001

i seems. the module part is missing? is this maybe a new behavior of lcn-visu, or configuration error?

br
Chris

Looks like the VISU uses new commands which are not yet implemented in the HA integration.
Unfortunately, I do not have a VISU at hand, so I cannot test it. :unamused:
This is a bit annoying as the modification is only a few characters, which you probably can’t do on your site (unless you have a development environment set up)?

I can try to build a custom component if you are willing to help? But that might take some time.

Hi @alengwenus ,
Sorry, have No development Environment,but If you are able to build a custom component, i’m willing to try it with your Support.
Do you need further Output from logfile?
Many thanks, Chris

To close this thread: The fix was implemented in 2024.8.2

Hi @alengwenus @tango38317,

you can modify current python modules in HA. You just need to obtain access to the host running your HA, then get a shell session with your actual homeassistant container. Any modification would survive until next HA upgrade (as this creates over a new container image).

once you have your ssh keys, you can even use built-in HA’s add-on to get into container’s shell. I had discussion about this here:

if something’s not clear I can provide more detailed guidance.

Best regards,
K.M.