Dear Farmio, all,
after hours of various trials, I definitely need your help…
I’ve a KNX Wall Switch operating as one button dimmer with the 2 objects (one is 1.001 and the other one 3.007), as per your example I believe.
I want to use this switch to control a SHELLY light through HA.
I do see the knx_event with the right data in the log, but the light doesn’t switch nor dimmer…
The Shelly light already works fine with a simple dimmer control in lovelace…
I’m using the HA core-2021.4.6.
I post here below the YAML conf I’ve in my light file package configuration:
Thanks a lot in advance for helping.
Simone
knx:
#fire_event: true
event_filter: ["0/0/7", "0/0/15"]
light:
- platform: mqtt
schema: template
name: lucep
command_topic: "shellies/shellydimmerpranzo/light/0/set"
state_topic: "shellies/shellydimmerpranzo/light/0/status"
command_on_template: >
{"turn": "on"
{%- if brightness is defined -%}
, "brightness": {{brightness | float | multiply(0.3922) | round(0)}}
{%- endif -%}
}
state_template: '{%- if value_json.ison %}on{% else %}off{% endif %}'
brightness_template: '{{ value_json.brightness | float | multiply(2.55) | round(0) }}'
command_off_template: '{"turn":"off"}'
qos: 0
automation:
- alias: ziop
description: ""
trigger:
- platform: event
event_type: knx_event
event_data:
address: 0/0/7 # dim step ga, 3.007
- platform: event
event_type: knx_event
event_data:
address: 0/0/15 # switch ga, 1.001
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: >-
{{trigger.event.data.address=='0/0/7' and trigger.event.data.data
== 9}}
sequence:
- repeat:
count: '26'
sequence:
- service: light.turn_on
data:
brightness: >-
{{ [state_attr('light.lucep',
"brightness")|int(0) + 10, 255]|min }}
entity_id: light.lucep
- delay: '00:00:00.5'
- conditions:
- condition: template
value_template: >-
{{trigger.event.data.address=='0/0/7' and trigger.event.data.data
== 1}}
sequence:
- repeat:
count: '26'
sequence:
- service: light.turn_on
data:
brightness: >-
{{ [state_attr('light.lucep',
"brightness")|int(0) - 10, 0]|max }}
entity_id: light.lucep
- delay: '00:00:00.5'
- conditions:
- condition: template
value_template: >-
{{trigger.event.data.address=='0/0/15' and trigger.event.data.data
== 1}}
sequence:
- service: light.turn_on
data: {}
entity_id: light.lucep
- conditions:
- condition: template
value_template: >-
{{trigger.event.data.address=='0/0/15' and trigger.event.data.data
== 0}}
sequence:
- service: light.turn_off
data: {}
entity_id: light.lucep
default: []
mode: restart
PS: It also works switching the light if I do for example the following, but then I don’t know how to dimmer it…
knx:
binary_sensor:
- name: "pulsante_pranzo"
state_address: '0/0/15'
automation:
- alias: prova_knx_on
trigger:
platform: state
entity_id: binary_sensor.pulsante_pranzo
to: 'on'
action:
service: light.turn_on
entity_id: light.lucep
- alias: prova_knx_off
trigger:
platform: state
entity_id: binary_sensor.pulsante_pranzo
to: 'off'
action:
service: light.turn_off
entity_id: light.lucep