Is there a way to control shelly rgbw over KNX?

where can i find the service doc?

i found it, now i have to do a look.

OK,

this is a way to control shelly rgbw, but I’m not sure how I’m supposed to manage that all 4 colors (RGBW) from KNX are to be adopted in this automation.

In KNX all 4 colors come as a single group address.

- id: '1671048140828'
  alias: Neue Automatisierung
  description: ''
  trigger:
  - platform: device
    type: changed_states
    device_id: ca399f7f569aadb1db260270c73197a7
    entity_id: switch.shellyplug_s_4022d8890ed1
    domain: switch
  condition: []
  action:
  - service: light.turn_on
    target:
      entity_id: light.shellyrgbw2_d88e91
    data:
      brightness: 130
      rgbw_color:
      - 0
      - 0
      - 255
      - 0

your needed data in rgbw_color: is a list of 4 int 0…255 too, so just use a template to pass the list (or the first 4 items) to that service.

I dont´t understand it.

i have these:

configuration.yaml

knx:
  event:
    # Philipp RGBW - Rot
    - address:
        - "1/0/48"
      type: "percent"

    # Philipp RGBW - Grün
    - address:
        - "1/0/50"
      type: "percent"

    # Philipp RGBW - Blau
    - address:
        - "1/0/52"
      type: "percent"

    # Philipp RGBW - Weiß
    - address:
        - "1/0/54"
      type: "percent"

automations.yaml

- id: '1671048140828'
  alias: Neue Automatisierung
  description: ''
  trigger:
  - platform: event
    event_type: knx_event
    event_data:
      destination: 1/0/48
  action:
  - service: light.turn_on
    target:
      entity_id: light.shellyrgbw2_d88e91
    data:
      brightness: 65
      rgbw_color:
      - 0
      - 0
      - 255
      - 0

I can’t get any further from this point.

How do I get these 4 values ​​in here now. They are individual values ​​and I don’t understand how to deal with them.

You never said that the colors are spread over multiple GAs 🤷
Maybe you can store the values in a helper attribute or something. Not sure if that works though.
If not you could use individual sensors to store the value.

Hello Matthias,

All colors are always separate in KNX. Each color a percent type group address.

how can i do this and once I have that, what’s next?

I don´t have any idea how to do this.

Thank´s for your help.

Is there anybody who can help me whith this problem?

  • configure 3 knx sensors. One for each color. type: percent or type: percentU8 (latter is 0-255)
  • make an automation listening for state changes of these 3 sensors.
  • use their states to set a new color for your entity with light.turn_on service in the automation action - read documentation about templates on how to do this.

OK, now i have the 4 sensors:

  sensor:
    - name: "Philipp RGBW - rot"
      state_address: "1/0/48"
      type: percentU8

    - name: "Philipp RGBW - grün"
      state_address: "1/0/50"
      type: percentU8

    - name: "Philipp RGBW - blau"
      state_address: "1/0/52"
      type: percentU8

    - name: "Philipp RGBW - weiß"
      state_address: "1/0/54"
      type: percentU8

and i have these automation:

- id: '1671048140828'
  alias: Philipp RGBW
  description: ''
  trigger:
  - platform: event
    event_type: knx_event
    event_data:
      destination: 1/0/48
  action:
  - service: light.turn_on
    target:
      entity_id: light.shellyrgbw2_d88e91
    data:
      brightness: 65
      rgbw_color:
      - 0
      - 0
      - 255
      - 0

the automation works whith the fixed valus for RGBW colors, but i have no idea how to replace the fixed values ​​with the sensor values.
I can´t find something in docs for how to do this. Maybe I’m looking wrong, but I’m treading water.

Could you possibly give me a solution, or at least give a contribution from which one can derive it in a meaningful way?

Use templates to get the states of your sensors.

rgbw_color:
  - "{{ states('sensor.rot') | int(0) }}"
  - ...

