KNX Cookbook

I am trying to get my energy dashboard to work with a knx energy meter but whatever I try it is always showing 0.
For example I tried to configure the following:

  - name: "Total Active Energy"
    state_address: "0/5/4"
    type: active_energy
#    state_class: measurement
    state_class: total_increasing

I can see the sensor and it has an increasing value. So everything looks fine but not in the energy dashboard:

Is there a solution for my problem?

wait. Data for the energy dashboard is created once an hour (long term statistics).

I’m waiting for weeks :slight_smile: and I did try several configuration.

Yeah, that might be the problem.
Are the states of the sensor correct? See `/developer-tools/state
Bildschirmfoto 2022-10-08 um 21.41.05
Try removing the sensor entirely and readd it then.

1 Like

It looks fine

state_class: measurement
source: 1.1.24
unit_of_measurement: Wh
device_class: energy
friendly_name: Total Active Energy
last_reset: 1970-01-01T00:00:00+00:00

I will try your solution with removing the sensor and readding it. I am still wondering what the correct state_class is. Is it measurement or total_increasing?

Nope, thats wrong. It should be total_increasing.

1 Like

You are right. I still had my global customize active which did overwrite it. Now it is working.
This problem was driving me nuts. Thanks for your help :grinning:

1 Like

Hi @Jpsy ,
I have some kind of the same question.
My house is full with Gira RF Wall Switches.
I would love the wall switches to trigger my Home Assistant environment. No need for the reverse way.
What would I need to make this happen

  • RF Line Coupler?
  • KNX IP Router or just KNX IP Interface?
    The company who installed my Gira system does not exist any more.
    Would I need ETS (how to get it) or can I manage without it?

Thx!

KNX interface should be good enough. KNX router is needed if you want to couple two KNX buses over IP.
Regarding the ETS it will be difficult if you don’t have the project. ETS free version supports up to 5 devices only. Than there is the next up which is around 200 EUR although there might be some good promos e.g. some time ago there was a limited time offer for newly registered users for ETS Home or Lite.
Not sure if you can reverse engineer your system though. With demo ETS version you can monitor your KNX system and this might be good enough to get required info for HA integration.

Hassio to connect with Gira KNX RF :eyes:

Are there any examples of how the “New entity: text” can be used in combination with KNX?

If you have some kind of display next to your front door, you could leave some nice message for your loved ones from time to time :wink:
Other than that, I have no idea 🤷 but I’m sure someone will find a good use for it.

Has anyone tried secure routing yet?

Or are there any problems with the new ConfigFlow and OptionFlow (“Configure” button on HAs integrations panel)? Like eg. “Automatic” connection mode suddenly not available?

I have the following automation:

alias: EG Schlafen
description: ""
trigger:
  - platform: event
    event_type: knx_event
    event_data:
      destination: "0/7/0"
      direction: "Incoming"
condition: []
action:
  - service: light.turn_off
    target:
      entity_id: light.eg_alle
    data: {}
  - service: cover.close_cover
    target:
      entity_id: cover.eg_alle
    data: {}
mode: single

the action part works perfectly, when I trigger the automation manually through the frontend, however the trigger does not work at all.
I have a KNX button, when I press it it sends a 1 to the group address 0/7/0. I get this event in my ETS, so I know it is there. However, the group address is always on 1, as I never need to change it to something else - so this might by an issue. In my previous used system I just needed to add "enforce_updates: true" to my yaml file and it fired events also when the value was not changed. Is there something similiar in home assistant? If this is probably not my issue: do you have any ideas what I could try next?

solved: I missed to add the address to the knx event section in the configuration.yaml:

knx:
    event:
        - address:
            - "0/7/0"

I’m new to home assistant and wanted to check if I’ve done it right.

My roller shutters use DTP9.* for reading the position (response is between 0 (open) and 100,34 (closed)) and DTP5.001 (0-100%) for setting the position. Thus I had to convert the read shutter position (cover expects 5.001 for both values).

I created a virtual address with the correct DTP5.001 for the current position. In addition I also reversed the read value to reflect the correct position (opened/closed)

1st: read position, response will be between 0 and 100,34

  - sensor:
    - name: "Rolladenposition Küche"
      state_address: "2/0/13"
      type: "2byte_float"
      sync_state: "init"
      state_class: "measurement"

2nd: convert values (100 = 0 and 0=100):

template:
  - sensor:
      - name: "Rolladenpos Küche"
        state: >
          {% set val = states('sensor.rolladenposition_kuche') | float - 100 | round(0) | int  %}
          {{ val*-1 }}

3rd: expose new entity with value from 2nd step (dummy knx address, not known to ETS)

  expose:
    - type: percent
      entity_id: sensor.rolladenpos_kuche
      address: "2/0/130"

4th: define cover with new entity as position_state_address:

  cover:
    - name: "Rolladen Küche"
      move_long_address: "2/0/4"
      stop_address: "2/0/5"
      position_address: "2/0/12"
      position_state_address: "2/0/130"

If it works … its one way.

You are aware that the knx cover entity has an invert option.

See here.

Any particular reason to not just define a cover entity in knx?

You could try

        state: "{{ 100 - (states('sensor.rolladenposition_kuche') | int(0)) }}"

You may also use address: i-rolladenpos_kuche_percent in the expose and for position_state_address. The i- with some string appended denotes an internal GA - this is only used internally and never sent to the bus.

Other than that - the value returned from position_state_address has to match the value sent from position_address. So if you send 0% to the actuator it shall, at the end of travel return 0 on the state.

@airmax please tell me the manufacturer and model of this device so I never ever fall into the trap of buying a device from them :woozy_face:

1 Like

Hi All!

Thanks for all your contribution, this is soo helpfoul,
Im quite new to both KNX and HA but Im on my way understanding both :slight_smile:
Im trying to set up some minor functionality between HA and my KNX (Wiser KNX)

I have started to add in configuration yaml, the following
knx: !include /config/knx.yaml
and in the knx.yaml, I started to set up some minor things.

First I started with reading a temperature from KNX and it worked fine, but then I tried to add a switch. But for some reason that did not work at all?

  • Can any of you sharp minds see what is going wrong?
    I get error message “Invalid config for [knx]: [Switch] is an invalid option for [knx]. Check: knx->knx->Switch. (See /config/configuration.yaml, line 31).” when checking the configuration?
    ‘—knx.yaml----’
    sensor:
    ‘- name: “Badrum temp”’
    state_address: “2/1/21”
    type: temperature
    sync_state: every 30

    Switch:
    ’ - name: “Fasadbelysning Garage”’
    address: “5/0/11”
    state_address: “5/0/12”

Best regards
Lasse

Hi :wave:!

You should use lowercase switch:

Please use code tags for yaml ```

Hi Farmio!

But f* me, tanks sooo much for you Sharp eye :wink:
The need to take care of the upper and lower case in yaml is killing me.

Thank you so much
Best regards
Lasse