Knx light entity and blocking entity from motion detector

Hello
I have the following problem. My knx light is controlled by a knx motion detector now the problem is the following i want to create an automation that when home assistant entity state of the light is changed only on the bus of home assistant not the device itself that the blocking channel of my detector is switch on or off depeding on the state of the light in home assistant. So basically when i turn the light on from home assistant it stays on forever and the detector cannot turn it off even when I activated it.
So far this is where i am

- id: '1641393235216'
  alias: tehnical room detector on
  description: ''
  trigger:
  - platform: state
    entity_id: light.tehnical_room
    from: 'off'
    to: 'on'
  condition: []
  action:
  - service: switch.turn_on
    target:
      entity_id: switch.detector_panel_down_block
  mode: restart
  
- id: '1641393235217'
  alias: tehnical room detector off
  description: ''
  trigger:
  - platform: state
    entity_id: light.tehnical_room
    from: 'on'
    to: 'off'
  condition: []
  action:
  - service: switch.turn_off
    target:
      entity_id: switch.detector_panel_down_block
  mode: restart

Any help would be apreciated

Why don’t you just use the motion detectors lock GA as address for the light?

Hello thank you for your interest. Wow thank you ! that works a charm but do you have any suggestion if the light is dimmable with an absolute value ?

Why wouldn’t it be?

Well the problem is that the lock function only provides on state when is locked and off when is unlocked. Now in a perfect situation it would be nice that the locked function don’t have to change the state of the lamp just block everything and that i can set in ETS.

I don’t quite understand what you mean and what you want to do in ETS!?

You can use the brightness GAs of the dimming actuator - this should work fine.

If you want to see the “real” state of the light revert and add a switch entity for the lock.

Ok let me explain again. So the lock of the motion detector has the option to just block or block with sending on or off so that means is ga lock is on the detector will send on to the light ga or if the lock ga is on the detector will only lock.
So in this case having a lamp that is controlled by the absolute ga then i cannot use the trick you first mention

You can use both addresses - lock for address and the actuators brightness for brightness. But when the light is set up to turn on when receiving a % value it will still have OFF state in HA.

Its a tricky condition … HAs entity model is not really well suited for this. I think the best option would be 2 entities…

yes using automation and 2 entity is the way to go. Now maybe if you know openhab i would use this type of script to make it work

And this allows me to control the light in openhab without the detector being able to turn off the lamp. And also very important if the block Block_WCHallway_first_Ligh was off the rule then would not react to the ON state of WCHallway_first_Light because the received command was only in the internal bus of openhab

rule "detector wc hallway first floor"
when
    Item WCHallway_first_Light received command
then
    if (receivedCommand==0 || receivedCommand==OFF) {
        sendCommand(Block_WCHallway_first_Light, OFF)
    } else {
        sendCommand(Block_WCHallway_first_Light, ON)
    }
end

I don’t know OpenHAB.
If you want to trigger an automation from triggering a light from HA you can probably use the event call_service as trigger. See Events - Home Assistant

hello again thank you for the information the way i made to work like i want is this

- id: '1641540113995'
  alias: detector panel basement
  description: ''
  trigger:
  - platform: event
    event_type: state_changed
    context:
      user_id:
      - 04bb7b70a8b24299b699567e43bb3912
  condition:
  - condition: template
    value_template: '{{ trigger.event.data.new_state.state == ''off'' }}'
  action:
  - service: switch.turn_off
    target:
      entity_id: switch.detector_panel_down_block
  mode: restart

- id: '1641540113996'
  alias: detector panel basement2
  description: ''
  trigger:
  - platform: event
    event_type: state_changed
    context:
      user_id:
      - 04bb7b70a8b24299b699567e43bb3912
  condition:
  - condition: template
    value_template: '{{ trigger.event.data.new_state.state == ''on'' }}'
  action:
  - service: switch.turn_on
    target:
      entity_id: switch.detector_panel_down_block
  mode: restart

so now only when that user triggers the light entity the block channel is on but if knx detector triggers the light entity then the block channel is not changed. Now i still need to make this pretty without two rules

have a look at choose and trigger_id :wink:
you can even make a blueprint out of it if you need it more often.

This seems odd to me. I’d use " inside single quotes or single quotes inside "quoted text to define strings →
'{{ trigger.event.data.new_state.state == "on" }}'