Switch Hue Light over KNX Push Button

You need the following:

Show Devices and Product Links

Example

A KNX push button in the living room switches two Philips Hue lights. Additionally, the KNX push button indicates the status of the light over the integrated LED.

It’s a 7 steps commissioning:

  1. Configuration of hue lights over hue app -> Create zones, integrate lights
  2. Integration of Philips Hue in Home Assistant
  3. Integration of IP/KNX Gateway in Home Assistant
  4. Configuration of KNX push button
  5. Integrate KNX group objects in Home Assistant
  6. Automation for Light ON and Light OFF
  7. Expose of status of light groups to KNX push button

Guide

1. Configuration of hue lights over hue app

For integration into Home Assistant, I recommend using the Hue app to group the lights into zones. Then control the zones in Home Assistant.

Why?

The zones in the building remain. If you need to replace a light, you put the new light with the hue app into the right zone. Because the zones do not change, there is no need to any reconfiguration in Home Assistant if you control the zones.


2. Integration of Philips Hue

Precondition: the lights have been added to the bridge via the Hue app. Note: lights, zones and rooms are integrated. To distinguish between them, for example, for zones use the suffix _zone, for lamps use the suffix _hue..

If Home Assistant and the Philips Hue Bridge are on the same subnet, the bridge will be automatically detected and can be added in Home Assistant via Settings:Devices & Services:Integrations.

  1. Click configure
  2. When Link Hub appears, press the button on the hue bridge
  3. After that click on submit
  4. All Hue lights and rooms will be listed
Configure Philips Hue integration
Link Philips Hue bridge

Both lights shall:

  • be switches togheter over the KNX push button
  • transmit the status to the KNX push button (even if the lights are switched via the Hue app)

The entities of the Hue lamps are already available as a light group by creating zones in the Hue app. Hue zones are integrated into Home Assistant as light groups.

Home Assistant integration of Philips Hue zone

3. Integration of IP/KNX Gateway

ETS commissioning

The physical address of the KNX/IP gateway as well as the IP address is set via the ETS software.

Home Assistant configuration

The KNX integration is placed at Settings:Devices and services. Link to KNX documentation Home Assistant.


4. Configuration of KNX push button

The following example is from a Feller KNX push button. Further below is another example with a Gira KNX push button. For other manufacturers, the parameters will not be exactly the same, but most likely sufficiently similar that the configuration can be derived from the instructions.

ETS group address

For the name of the group addresses I recommend the notation Floor_Room_Zone_Suffix see floor plan.

Here the example how the group addresses for the KNX push button are defined:

ETS configuration Feller push button

KNX devices allow a wide range of configuration options. The selected configuration should allow the following:

  • I want to switch ON and OFF with the same key -> see operating concept push-button 1
  • I want a KNX button in ON/OFF mode -> see push-button function
  • I would like to have the status displayed via the LED integrated in the push button -> see LED function

ETS associations of Feller push button (without Feedback)

There are devices which have a feedback communication object. The Feller push button does not have this. In order to display the correct status on the integrated LED, On/Off and Feedback group addresses must be associated to the same communication object.

  1. The group address to which the push button sends GF Living Room Ceiling Hue On/Off must be connected first.
  2. The group address for the status GF Living Room Ceiling Hue On/Off Feedback as the second. The object that sends is marked with an “S” in the ETS. Further group addresses only set the status of the button and thus the LED display.
  3. To enable Home Assistant to read the group address, the read flag must be set.

Note: there is also the option to use only a single group address, see code in step 5.

Feller Edizio group object association and flags

ETS association of Gira push button (with Feedback)

KNX devices allow a wide range of configuration options. The selected configuration should allow the following (same as Feller push button):

  • I want to switch ON and OFF with the same key -> see operating concepts -> Button function
  • I want a KNX button in ON/OFF mode -> see Button 1 -> Function
  • I would like to have the status displayed via the LED integrated in the push button -> see Function of status LED
Configuration of Gira push button

ETS association of Gira push button (with Feedback)

The Gira push button has a feedback communication object. To ensure that the integrated LED displays the correct status, the feedback group addresses must be connected to the input – Switching feedback.

  1. The group address to which the pushbutton sends GF Living Room Ceiling Hue On/Off is connected to the object Output – Switching
  2. To enable Home Assistant to read the group address, the read flag must be set.
  3. The group address for the status GF Living Room Ceiling Hue On/Off Feedback is connected to the object Input – Switching Feedback
  4. To enable Home Assistant to write to the group address, the write flag must be set.
Gira push button sensor 4 group object association and flags

5. Integrate KNX group objects to Home Assistant

In Home Assistant the group objects of the KNX push button are integrated via the configuration.yaml file: Device Type Light

File: configuration.yaml

# ----------------- KNX group address to home assistant entity type Light ---------
knx:
  light:
    # For KNX push buttons with switching and feedback communication object
    - name: "gf_living_room_ceiling_hue_onoff"
      address: "2/0/0"
      state_address: "2/0/2"

    # Option: For KNX push button without feedback Communication object
    - name: "gf_living_room_ceiling_hue_onoff"
      address: "2/0/0"
      state_address: "2/0/0"

6. Automation for Light ON and Light OFF

The KNX push button is now available as an entity in Home Assistant. To pass the state of the push button to the Hue lights, two automations are needed. One for switching on and a second one for switching off via the push button.

With the automation, the Philips Hue zone is switched. Thus, lights can be added or changed via the Hue app of the zone without the need for adjustment in the configuration of Home Assistant.

Switching the lights without a zone is of course also possible.

File: automations.yaml

- id: '1111111111111'
  alias: Auto Light GF Living Room Ceiling OFF
  description: All lights in GF Living Room Ceiling OFF
  trigger:
  - platform: state
    # Entity of KNX group address 2/0/0
    entity_id: light.gf_living_room_ceiling_hue_onoff
    from: 'on'
    to: 'off'
  condition: []
  action:
  - service: light.turn_off
    target:
      # Light group of the hue luminaires
      area_id: gf_living_room_ceiling_hue_zone
  mode: single

7. Expose of status of light groups to KNX push button

The state of the Hue lights can be changed not only via Home Assistant, or the KNX button, but also via the Hue app. In order for this change to be forwarded to the KNX push button, the Expose function is required. Home Assistant documentation: Expose Entity State.

File: configuration.yaml

# ---------------- Hue Status to KNX group address --------------
knx:
  expose:
    # For KNX push buttons with switching and feedback communication object
    - type: 'binary'
      entity_id: 'light.gf_living_room_ceiling_hue_zone'
      address: "2/0/2"

    # Option: For KNX push button without feedback communication object
    - type: 'binary'
      entity_id: 'light.gf_living_room_ceiling_hue_zone'
      address: "2/0/0"

Code example for configuration.yaml

File: configuration.yaml

#================== KNX configuration ===============================

knx:

# As of Home Assistant version 2021.12, the KNX/IP gateway is configured via integration
# The tunneling configuration is only needed for versions < 2021.12
# ----------------- KNX/IP Gateway  ---------------------
#  tunneling:
#    host: "192.168.177.22"

  # ----------------- KNX group address to home assistant entity type Light ---------
  light:
    # For KNX push buttons with switching and feedback communication object
    - name: "gf_living_room_ceiling_hue_onoff"
      address: "2/0/0"
      state_address: "2/0/2"

    # Option: For KNX push button without feedback Communication object
    - name: "gf_living_room_ceiling_hue_onoff"
      address: "2/0/0"
      state_address: "2/0/0"

  # ---------------- Hue Status to KNX group address --------------
  expose:
    # For KNX push buttons with switching and feedback communication object (e.g. Gira)
    - type: 'binary'
      entity_id: 'light.gf_living_room_ceiling_hue_zone'
      address: "2/0/2"

    # Option: For KNX push button without feedback communication object 
    - type: 'binary'
      entity_id: 'light.gf_living_room_ceiling_hue_zone'
      address: "2/0/0"