Rfxtrx documentation unclear, not clear how to configure somfy RTS blinds as covers

I’m trying to configure my 3 somfy blinds using rfxtrx, I’ve gotten it to kind-of work, but I don’t understand it fully yet. When I do, I want to update the documentation to make it easier for others too. There seems to have been a change in how this should be configured (the “platforms”-way of configuring no longer works), so many other posts on the forum have outdated info, which complicates it even further.

I used RFXmngr on my desktop (with the RFXtrx433XL module connected over USB) to configure my brand new RFXtrx433XL so it has 3 remote entries (defined by an ID + unit code), one for each blind. After linking the RFXtrx433XL device to my blinds, I attached the RFXtrx433XL to my Raspberry PI 3 running Home Assistant so it can control the blinds by knowing the ID’s + unit code.

The 3 blinds all have the ID “010101”, unit code 1 through 3:

blind 1: 071a000001010101
blind 2: 071a000001010102
blind 3: 071a000001010103

Let’s see how we can get this working according to the docs.

device
The docs about setting up the serial connection with the device config variable are clear:
device

It’s working (I can control the blinds using the RFXtrx433XL module), but (Question 1) I don’t understand why I can’t see that /dev/ttyUSB0 entry, nor a entry in /dev/serial (I guess that ttyUSB0 is hard-linked to the 1 of the 4 USB ports on the RBPI, and that linking to the device by ID is more robust):

➜  config ls -al /dev/tty*
crw-rw-rw-    1 root     root        5,   0 Sep  5 16:59 /dev/tty
crw-rw----    1 root     audio     204,  64 Sep  5 16:59 /dev/ttyAMA0
➜  config ls -al /dev/serial/
ls: /dev/serial/: No such file or directory

devices
According to the devices section, it should contain an EVENT_CODE, which can contain a device_class:
devices

But in the RFY section under covers (h_ttps://www.home-assistant.io/integrations/rfxtrx#covers), the EVENT_CODE is not mentioned anymore, instead, it says

add a device to the configuration with the following id 071a0000[id][unit_code]

Question 2: I guess that EVENT_CODE and device id refer to the same concept, right?

Either way, this makes me think this config should work:

rfxtrx:
  device: /dev/ttyUSB0
  devices:
    # blind 1
    "071a000001010101":
    # blind 2
    "071a000001010102":
    # blind 3
    "071a000001010103":

Great success, I get some “covers” in the (default) dashboard for the blinds, and the controls are working, so far so good. However, I seem to get 3 device types by default for each blind: a binary_sensor, a switch, and a blind:

Creating a quick lovelace dashboard for the first blind, this is what I get:
dashboard

It’s not clear to me why I get these 3 by default, since (I think) only the “cover” type makes sense.

Looking at the docs again, I think I need the device_class:
device_class

However, the docs confuse me. The first link goes to a page about customizing device classes, but the second link goes to a specific page about customizing the binary_sensor.

The first link makes more sense, which says:
device_class

Since I’m interested in the cover, I click on the cover link. It looks like this:

This makes me conclude that “blind” should be supported for covers, I adapt my config to this:

rfxtrx:
  device: /dev/ttyUSB0
  devices:
    # blind 1
    "071a000001010101":
      device_class: blind
    # blind 2
    "071a000001010102":
      friendly_name: friendly blind 2
    # blind 3
    "071a000001010103":

But when I check the config, it says:

Invalid config for [rfxtrx]: extra keys not allowed @ data['rfxtrx']['devices']['071a000001010102']['friendly_name']. Got 'friendly blind 2'
value is not allowed for dictionary value @ data['rfxtrx']['devices']['071a000001010101']['device_class']. Got 'blind'. (See /config/configuration.yaml, line 39). 

So:

Thanks!

2 Likes

Although contributions are appreciated, I would hold off a bit with reworking the documentation. I am reworking the integration to be able to do everything through UI and also change the documentation for that (https://github.com/home-assistant/core/pull/39117).

W.r.t your questions:

  • Question 1: I’m not sure why it doesn’t show up here. This is anyway after above mentioned changes not relevant, after configuration flow is done, you will see a list with detected serial devices including RFXCom once you add it through the UI.
  • Question 2: Yes, it could have probably better been add a device to the configuration with the following event code.
  • Question 3: They will always be added by the integration. The reason is that based on an event code, the integration needs to decide which entities are needed, but the protocol isn’t that well defined. For somy (rfy), an event code could belong to screens/blinds (for which the cover entity is created) or it could belong to a sun automation switch (for which the switch is created). I’m not sure why the binary sensor is there. On the integration page, you can disable unwanted entities.
  • Question 4: The friendly_name key is not supported by the rfxtrx integration, which is why you are getting an error. You also don’t need the key as you can give the entities friendly names through the UI. The device_class should be set through customization, which means it shouldn’t be part of the rfxtrx configuration. You can do the customization through the UI as well (Configuration > Customization).

Hope this helps you a bit further.

1 Like

Thanks for the info!

  • Q1: can’t reproduce, so never mind, I now (after a few reboots and an upgrade) do have both entries in /dev:
➜  ~ ls -al /dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO4GXD43-if00-port0
crw-rw----    1 root     audio     188,   0 Sep 12 18:14 /dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO4GXD43-if00-port0
➜  ~ ls -al /dev/ttyUSB0
crw-rw----    1 root     audio     188,   0 Sep 12 18:14 /dev/ttyUSB0
  • Q2: indeed. Should I do a PR to improve the docs?
  • Q3: thanks, I have disabled them, looking better!

  • Q4: perfect, works like a charm through the UI

I’ll take a look at your PR, maybe I can help you test it.

If you want you can make a PR for that. It’s a small change and if you think it’ll help people it can be worth it.

You can change more if you want, just wanted to give you a heads up of what’s coming

@marnikvde

Although not having blinds, I ran into all the same problems as you did configuring rfxtrx. It feels strange to have 3 entity types now where before configuring the device id into the correct yaml file (switches.yaml, binary_sensors.yaml and sensors.yaml) did work fine not creating unexpected entities. One step back ro make 2 forward?

In my configuration.yaml I use device_class and it is working fine, i.e.:

rfxtrx:
  device: /dev/serial/by-id/usb-RFXCOM_RFXtrx433_XXXXXXXX-if00-port0
  devices:
    #binary_sensors
    0b110001003fb6930a000f40:
      device_class: door

In your yaml you have quotes around the device id, which I think are not needed because it includes a letter. Also your spaces seems to be off one position or is that due to the “?

Regards
OWK