Hello,
I’ve got 2 KNX (dali) lights:
light:
- name: "1.1.15_EVG07 - K13R"
address: "2/0/45"
state_address: "2/2/45"
brightness_address: "2/1/127"
brightness_state_address: "2/3/57"
- name: "1.1.15_EVG08 - K13L"
address: "2/0/14"
state_address: "0/1/125"
brightness_address: "2/1/14"
brightness_state_address: "2/3/14"
binary_sensor:
- name: "1.1.18_3.1 - S54"
state_address: "2/0/14"
Today, the second light (K13L) is configured in KNX to be used with a wall switch (S54).
I would like now to read out the brightness of K13L, and send this value to K13R.
So that both lights are using the same value.
Any suggestion how I can do this best?
I was already able to ‘catch’ the value.
service: logbook.log
metadata: {}
data:
entity_id: light.1_1_15_evg08_k13l
name: Wandverlichting
message: De status van Wandverlichting is {{state_attr('light.1_1_15_evg08_k13l', 'brightness')}}
Next step, use that in a rule to send it to another KNX light. Maybe I should check first to put it in a variable?
I’ve already seen that with a normal rule, you can set value 0-100? Values I see are t 0-255.
farmio
(Matthias Alphart)
May 10, 2024, 9:33am
3
Hi !
I’d create an automation for this.
trigger on state change of one light entity (maybe even attribute change - brightness)
condition that the state of that entity is “on”
action set the other light entities brightness to the brightness attribute of the trigger-entity (via simple state_attr()
template.
No need to mess with logbook or Knx directly.
farmio:
action set the other light entities brightness to the brightness attribute of the trigger-entity (via simple state_attr()
template.
Seems I’m a bit stick to send the value. I was trying this following, but doesn’t works as expected:
alias: Wandverlichting
description: ""
trigger:
- platform: state
entity_id:
- light.1_1_15_evg08_k13l
condition:
- condition: state
entity_id: light.1_1_15_evg08_k13l
state: "on"
action:
- service: light.turn_on
metadata: {}
data:
brightness_pct: {{ ((state_attr ('light.1_1_15_evg08_k13l', 'brightness')) / 255 * 100 ) | round(1)}}
target:
entity_id: light.1_1_15_evg07_k13r_2
mode: single
farmio
(Matthias Alphart)
May 11, 2024, 9:57am
5
You are missing quotes here and there is a space between “state_attr” and “(”.
You can also save the calculation and use 0…255 directly.
brightness: "{{ state_attr('light.1_1_15_evg08_k13l', 'brightness') }}"
(have not tested this, but I think this should work)
You can test your templates here
1 Like
Thanks, this is working:
alias: Wandverlichting
description: ""
trigger:
- platform: state
entity_id:
- light.1_1_15_evg08_k13l
condition: []
action:
- if:
- condition: state
entity_id: light.1_1_15_evg08_k13l
state: "on"
then:
- service: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.1_1_15_evg07_k13r_2
- service: light.turn_on
metadata: {}
data:
brightness: "{{ state_attr ('light.1_1_15_evg08_k13l', 'brightness') }}"
target:
entity_id: light.1_1_15_evg07_k13r_2
enabled: true
else:
- service: light.turn_off
target:
entity_id:
- light.1_1_15_evg07_k13r_2
data: {}
mode: single
Just not sure if the 2x actions ‘ON’ is a good idea? If I do it without the first one, the light isn’t triggered.
farmio
(Matthias Alphart)
May 11, 2024, 10:28am
7
Just have a look at the group monitor to see what happens on Knx side. I think it will send to the brightness GA. If the light turns on by that is an actuator setting (ETS), not a HA thing.
Brononius:
state_attr ('lig
I still think the space is wrong, but if it is working, fine for me.
1 Like