Switch or binary sensor exposed to KNX bus

Is it not possible to expose a switch or binary sensor to a KNX bus?

According to the links below you can read in KNX sensors and control KNX switches. So it looks like the answer is no you cant have your KNX devices read Hassio switches or sensors. However, you could use an automation to trigger on a Hassio sensor or switch and as an action control a KNX switch (to mirror the Hassio one for example) or notify a KNX device of a Hassio sensor value.

According the KNX docs you have the expose service but apparently only for sensor values.

Exposing sensor values or time to knx bus

KNX component is able to expose time or sensor values to KNX bus. The component will broadcast any change of the exposed value to the KNX bus and answer read requests to the specified group address:

Example configuration.yaml entry

knx:
expose:
- type: ‘temperature’
entity_id: ‘sensor.owm_temperature’
address: ‘0/0/2’
- type: ‘time’
address: ‘0/0/1’
- type: ‘datetime’
address: ‘0/0/23’

• type: Type of the exposed value. Either time or datetime or any supported type of KNX Sensor (e.g., “temperature” or “humidity”).
• entity_id: Entity id of the HASS component to be exposed. Not necessary for types time and datetime.
• address: KNX group address.

1 Like

Doh. I actually had “sensor yes, switch no” in my original reply. Not sure why I changed it. Probably after reading the sensor page. The expose sensor bit is on the main component page. Sorry about that. Glad you spotted it.

:grinning: but strange if it isn´t not possible to expose a 1 bit telegram when more complex telegrams are no problem.

No one has an idea how to expose a binary_sensor or switch to the KNX bus?

I don’t know if it is still relevant for you. I had the same problem where I wanted expose a bit so that some knx devices know if it’s day or night. I solved it by setting up an KNX switch in HA and give it the group address of the bit variable in KNX

I still haven´t figured it out, but I did tryk out setting up a KNX switch with the same Group address number as in my KNX project. I just experienced som odd behaviour some times and removed it again, but maybe I should give it another try if you haven´t got any problems.

Hi, not sure if you still need help on this; but I started 2 weeks ago with Home Assistant and I linked it to my KNX system.
What I did to solve the “limitations” of the exposing to KNX, is that I created group addresses in my KNX to sync with hassio.
Simple example:
I have a light in HA which I want to toggle with a KNX button:

  1. I created a light address in KNX (switch and state address).
  2. In HA I create the KNX light and customise it to set it hidden.
  3. In automations I sync in both directions on state change (state change in HA => change light of KNX and vise versa)

Hope this helps!

Hi
I will try it out, thanks.

geertmeersman is right:
The fact that the expose method exists in the KNX component leads many users to believe that this is the only way to transport data from HA to the KNX bus. But you can directly send data to KNX group addresses by using HA’s KNX switches, covers etc. and simply modifying them in HA through the standard service calls like switch.turn_on.

Here is a similar question where I posted an automation fragment:

You may also check my KNX Cookbook. I am about to add more stuff there:

thanks for following up on this :slight_smile:

Hi guys! I think I read this now for the 3rd time but at some point my weirs brains goes fully spongebob :slight_smile:

I have a KNX-Inwall Switch/Button (GIRA Tastsensor 3) installed. With one of the button pairs I simply want to switch on/off a Nanoleaf or Hue light. My Systemintegrator was so kind to bind the buttons to an “empty” Group Address (1bit). How do I get the Nanoleaf mapped to this address?

A bit late, but here’s how I solved it with my KNX wall panels and Tellstick devices:

switch:
  - platform: knx
    name: KNX Dummy Livingroom TV Bench Plug
    address: '1/1/2'

automation:
  - alias: 'Toggle TV bench plug when KNX panel button is pressed'
    trigger:
      - entity_id: switch.knx_dummy_livingroom_tv_bench_plug
        platform: state
    action:
      service: homeassistant.toggle
      entity_id: switch.tv_bench

  - alias: 'Update KNX state address when TV bench switch is toggled'
    trigger:
      - entity_id: switch.tv_bench
        platform: state
    action:
      service: knx.send
      data_template:
        address: '1/4/2'
        payload: '{{ 1 if trigger.to_state.state == "on" else 0 }}'

Not very DRY when you have many dummy mappings though. Maybe there’s a cleaner approach?

1 Like