Configration KNX error

Hi out there

I have a script that looks like this

        {%- for state in states.binary_sensor
          |selectattr('attributes.device_class', 'defined')
          |selectattr('attributes.device_class', '==', 'lock') -%}
          {% if state.state == 'off' %}
            {% set ns.sensors = ns.sensors + [dict(name = state.name | replace(', dag/nat', '') | replace(', status', ''), state =state.state)] %} 
          {% endif %}
        {%- endfor -%}
        {%- set door = ns.sensors | sort(attribute='state') %}
        {%- set ns = namespace(door='') -%}
        {%- for state in door -%}
          {% set ns.door= ns.door + (state.name ~ ' (' ~ state.state ~')' ~ "\n") %}
        {%- endfor -%}```

Running it in Template, it return exactly what I am looking for.

But:
Intregrate it into configuration.yaml
```   - name: "Døre nat status"
      icon: >
        mdi:door-closed-lock
      state: >
        {%- set ns = namespace(sensors=[]) -%}
        {%- for state in states.binary_sensor
          |selectattr('attributes.device_class', 'defined')
          |selectattr('attributes.device_class', '==', 'lock') -%}
          {% if state.state == '0' %}
            {% set ns.sensors = ns.sensors + [dict(name = state.name | replace(', dag/nat', '') | replace(', status', ''), state =state.state)] %} 
          {% endif %}
        {%- endfor -%}
        {%- set door = ns.sensors | sort(attribute='state') %}
        {%- set ns = namespace(door='') -%}
        {%- for state in door -%}
          {% set ns.door= ns.door + (state.name ~ ' (' ~ state.state ~')' ~ "\n") %}
        {%- endfor -%}```

gives the following error:
```2023-01-05 11:52:32.466 WARNING (MainThread) [xknx.log] Can not process <Telegram direction="Incoming" source_address="1.5.82" destination_address="11/5/22" payload="<GroupValueResponse value="<DPTBinary value="42" />" />" /> for Udestue, dør vest, dag/nat, status - State: <CouldNotParseTelegram description="payload invalid" device_name="Udestue, dør vest, dag/nat, status" feature_name="State" payload="<DPTBinary value="42" />"/>```

Any one who has an idea??

It is a binary_sensor fra KNX that is shown as ON/OFF in HA, but it is send out as a 0/1

I even tried to change it to int and to 0, just to see if the error goes away, under the idea, that maybe in configuration.yaml, it sees it as numer and not character

Any ideas appriciated

Marinus

Your error has nothing to do with your template. Take a moment to actually read your error. It’s complaining about the devices payload, not the template. So the device is sending bad data to you.

You seem to try to send a payload: 42 - which is interpreted as a binary value of 42.
To send payloads for DPTs other than 1,2 or 3 use a list of ints representing byte values. eg payload: [42].

Hi Farmio

I got that from the error Message, but i am unable to find a solution.
It works fine in te plate but not when entered into codiguration.yaml
That what confuses me

Hi Petro

I did read the Message, but as mentioned this error only shows when running it in Configuration.yaml, not when it is run in Template

That is what puzzles me.

If I see knx, it sends 00 and 01

Template doesn’t use Knx.send service. The service raises that exception.

Oh sorry, I have not seen the whole error.
The error comes from an incoming message. So it seems you just have a typo at a GA or something.

Hi Farmio

That explains the difference. Not being at your level and experience, do you have and idea how to solve ir.

As I see in KNX, it sends $00 and $01 which is shown as on/off.

It is a simple switch thatnisneither on/off

Appriciate your help

I have total 14 of these switches (door controle) and they all Report the same dpt 42 error

What do you mean with GA?

The typo you point at, is it in the Configutarion.yaml or?

This, I don’t understand it, seems to have a wrong GA in configuration.yaml

The error occuring when you add it to configuration.yaml is a fluke. The template is not producing your error, I can say this with 100% certainty. Anyways, farmio has a much better handle on KNX than I do (I don’t use it), so I recommend you take his advice.

Thanks for your time, appriciated

Farmio

It says patio, door West day/night…

It is Danish, It is the friendly name of the switch

If I “print” the full value of the switch it does Report state as on or off, does that help

{‘name’: ‘Udestue, dør vest’, ‘state’: ‘off’}

There seems to be an invalid value coming from KNX Bus. You won’t see anything in a HA state about that.
I suggest using ETS diagnostics group monitor to see if you can pin that down. Just try to read the address and see what value it yields.

But source_address="1.5.82" destination_address="11/5/22" from the error should already lead you there.

Hi Farmio

When I look at the data send, it says $00 and $01.

1.5.82 is a ABB alarm module
11/5/22 is the switch address.

I will be at the ETS tomorrow and look more into it, and revert with more data.

Really appriciate your guidance here, I know you are very busy
Marinus

@farmio

OK found the error. Switch is ABB SA/S12.6.1 and should report either $00 closed or $01 open. However some of the switch reports status off as $2A and other correct $01 (on same unit with same basic parameters). If I manually write to that switch close, it updates to $00, but when reading it again it read the wrong $2A.
ABB brain is not available before monday, so I will try to ask him for a solution. SInce on 7 different units, there is no logic in when it reports corrct or wrong.

So I will revert when news

@farmio
sorry for late reply, surgery came in the way

error was that the project originally came from ETS3, upgraded to ETS4 and finally to ETS5. Some of the data were “corrupted”, so by doing a force write, with new parameters, it is fully operational

Once again thks for your support
Marinus