LCN - wrong variable type

Hi there,

i am trying to integrate LCN devices to HA: i send temperature values from third party sensors to LCN with the help of automations. i configured the variables as counters in LCN. And most of the time the automation stops with an error “wrong variable type”. But not all the time. Sometimes it manages to send the values. I also tried to send direct values in celcius, in native units (like 1250), most of the time i get an error. I noticed in the log, that LCN integration sends LCN.var_reset command by itself, that may cause the error. Thank you!

alias: LCN children bedroom_temp
description: ""
trigger:
  - platform: state
    entity_id: sensor.temp_children_bedroom_temperature
condition: []
action:
  - service: lcn.var_abs
    data:
      address: myhome.s0.m136
      variable: var10
      value: "{{temp}}"
      unit_of_measurement: °C
mode: single
variables:
  temp: "{% set temp = states('sensor.temp_children_bedroom_temperature') %}{{temp}}"

the debug log with an error is here:

2023-01-11 11:58:49.570 ERROR (MainThread) [homeassistant.components.automation.lcn_children_bedroom_temp] While executing automation automation.lcn_children_bedroom_temp

Traceback (most recent call last):

File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 546, in async_trigger

await self.action_script.async_run(

File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1524, in async_run

await asyncio.shield(run.async_run())

File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 409, in async_run

await self._async_step(log_exceptions=False)

File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 453, in _async_step

self._handle_exception(

File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _handle_exception

raise exception

File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step

await getattr(self, handler)()

File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step

await service_task

File "/usr/src/homeassistant/homeassistant/core.py", line 1755, in async_call

task.result()

File "/usr/src/homeassistant/homeassistant/core.py", line 1792, in _execute_service

await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(

File "/usr/src/homeassistant/homeassistant/components/lcn/services.py", line 211, in async_call_service

await device_connection.var_abs(var, value, unit)

File "/usr/local/lib/python3.10/site-packages/pypck/module.py", line 412, in var_abs

not self.is_group, PckGenerator.var_reset(var, software_serial)

File "/usr/local/lib/python3.10/site-packages/pypck/pck_commands.py", line 690, in var_reset

raise ValueError("Wrong variable type.")

ValueError: Wrong variable type.

Hi @andreytel,

what software firmware version does your LCN module use? If it‘s a rather old module (something around SW firmware ~17…), it might be that you cannot use Var10.
Those older modules only provide the TVAR variable which you can set.
Could you please check this up (maybe by using LCN Pro software)?

Andre

Thank you! You are correct, I changed to Var1 and now it ok!