KNX Cookbook (legacy)

I’ve recently added a description to the send service basically quoting your post :wink: I think of this service more like a debug tool. Sending values to the bus ExposeSensor is the way to go for me.

The last update to cover that could have changed things was in Mar 2018. I have no cover device myself so I can just take guesses here.

From the HA cover template the behaviour you are describing is correct (but seems counterintuitive for me too):

class CoverDevice(Entity):
    """Representation of a cover."""

    @property
    def current_cover_position(self):
        """Return current position of cover.
        None is unknown, 0 is closed, 100 is fully open.
        """
        pass

I clearly see your point. Especially the fact that Expose is able to answer read requests on the KNX bus is far superior to the knx.send command (which sends only once).
My problem here is that I do most of my automations in Node Red. The Node Red add-on for HA so far has no way to write back values into HA sensors. But that would be needed to write to a sensor which is then exposed to KNX.
I think it would be possible to use an HA MQTT sensor and expose it to KNX. Node Red can send to MQTT. But that makes things complicated and bloated. The simple task of sending a value to a KNX group address would stretch from Node Red over MQTT into the HA config. This is clearly a limitation of the current Node Red add-on, not of the KNX integration. But for most of my purposes the knx.send service is just good enough. I mainly use it to update status GAs in KNX. For this there is rarely a need to support recurring read requests.

Oh yes, you are right. This clearly shows that the open–>100% association is by design. As you said it is quite counterintuitive. But I guess we can all live with that.

I don’t know Node Red, but isn’t there an implementation of knx especially for node red? So you wouldn’t have to convert to raw values by hand. Would be nice for floats


Eh. This one: https://github.com/Supergiovane/node-red-contrib-knx-ultimate

Any idea why KNX lights etc don’t show up in “Entities” of HA?

@gagga: No. What exactly have you done so far? Did you check the log for errors in the KNX integration?

@farmio: Sorry for the late reply. Great hint. I am using KNX ultimate for some time now and it works like a charm. To be honest: The KNX integration of HA still has its problems with inversions of cover positions. E.g. Alexa (coupled through Nabu Casa) lifts the cover when you say “cover X on”, lowers the covers with “off” and inverts percentage positions.

I have just had a look at the cover topic. Its a little bit awkward because HA defines 0% as closed whereas in KNX 0% is open. So a fully enabled most right slider on the default lovelace card means cover open. I have no idea who came up with that :upside_down_face:

@Jpsy Why do you say “cover on” and “cover off” instead of “up/down”? Is this some Alexa specific thing or do you have some sort of special covers? Anyhow if HA interprets your “off” as 0% it does what it is supposed to do - its just unintuitive (at least for us, it seems).

I have no actual covers yet to test things so I can just look at logs. :female_detective: If you like you can test the PR / fork: https://github.com/XKNX/xknx/pull/259

1 Like

I have a quick question : what exactly do I need to integrate with HA if I have 4 devices (air conditioning in my case) with knx adaptors. Is the knx - IP gateway all I need? Is there any good guide how to start from scratch with devices or if the box?

You will need a KNX IP gateway (or interface), a KNX bus power supply, KNX cable and connectors (black/red), the ETS software (the free demo version will work with up to 5 devices) and a Windows PC. Try YouTube for the basics.

1 Like

Great, thanks! Indeed there is lots of videos on youtube :slight_smile: So this is another journey ahead but seems not very complicated.

I have a question regarding the sensor. I find it cumbersome that for almost every sensor you need to add a template sensor for three things:

  • Limit precision
  • Set an icon
  • Add/change the units

Is there any chance this could be added to the integration and how would I go about requesting this?

Thomas

For the unit just configure the appropriate value type (see list in Knx sensor docs https://www.home-assistant.io/integrations/sensor.knx ).
The icons can be changed by costumizing the entity directly (some are set with value type through device_class too). https://www.home-assistant.io/docs/configuration/customizing-devices/

Unfortunately that is not quite true. There are several data types in KNX which are not supported by the integration, and for them I’m not sure how to add the unit otherwise.

Yes, but I prefer keeping everything together. I have a lot of integrations and having settings all over the place makes it very difficult to manage.

But I should have specified that my main problem is the precision. I have several sensors with up to 10 digits after the decimal sign which messes up the UI.

Thomas

The next version of xknx will bring a lot more types. https://github.com/XKNX/xknx/pull/255

For precision I have no idea. Eg temperature (dpt9) has up to 2 digits after . in my installation. Never seen 3 or more

It seems to happen with the floating point values where the lack of rounding can introduce unwanted decimals.

Thomas

“Any idea why KNX lights etc don’t show up in “Entities” of HA?”
This was fixed in 0.106:


Section: " Entities configuration panel now shows all entities"

Hi. Thanks for the very helpful information. I am beyond a novice on the KNX system–ours was set up by an integrator. I’m looking to install Home Assistant using a newly purchased GIRA KNX IP router 216700, and was trying to understand how I am meant to generate the yaml file for our setup. Is there any way to automate the conversion of the existing setup (is that an ETS database?) to the correctly formatted and fully-specified yaml?

Thanks

I’m afraid you’ll have to do this yourself.
The group addresses can’t be grouped to HA devices if your integrator didn’t use “functions” in your etsproj file. This is a quite new functionality meant for ETS-Inside so I guess it’s not that common.

I’d just have a read on the Knx integration docs and copy&paste from there. (I would not use xknx.yaml configuration but that’s my personal preference - functionality is the same despite docs saying it’s better for big installations)

MAybe as some inspiration and help, my KNX/Homeassistant is documented at:

1 Like

Very nice @moe! I will send you a PM with some questions and suggestions for additional info.

1 Like

@Jpsy Thanks for the feedback. Added a specific lovelace section and some more explanations.

:slight_smile:

1 Like