RFXTRX - Setting up lights

I’m having trouble setting up the rfxtrx integration for my RFXCOM 433 MHz transceiver.

With configuration:

rfxtrx:
  device: /dev/ttyUSB0
  debug: true
  automatic_add: false

I see that with button presses on my KlikAanKlikUit remote, devices are automatically added to HA under ARC_B1, ARC_B2 , ARC_B3 (binary_sensor, rssi sensor and switch entity, one of each for each address).
The HA debug logs also show the received signal format:

RFXTRX: Recv: 0x07 0x10 0x01 0x00 0x42 0x02 0x01 0x50

With the switch entities I am able to toggle toggle the lights in my KlikAanKlikUit sockets through HA.
So far, so good :slight_smile:

Now that the devices are added i set automatic_add to false and restart HA.
Unfortunately i see that all the previously added entities start up with state ‘unavailable’ and ‘restored: true’.
In the HA log i get an error:

2020-08-23 12:19:59 ERROR (MainThread) [homeassistant.setup] Error during setup of component rfxtrx
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 191, in _async_setup_component
    result = await task
  File "/usr/src/homeassistant/homeassistant/components/rfxtrx/__init__.py", line 158, in async_setup
    event.device, data_bits=event_config.get(CONF_DATA_BITS)
AttributeError: 'NoneType' object has no attribute 'device'

The integration documentation mentions that the integration allows a devices configuration.
I am not sure how to use this.

I tried the following configuration (based on the received signals):

rfxtrx:
  device: /dev/ttyUSB0
  debug: true
  automatic_add: false
  devices:  
    0710010242030070:
    0710010342020070:

But it has no effect.

The weird thing here is that the format of the signals is much different to the examples in the documentation (much shorter ID and not hex but only digits).
It tried also to place quotes around the device ID’s (as they could be parsed as numbers), but it had no effect.

Documentation also does not explain how to configure an entity as a (non-dimmable) light, instead of a switch. This would be my preference as it matches with my use-case.

Anyone out here who got this to work?
Any help would be kindly appreciated :slight_smile:

Ah, I just found this topic from someone who was exactly the same problem.
Turns out there is an open issue about this as well.

My bad, this question can be closed :slight_smile:

Is it the same? The open issue is about lights being detected as switches. As far as I can read, you have device codes that don’t work at all right?

Yup thats right.
But from the people who posted their config in the issue thread i saw that the device ID was indeed supposed to be between quotes.
Also i saw that signal_repetitions was provided, which i never even thought of.
The latter fixed the problem for me.

I still would like the entities to be mapped as lights instead of switches, but let’s get back to that in a while…

Change:

0710010242030070

to

0710010242030270

And you have them as lights. If you flip in the same position for other devices the code to 02, you have those as light as well.