{%- 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].
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
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.
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.
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.
@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
@Bamsefar
Hi, same problem hier with a SA/S 8.16.5S and also coming from ETS3 to ETS5. What do you mean by force write?
I allready resetted, unload, add a new device, full download x5. still the same problem.
Regards, Maarten