Send modus sensor data to knx

Hi @all,

first of all I am a newbee in homeassistant, so maybe I have a stupid question, but I have not found a related topic in the forum.

I am using modbus to get the data of a heatpump, including sensor outdoor temperature:

modbus:
  type: tcp
  host: 192.168.0.10
  port: 502
  name: "Nibe"
  delay: 10
  #close_comm_on_error: true
  retry_on_empty: true
  retries: 20
  timeout: 5
  message_wait_milliseconds: 500

  sensors:
    - name: "Aussentemperatur"
      unit_of_measurement: "°C"
      data_type: int16
      device_class: temperature
      address: 1
      input_type: input
      scale: 0.1
      precision: 1
      slave: 1

Now I want to send this sensor data to knx bus, but it does not work:

knx:

  expose:
    - type: temperature
      entity_id: modbus.sensors.Aussentemperatur
      address: "6/5/6"  

I think the entity_id is wrong, right?

Best regards

Moppi

Remove the mosbus part in your entity_id exposed
Just sensors.ausse…

Entity id is a sensors in this case.
You can find it with dev tools to confirm

Hello,

thanks for the quick help.
Good news: Configuration is valid, I restarted Ha without any problems.
Bad news: No data on the bus…

Maybe the issue is connected to the datatype: KNX expects a 2 byte value, the value coming from modbus is int 16… .

Do you know how to convert this?

Best regards and many thanks

Moppi

No need to convert it as HA internally treats its states as strings anyway. You just have to define the type key in your knx expose for the knx Integration to encode it properly when sending to the bus (because it can’t know the DPT). See Value types and Expose

But I see you used “temperature” so it should work. Be aware that the knx Integration only sends on state changes (and init).
Try enabling debug log for xknx.telegram and look for the GA when a state changed. Log level

Here you can find the proper entity_id Open your Home Assistant instance and show your state developer tools.
And here if any errors occur in the logs Open your Home Assistant instance and show your Home Assistant logs.