Exposing a boolean value to a KNX group address possible?

There is a completely different approach to solve the OP’s problem. 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 it is not.

The right way to solve this task is to create a KNX switch in HA and bind it to your boolean KNX group address. Then you can simply write to the HA switch with switch.turn_on / switch.turn_off and the state change will be copied to the KNX bus.

switch:

  - platform: knx
    name: "Tag/Nacht"
    # --> HA entity_id will be "switch.tag_nacht"
    address: '0/0/4'

automation:

  - id: daynight_switch_to_day
    trigger:
    ...
    action:
      - service: switch.turn_on
        entity_id: switch.tag_nacht

  - id: daynight_switch_to_night
    trigger:
    ...
    action:
      - service: switch.turn_off
        entity_id: switch.tag_nacht

You may also check my new KNX cookbook. I am currently adding recipes therer and am just about to add the above way to control KNX switche, together with more info about coupling KNX and Hue over HA:

1 Like