Light MQTT payloaads not working right way with Casambi gateway

Hi,

I have a Casambi luminaire that’s connected with a MQQT to Casambi interface from Lithernet. The documentation of the device can be found here.

I coded a template like for that:

- light:
    name: "Occhio Light Desk Right"
    unique_id: "occhio_light_desk_right"
    state_topic: "casambi/0/get/poll_device/4/values"
    state_value_template: "{{ 'ON' if value_json.level | int > 0 else 'OFF' }}"
    brightness_state_topic: "casambi/0/get/poll_device/4/values"
    brightness_command_topic: "casambi/0/set/target_level"
    brightness_value_template: "{{ value_json.level }}"
    brightness_command_template: "{\"targetid\": 4, \"level\": {{ value }}, \"targettype\": 1}"
    brightness_scale: 254
    color_temp_state_topic: "casambi/0/get/poll_device/4/values"
    color_temp_value_template: >
      {{ (( (1 - (value_json.cct_level|int) / 254.0 )) * (500-153) + 153 ) | round(0) }}
    color_temp_command_topic: "casambi/0/set/target_tc"
    color_temp_command_template: >
      {% set mired = (value|int) %}
      {% set m = [500, [153, mired]|max]|min %}
      {% set cct = (((500 - m) / (500 - 153)) * 254) | round(0) %}
      {% set level = state_attr('light.occhio_light_desk_right', 'brightness') | int(254) %}
      {{
        {
          "targetid": 4,
          "targettype": 1,
          "level": level,
          "tc": cct|int
        } | tojson
      }}
    command_topic: "casambi/0/set/target_level"
#    payload_off: '{"targetid": 4, "level": 0, "targettype": 1}'
    on_command_type: "brightness"
    qos: 1
    optimistic: false
    device:
        name: "Casambi Gateway 0"
        identifiers: ["casambi_Gateway_0"]
        manufacturer: "Lithernet"
        model: "Casambi MQTT Gateway"
        sw_version: "4.45"

It’s working in a way that you can switch on the light and change the brightness withput any problems. But if I want to switch it off all other Casambi lights are also switched off.

I can use the payload_off command so it will only switch off that light. But then the status of the light entity isn’t correct any more. If the luminaire is switched on the entity is in the state off.

Also the white temperature can not be modified correctly.

I also tried to read the status into another status entity and changed the luminaire entity depending on the status entity with an automation. But this didn’t work either.

Does anyone have a solution for that?

Thank you very much.