Here is documentation for this: https://www.home-assistant.io/docs/configuration/templating/

You also don’t need to use knx_event as trigger (and define it in configuration.yaml) when you have sensors defined. You can use

automation:
  trigger:
    - platform: state
      entity_id:
        - sensor.rot
        - sensor.grün
        - ...

Here is documentation for this: https://www.home-assistant.io/docs/automation/trigger/#state-trigger

Thank you very much,

the way with templates is new for me.

Here is my complete solution to control Shelly rgbw.

In configuration.yaml

knx:
  sensor:
    - name: "Philipp RGBW - rot"
      state_address: "1/0/48"
      type: percentU8

    - name: "Philipp RGBW - grün"
      state_address: "1/0/50"
      type: percentU8

    - name: "Philipp RGBW - blau"
      state_address: "1/0/52"
      type: percentU8

    - name: "Philipp RGBW - weiß"
      state_address: "1/0/54"
      type: percentU8

In automation.yaml

- id: "1671048140828"
  alias: Philipp RGBW
  description: ""
  trigger:
    - platform: state
      entity_id:
        - sensor.philipp_rgbw_rot
        - sensor.philipp_rgbw_grun
        - sensor.philipp_rgbw_blau
        - sensor.philipp_rgbw_weiss
  action:
    - service: light.turn_on
      target:
        entity_id: light.shellyrgbw2_d88e91
      data:
        brightness: 65
        rgbw_color:
          - "{{ states('sensor.philipp_rgbw_rot') | int(0) }}"
          - "{{ states('sensor.philipp_rgbw_grun') | int(0) }}"
          - "{{ states('sensor.philipp_rgbw_blau') | int(0) }}"
          - "{{ states('sensor.philipp_rgbw_weiss') | int(0) }}"

Now I need help for the way back.

Do you also have any idea how I send shelly’s status back to the KNX?

First of all, I would have to break down the 4 colors into individual objects again, that’s where the chaos begins for me.

"{{ state_attr('light.shelly...', 'rgb_color')[0] }}"
would get you the red part. [1] green etc.

Have a look at Open your Home Assistant instance and show your template developer tools. to play with templates
And Open your Home Assistant instance and show your state developer tools. to inspect your entities states and attributes.

Thank you, you are the best.

I will try and give feedback.

OK, I also worked with an automation here. Here is my solution Color States from Shelly to KNX.

- id: '1672774943675'
  alias: Philipp RGBW Status
  description: ''
  trigger:
  - platform: state
    entity_id:
    - light.shellyrgbw2_d88e91
    attribute: rgbw_color
  action:
  - service: knx.send
    data:
      address: 1/0/49
      payload: '{{ state_attr(''light.shellyrgbw2_d88e91'', ''rgbw_color'')[0] }}'
      type: percentU8
  - service: knx.send
    data:
      address: 1/0/51
      payload: '{{ state_attr(''light.shellyrgbw2_d88e91'', ''rgbw_color'')[1] }}'
      type: percentU8
  - service: knx.send
    data:
      address: 1/0/53
      payload: '{{ state_attr(''light.shellyrgbw2_d88e91'', ''rgbw_color'')[2] }}'
      type: percentU8
  - service: knx.send
    data:
      address: 1/0/55
      payload: '{{ state_attr(''light.shellyrgbw2_d88e91'', ''rgbw_color'')[3] }}'
      type: percentU8
  mode: single

It works fine for me, but is there a way to do it in one “knx.send”?

No.
It’s 3 different payloads with 3 different addresses. It will always need 3 Telegrams.

Be aware not to create a loop with your 2 automations since they use the same GAs.

This is not a Problem, i have diffrent GAs for send and receive.
OK, then i have it. Now the next Step.

Is there a way to control the effects of Shelly rgbw. In the integration the effects are supportet i think in the light. entity.

Many thank´s for your help.

Greetings, Wolfgang

Hi again :slight_smile:

