Rfxtrx ID & Unit code

I have a built in lighting2 AC (Klik Aan klik uit) switch built in to an outlet.
In domoticz this unit has
ID
0010203
And unit code
5

I was wondering how this could be translated to the device codes home assistant uses? I could train a new code in the switch but i really don’t want to open the wall :slight_smile:

Good question, I’d like to know as well!

Enable auto add for rfxtrx switch:

switch:
  platform: rfxtrx
  automatic_add: True

Push your switch and it you shold be auto added to HA.

More information: https://home-assistant.io/components/switch.rfxtrx/

i’m sorry. it called it a switch, but technically it’s a receiver.
The receiver itself doens’t emit a signal it only receives it and switches on the light.
so the auto add doenst work with these…
http://www.klikaanklikuit.nl/shop/nl/fileuploader/download/download/?d=0&file=custom%2Fupload%2FFile-1412756217.pdf

You can ‘learn’ it up to six different remote codes.
But i only programmed one.

Ok, do you have remote control or how do you control it to day?

i used to control it with domoticz.
I added a device in domoticz with the ID and unit ID in my first post and paired it with that code.

Ok, then you are probably not able to trigger it from domoticz and lissen for the signal in HA at the same time?

nope, because i only have one rfxcom transceiver.

I see.
Then i do not know any easy way to fix your problem.

It should be possible to convert your id to the one used in HA.
A good starting point is: https://github.com/Danielhiversen/pyRFXtrx/blob/master/RFXtrx/lowlevel.py#L439

Ok, i wil try i can find something out. (not to hopefull as my programming skills are really basic).

for reference, this a comparisson between the domoticz ID’s and unitcodes and the home-assistant ones for the remote codes i receivced:

**Remote:**
Domoticz:                     0BCF2A2 1
HomeAssistant:                0b11003b00bcf2a201010f60
Domoticz:                     0BCF2A2 2
HomeAssistant:                0b11003e00bcf2a202010f60
Domoticz:                     0BCF2A2 3
HomeAssistant:                0b11003f00bcf2a203010f60

**Motion sensor:**
Domoticz:                     0B4C65E 10
HomeAssistant:                0b11002f00b4c65e0a010f50

Could it be this?
0BCF2A2 1 (domotciz)
0b11003b00bcf2a201010f60 (homeassistant)

prefix:  0b11003b0
deviceid: 0bcf2a2
unit id: 01
affix: 0f60

is the prefix and affix devicetype dependend?

Prefix:
0b is the length of the datapacket
11 means Lighting2
00 means subtype AC

self.packetlength = data[0] self.packettype = data[1] self.subtype = data[2] self.seqnbr = data[3] self.id1 = data[4] self.id2 = data[5] self.id3 = data[6] self.id4 = data[7] self.id_combined = (self.id1 << 24) + (self.id2 << 16) \ + (self.id3 << 8) + self.id4 self.unitcode = data[8] self.cmnd = data[9] self.level = data[10] self.rssi_byte = data[11]

So you can try to add:

0b11003b001020305010f60

1 Like

That worked! I added a zero somewhere but it works! Thank you!

I am also using a RFXtrx433E with some KaKu plugs i have lying, besides my Z-Wave stuff.

I have learned the outlets the code from the remote and that code is picked up by HASS so i can control the plugs with HASS and/or remote. However, my remote has only 3 groups. But what if i want to add more plugs? Does anyone have a jinja template code to generate a random ID? I imagine that when adding a randomly created code and pressing ‘on’ when the outlet is in pairing mode, it will learn that code and we’re done.

I looked at the ‘self.’ part above, but can’t figure out completely how the message is set-up. The three switches that were auto-added from my remote are like this:
switch.0b11000500bc0cfe01010f70 switch.0b11000600bc0cfe02010f70 switch.0b11000700bc0cfe03010f70

I was thinking about a template like this:
0b11000{{ range(0,700) | random | int }}bc0cfe0{{ range(0,10) | random | int }}010f70
and it works! when creating a switch with the output code from it and then pressing the ‘on’ button in the GUI when the outlet is in learning mode. But i don’t think it is random enough, what do you think?

Sorry to resurrect an ancient thread but I have a dimmer switch with no remote. The normal “switch” template in the docs doesn’t work - and I can’t find one for a “light” - can you help?

This is literally the only reason my Vera is still about. Might just bite the bullet and put £300 worth of Hue GU10s in here just to not use 433 :wink: