KNX binary_sensor significant_bit dimming control

Hello all awesome people!

Before version 0.115 I used KNX binary sensor to capture DPT 3.007 dimming control from the KNX bus.
I used this to dim/brighten Z-wave lights from KNX buttons around the house.
But now when the significant_bit option has been removed from KNX binary_sensor I don’t know how to do this anymore.
Anyone have any idea on how to solve this with the 0.115 version?

Code I used before version 0.115:

binary_sensor:
  - platform: knx
    name: master_bedroom_button3_left_dim_sbit1
    state_address: '1/3/182'
    significant_bit: 1
    sync_state: false
  - platform: knx
    name: master_bedroom_button3_left_dim_sbit4
    state_address: '1/3/182'
    significant_bit: 4
    sync_state: false

  - platform: template
    sensors:
      master_bedroom_button3_left_dim_up:
        value_template: "{{ is_state('binary_sensor.master_bedroom_button3_left_dim_sbit1', 'on') and is_state('binary_sensor.master_bedroom_button3_left_dim_sbit4', 'on') }}"
      master_bedroom_button3_left_dim_down:
        value_template: "{{ is_state('binary_sensor.master_bedroom_button3_left_dim_sbit1', 'on') and is_state('binary_sensor.master_bedroom_button3_left_dim_sbit4', 'off') }}"

Try a “knx_event” instead of the binary sensor - see fire_event in https://www.home-assistant.io/integrations/knx/

Thank you @farmio for pointing me in the right direction.

Here is my solution:

ETS configuration


knx:
  fire_event: true
  fire_event_filter: ["1/3/180,182"] #send these group addresses to the event bus
  expose:
    - type: 'binary'
      entity_id: 'light.bed_lamp'
      address: '1/3/181' #control status LED on KNX button

input_boolean:
  master_bedroom_fold3_left_dim_stop:
    initial: false

automation:
# Bed lamp on/off
  - alias: 'MasterBedroomFold3leftOnOff'
    initial_state: 'on'
    trigger:
      - platform: event
        event_type: knx_event
        event_data:
          address: '1/3/180'
    action:
      - service: >
          {% if is_state('light.bed_lamp', 'off') %}
            light.turn_on
          {% else %}
            light.turn_off
          {% endif %}
        data:
          entity_id: light.bed_lamp

# Bed lamp brightness control
  - alias: 'MasterBedroomFold3leftDimUp'
    initial_state: 'on'
    trigger:
      - platform: event
        event_type: knx_event
        event_data:
          address: '1/3/182'
          data: 9
    action:
      - service: input_boolean.turn_off
        data:
          entity_id: input_boolean.master_bedroom_fold3_left_dim_stop
      - service: script.turn_on
        data:
          entity_id: script.bedlight_bright

  - alias: 'MasterBedroomFold3leftDimDown'
    initial_state: 'on'
    trigger:
      - platform: event
        event_type: knx_event
        event_data:
          address: '1/3/182'
          data: 1
    action:
      - service: input_boolean.turn_off
        data:
          entity_id: input_boolean.master_bedroom_fold3_left_dim_stop
      - service: script.turn_on
        data:
          entity_id: script.bedlight_dim

  - alias: 'MasterBedroomFold3leftDimStop'
    initial_state: 'on'
    trigger:
      - platform: event
        event_type: knx_event
        event_data:
          address: '1/3/182'
          data: 0
    action:
      - service: input_boolean.turn_on
        data:
          entity_id: input_boolean.master_bedroom_fold3_left_dim_stop

script:
  bedlight_bright:
    sequence:
      - condition: state
        entity_id: script.bedlight_dim
        state: 'off'
      - service: light.turn_on
        data:
          entity_id: light.bed_lamp
          brightness_step: 10
      - service: script.turn_on
        data:
          entity_id: script.bedlight_bright_pause
      
  bedlight_bright_pause:
    sequence:
      - condition: state
        entity_id: input_boolean.master_bedroom_fold3_left_dim_stop
        state: 'off'
      - delay:
          milliseconds: 400
      - service: script.turn_on
        data:
          entity_id: script.bedlight_bright

  bedlight_dim:
    sequence:
      - condition: state
        entity_id: script.bedlight_bright
        state: 'off'
      - service: light.turn_on
        data:
          entity_id: light.bed_lamp
          brightness_step: -10
      - service: script.turn_on
        data:
          entity_id: script.bedlight_dim_pause
     
  bedlight_dim_pause:
    sequence:
      - condition: state
        entity_id: input_boolean.master_bedroom_fold3_left_dim_stop
        state: 'off'
      - delay:
          milliseconds: 400
      - service: script.turn_on
        data:
          entity_id: script.bedlight_dim

1 Like

Wow, nice! :+1:
You may rename the thread to “WTH is it so complicated to dimm a light from a push button?” :rofl: