HomeAssistant as MQTT bridge to KNX

Hello
I have KNX at home, and use Gira HS/FS to control the system.

After discovering Hass, I would like to add additional visualization utilizing the hassio.
I have approx 20+ tasmotas, all saturating the KNX bus, so my plan is to convert all of them to MQTT.
After doing this, I found the hard way that KNX in HAss is not mature at all. There is no way to import knxproj (I tried Mathias ruby script - but it cannot even handle a simple DPT9001 type!!). My KNX has around 300+ addresses so manually is not going to cut it.

So, alternative for me is to use Hass as MQTT to KNX bridge, using it ONLY for Tasmotas
For Tasmotas only, how can I implement this -

  1. Everytime a Tasmota is online, enable object is started (say sensor enable 1/1/1 is 1 for 60sec. It becomes 0 if that Tasmota is offline) ← This is very important and is equivalent of greyed buttons when some MQTT is offline.
  2. Bidirectional MQTT to send/recv the KNX group address. Ex - 1/1/10 is relay1, 1/1/11 is relay 2 etc). If I send a MQTT command to switch on relay1, a 1 is sent to 1/1/10. Additionaly if I write 0 on 1/1/10, Hass should be able to read this and switch relay 1 off using MQTT.

I dont know about MQTT- so can anybody guide me how to implement the above.

Thank you

PS - Tasmota KNX implementation by Ascilto was flawless till my Tasmotas crossed a certain number. After that its just a hit or miss. MQTT is rock solid on Tasmota. KNX on Tasmota is very chatty and is not ok after 2-3 devices.

This will probably take 1-2 hours :person_shrugging:

1 Like

The KNX integration can handle DPT9001. It’s not possible to export entitiy configuration from a knxproj File since the devices in an KNX project do not match the Entities in Home Assistant.

You should read the documentation. KNX - Home Assistant

1 Like

Hello
See the cut and paste below from ONE fan controller (Its ABB FCA). I have 9 Fan controller + 9 ABB thermostats (6128s) + numerous others switches and dimmers. Other than the switch type (1.001), Mathias script was not able to import anything.

The reasoning of KNX isnt mature is after reading a lot on forums (Including mathias - who has this fantastic script which I tried to use - but it only works for him as he has dimmers).

Please comment on my main problem - How to make Hass as bridge of KNX and MQTT.

As per forum, the readers are disputing the KNX documentation as being too old and not updated.

W, [2022-05-04T17:50:31.181334 #1820] WARN – : 1/1/4(switch:4.001:Fan Speed Status): no mapping for datapoint 4.001
W, [2022-05-04T17:50:31.182164 #1820] WARN – : 1/1/6(switch:5.001:Fan Cool): no mapping for datapoint 5.001
W, [2022-05-04T17:50:31.182963 #1820] WARN – : 1/1/8(switch:9.001:Room Temp): no mapping for datapoint 9.001
W, [2022-05-04T17:50:31.184142 #1820] WARN – : 1/1/9(switch:9.001:Setpoint Temp): no mapping for datapoint 9.001
W, [2022-05-04T17:50:31.185286 #1820] WARN – : 1/1/7(switch:1.005:Drip Tray Alarm): no mapping for datapoint 1.005
W, [2022-05-04T17:50:31.186775 #1820] WARN – : 1/1/100(switch:9.001:Base Setpoint(Write)): no mapping for datapoint 9.001
W, [2022-05-04T17:50:31.189457 #1820] WARN – : 1/1/101(switch:1.024:Night Operation): no mapping for datapoint 1.024
W, [2022-05-04T17:50:31.192799 #1820] WARN – : 1/1/102(switch:1.024:Comfort operation): no mapping for datapoint 1.024
W, [2022-05-04T17:50:31.193830 #1820] WARN – : 1/1/104(switch:1.005:Valve Cool Error): no mapping for datapoint 1.005

Ahh- I read again - It is Laurent martins script (But Mathias has linked it in this forum)- My bad on mixing names up.

Is there a quick way to import? I have ETS as well as Gira Experte(Gira Experte will export it in xml, csv etc).

I am very new to Hass (Have been lurking in knx-forum.de as it is more KNX centric) and finding the steep curve of learning the MQTT and KNX syntax in Hass as too steep.

Just trying to understand your problem. What do you mean by 300+ addresses?
Physical addresses = KNX hardware devices or Group addresses?

300 PAs would be quite huge, but 300 GAs I would call a small setup and manually including would be faster than searching for an automated solution I think…

300GA in the ETS and approx 20 Tasmotas (with 5 average GA- as I dont import them in ETS)= 400.
I can do that (manual import) - to get a new visual(in addition to Gira), but my previous question remains unanswered (I tried search - but havent understood how entities work in HA)

Tasmota talks to HA(MQTT). HA updates the KNX bus as per Tasmota MQTT messages.
Steps understood -

  1. Expose all the GAs which are Tasmota specific.
  2. Match the entity of Tasmota MQTT to the GA(How?- I cannot find anything how its done)
  3. Read the KNX and match the GA to MQTT enitity (How?)

Spare the time searching for import scripts - there are none that output any up-to-date config schema.

The official HA KNX integration documentation (linked above by Marvin) is very well up to date and probably the only source you should rely on for yaml configuration. Forum threads and youtube videos are quickly outdated.

Read up on entities, they are the integral part of Home Assistant. You can connect different integrations entities via automations. In KNX there is a special construct to make this easier: expose

Hello
Got the basics sorted out - I am a KNX guy - so I know how groups etc work.
I fail to understand how the entities work in Hass.
I tried the “Developer Tools”->Set State → Entity Name (searched the entity name - my entity to test is switch.kc868_1).

But nothing happens.
How do i write to HA bus? (Or there is no way to test other than yaml files?)

The way I am trying is attached as screenshots.


Its a switch, so you have 2 options.

  • toggle it from HA by using either the UI (press the i and use the toggle - see screenshot) or from yaml (see documentation about services
  • toggle it form the integration its owned by - in this case Tasmota

both will yield a state_changed event on the HA event bus.

I wanted to test the names of entities before writing the yaml file (and check if the names I read are right). That is because it seems I have NO control what entities are named as I add them into HA.
There is no way to export the names (and print it for reading as I write the yaml files by hand)
I seem to understand that I have to take care of 300+ GA names and 300+ HA entity names?

Yes- I can do that using the screen you sent above - But there is no concept of accessing the internal HA bus? How do you debug the yaml files then? I cannot do this for 300+ GAs to test.

I am comparing it to ETS- To test I can write randomly on the knx bus and the actors on that address act accordingly. I want to write on HA bus to see the telegram on KNX bus (and vice versa). There is 1:1(or 1:many as GA) relation between actors and bus address.

I want to test each entity as I find there is NO standardization. I want to see the internal HA “telegrams” to see if I need to use the word ON/OFF or 1/0 to this entity. (eg - binary sensor)

I am really finding it hard (despite reading all documentation) how to connect the GA with an entity. All documentation I am reading is about sending the data on KNX bus or reading it off the bus (isnt it obvious? Anything you write on KNX bus should be readable by HA?). There is NO documentation on how to sync an entity on HA with KNX GA.

Either I am missing something obvious - or HA with KNX is an afterthought for a few GAs only. If I have to write yaml manually for 300+ GAs to read it and then expose(write on KNX bus) it again - thats easily 1800+ lines of text. Surely I am understanding it wrongly…

Additionally - If I remove an actor(tasmota) from HA and then re-add, every entity related to that is deleted and recreated as new names. This is the origin of my mistrust with entity names.
There seems to be no standard how entities are created.

I’d use copy&paste :person_shrugging:

You GA names don’t matter in HA. Entity names do - there is a default set by the integration the entity is created from. Then it can be changed from the UI (by using the cogwheel button you find on the screenshot I posted earlier).
In Knx one entity is created from multiple GAs, depending on the entity platform (sensor, climate, light etc.)

You can fire events, as described above, from the developer tools. If you call the turn_on service of a switch entity it will turn on. Not sure what exactly you are looking for.

The HA “telegrams” are called events, you can observe them from the developer tools. Try to listen for * for an example. (You can’t turn on/off a binary_sensor - it is read only).

Thats neither obvious nor true. HA and KNX are two different systems and you’ll have to configure what event you’d like to forward to the other and, in case of KNX, which GA and encoding (DPT) should be used.
There is documentation about that, and I have already shared a link to it in my previous post.

KNX is a HA integration like every other. There is no auto-discovery of devices/entities so it has to be configured. Same for Modbus etc.
I don’t get why you keep complaining and downplaying the efforts me myself and lots of other folks put into the KNX integration and HA in general. Its kind of rude. If you don’t like it feel free to choose an other system :person_shrugging:

I’m not sure why you would need to configure a KNX entity and expose it again - its value is already on the KNX bus… you only need to expose non-KNX entities if you need their state on the bus.

Regarding the Tasmota integration, I don’t know it so you may find someone else helping you. Every integration is responsible for how their devices/entities are created so this can vary slightly depending on implementation / possibilities.

Dear Mathias
I am in no way downplaying - Its my frustration of proper debugging tools not available for KNX in HA.
HA is a community project and integrates almost every automation available.

KNX in HA is not to the level of 1000E ETS(obviously), and I appreciate the efforts community has put in.

Coming to the help in your answers - My frustration came when I was unable to fire a binary sensor event in the way you have described. There is a caveat that “nothing happens if the entity is part of a device”. Its there in my screenshot also. Till now I am unable to switch on this binary switch (KC868-1) using the event bus. From Lovelace - yes - But from event bus - There seems to be no way (making me deduce that event bus isnt available for everything). As I am unable to access my first binary sensor/switch on the event bus - I shudder when I have 300+ addresses to debug further.

I still cannot understand (even after your effort of trying to explain) that how do I sync KC868-1 to a GA address (say 1/1/1). The entity named KC868-1 is available on bus but NOTHING happens when I write on or off to it (using the screen above).

Quote
You can fire events, as described above, from the developer tools. If you call the turn_on service of a switch entity it will turn on. Not sure what exactly you are looking for.
Unquote
I have tried both switch.kc868_1 and KC868_1. Writing to these using developer page does nothing. How do I set the switch.kc868_1 to ON (not using lovelace) and fire and even which writes 1 to 1/1/1.
How do I switch.kc868_1 to off when 1/1/1 becomes 0.

Try this if it is a switch (don’t know if it is possible for a binary_sensor): Open your Home Assistant instance and show your service developer tools with a specific service selected.
You may also try the more generic homeassistant.turn_on service.

Use knx_event as a trigger for an automation. See KNX Events on how to register and use those.

Dear mathias
I am Late in reply - But your response above put me in right direction.

I needed to debug (actually see the telegrams on KNX bus and match with MQTT explorer).
So, I am already half way there, been able to integrate a basic switch in Gira HS/FS (Gira HS/FS talks to HA in mqtt).

Compared to other half baked KNX implementations in other platforms, I was surprised to see almost all Data types supported by HA but the caveat is - everything needs to be done by hand.

I was able to put up a basic climate control too - But found that like all German solutions- There is no fan control. My setup is ABB 6128 Thermostat(and switch) + ABB FCU. Instead of automatic, we use 3 fan speeds. This kind of setup seems uncommon in Europe - So it seems I cannot do it HA (I tried fan controller). Any pointers?

A fan entity should be able to control this (but I think it translates to percent. A number or select entity can definitely do it.
You may even use these in conjunction with a template climate entity.

I tried that - But It will require something in HA (writing some code which I dont know here).
ABB Fan controllers usually have different GA for Speed up/Down, Speed 1, Speed2, Speed 3 etc.
I am finding it difficult to do this in HA.
Will keep on trying.

:thinking: if every speed has a different GA maybe use 3 Button entities. Or some template with knx.send service.

Hello
(Separate issue from above of climate)
Can you babysit me in switching a tasmota ifan02 when 1/0 is received on 6/1/23.
Tasmota is mqtt (and no knx).

I am also unable to understand yaml tabs, indents, and spaces. There seems to be some magic there which isnt documented (and needs to be tried with hit and miss)

This is the relevant part, which is NOT working-
expose:
#FAN
fan:
- name: “XXX Fan”
address: “6/1/23”
state_address: “6/1/25”
max_step: 3

#Automation

automation:

  • alias: “Switch Fan On”

    • trigger:
      platform: event
      event_type: knx_event
      event_data:
      address: ‘6/1/23’
      data: 1
      action:
      service: fan.turn_on
      entity_id: fan.xxxfan
  • alias: “Switch Fan Off”
    trigger:
    platform: event
    event_type: knx_event
    event_data:
    address: ‘6/1/23’
    data: 0
    action:
    service: fan.turn_off
    entity_id: fan.xxxfan

Additionally, I have a GA (6/1/25) which should be turned on or off if the device is not existing on network. (On lovelace, the device is greyed out as it becomes unavailable - I want to send a GA as 1 every 1m as keep alive so that KNX knows that the device exists)

thank you