I tried the same approach and the data is written to my LED stripe. But the values are not 100% equal. So e. g. when i fully set “Blue” on my KNX device [0,64,255, 255] my LED stripe is returning me the RGB values [128,160,255]. Where is my mistake?

automations.yaml

- id: "1673206473532"
  alias: Combine KNX-RT5 with LED-Sideboard
  description: ""
  trigger:
    - platform: state
      entity_id:
        - sensor.knx_arbeitszimmer_rt5_sideboard_rot
        - sensor.knx_arbeitszimmer_rt5_sideboard_gruen
        - sensor.knx_arbeitszimmer_rt5_sideboard_blau
        - sensor.knx_arbeitszimmer_rt5_sideboard_weiss
  condition: []
  action:
    - service: light.turn_on
      target:
        entity_id: light.controller_rgb_w_rf_412e87
      data:
        # brightness_pct: "{{ states('light.ha_led_streifen_sideboard').attributes.brightness | int(0) }}"
        brightness_pct: 100
        rgbw_color:
          - "{{ states('sensor.knx_arbeitszimmer_rt5_sideboard_rot') | int(0) }}"
          - "{{ states('sensor.knx_arbeitszimmer_rt5_sideboard_gruen') | int(0) }}"
          - "{{ states('sensor.knx_arbeitszimmer_rt5_sideboard_blau') | int(0) }}"
          - "{{ states('sensor.knx_arbeitszimmer_rt5_sideboard_weiss') | int(0) }}"
  mode: single

lights.yaml

# @HomeAssistant RoomTouch5 - WiFi LED Stripe
- name: "HA_LED_RGBW_Sideboard"
  address: "2/1/1" # Schalten Ein/Aus & Dimmen
  state_address: "2/1/1" # Statuswert Ein/Aus & Dimmwert
  color_address: "2/6/4" # Wert RGB
  color_state_address: "2/6/4" # Status Wert RGB
  color_temperature_address: "2/6/4" # Weißwert
  color_temperature_state_address: "2/6/4" # Weißwert

sensor.yaml

# RoomTouch5
- name: "KNX_Arbeitszimmer_RT5_Temp"
  state_address: "3/1/1" # Statuswert Ist
  type: temperature
- name: "KNX_Arbeitszimmer_RT5_Sideboard_Rot"
  state_address: "2/6/0"
  type: percentU8
- name: "KNX_Arbeitszimmer_RT5_Sideboard_Gruen"
  state_address: "2/6/1"
  type: percentU8
- name: "KNX_Arbeitszimmer_RT5_Sideboard_Blau"
  state_address: "2/6/2"
  type: percentU8
- name: "KNX_Arbeitszimmer_RT5_Sideboard_Weiss"
  state_address: "2/6/3"
  type: percentU8
- name: "KNX_Arbeitszimmer_RT5_Sideboard_Helligkeit"
  state_address: "2/1/1"
  type: percentU8

Here the UI comperison:

I also tried to insert into my automation script the brightness level of my KNX device without any success. My try is commented in the automations.yaml file. Do I have any syntax failure here?

I just simply want to use all my RGBW values of my KNX device to set my LED WiFi Controller stripe to the exact same values. :frowning: But all my tries aren’t fully equal and I don’t know why.

By the way: I normally like programming in NodeRED instead of automations.yaml. How is this RGBW script doable in NodeRED? I faced the issue to merge 4 payloads into 1 RGBW message.

I think this should be brightness_pct: "{{ state_attr(‘light.ha_led_streifen_sideboard’, “brightness) | int(0) }}”, but would be easier to say with an error message :person_shrugging:

Do not use knx light entitiy configuration for non-knx entities. This will almost never work well - its not designed for that.

use knx.send with a raw palyoad of a list. Just like

but for payload…

There may be an issue converting RGBW to RGB. Or RGBW without brightness to RGBW with brightness. Or RGBW to RGB with brightness ect… colors are weird…