Help needed to configure cheap 433 Mhz door contact

Hi,

I am trying to install a cheap door contact (https://www.clasohlson.com/se/Magnetkontakt-Cotech-Smart-Home/36-6048) following the instructions here:
https://www.home-assistant.io/components/binary_sensor.rfxtrx/
When using the automatic add, HA detects and add the contact…but then fails to recognize it from there since it seems to change ID. I tried to follow the steps in “Options for PT-2262 devices under the Lighting4 protocol”
to detect the on/off signal but I can not get my head around it. I see a pattern in the way the device is “presenting itself” but I am totally lost how to configure it. See extract from the logs showing open/close multiple times… I am using the RfxCom USB controller if that shoud matter…
Please help.

br
Kazze

2018-03-26 23:02:42 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130000969220017a70)
2018-03-26 23:02:44 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130001969220017a70)
2018-03-26 23:02:48 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130002969220017a70)
2018-03-26 23:02:50 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9e16b0 Class: LightingDevice Sub: 0, Pkt_id: 091300039e16b0017a70)
2018-03-26 23:02:53 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130004969220017a70)
2018-03-26 23:02:54 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130005969220017a70)
2018-03-26 23:02:58 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130006969220017a70)
2018-03-26 23:03:00 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130007969220017770)
2018-03-26 23:03:03 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130008969220017a70)
2018-03-26 23:03:09 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130009969220017a70)
2018-03-26 23:03:11 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9e16b0 Class: LightingDevice Sub: 0, Pkt_id: 0913000a9e16b0017e70)
2018-03-26 23:03:14 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9c7890 Class: LightingDevice Sub: 0, Pkt_id: 0913000b9c7890017c70)
2018-03-26 23:03:16 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 98b440 Class: LightingDevice Sub: 0, Pkt_id: 0913000c98b440017770)
2018-03-26 23:03:18 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 0913000d969220017c70)
2018-03-26 23:03:20 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9e16b0 Class: LightingDevice Sub: 0, Pkt_id: 0913000e9e16b0017a70)
2018-03-26 23:03:22 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9c7890 Class: LightingDevice Sub: 0, Pkt_id: 0913000f9c7890017a70)
2018-03-26 23:03:25 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 98b440 Class: LightingDevice Sub: 0, Pkt_id: 0913001098b440017a70)
2018-03-26 23:03:27 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130011969220017c70)
2018-03-26 23:03:29 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9e16b0 Class: LightingDevice Sub: 0, Pkt_id: 091300129e16b0017a70)
2018-03-26 23:03:31 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9c7890 Class: LightingDevice Sub: 0, Pkt_id: 091300139c7890017a70)
2018-03-26 23:03:33 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 98b440 Class: LightingDevice Sub: 0, Pkt_id: 0913001498b440017a70)
2018-03-26 23:03:35 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130015969220017a70)
2018-03-26 23:03:38 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9e16b0 Class: LightingDevice Sub: 0, Pkt_id: 091300169e16b0017a70)
2018-03-26 23:03:40 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9c7890 Class: LightingDevice Sub: 0, Pkt_id: 091300179c7890017c70)
2018-03-26 23:03:42 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 98b440 Class: LightingDevice Sub: 0, Pkt_id: 0913001898b440017c70)
2018-03-26 23:03:44 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 0913001a969220017a70)
2018-03-26 23:03:46 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9e16b0 Class: LightingDevice Sub: 0, Pkt_id: 0913001b9e16b0017a70)
2018-03-26 23:03:48 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9c7890 Class: LightingDevice Sub: 0, Pkt_id: 0913001c9c7890017770)
2018-03-26 23:03:50 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 98b440 Class: LightingDevice Sub: 0, Pkt_id: 0913001d98b440017a70)
2018-03-26 23:03:52 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 0913001e969220017a70)
2018-03-26 23:03:55 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9e16b0 Class: LightingDevice Sub: 0, Pkt_id: 0913001f9e16b0017a70)
2018-03-26 23:03:57 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9c7890 Class: LightingDevice Sub: 0, Pkt_id: 091300209c7890017a70)
2018-03-26 23:03:59 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 98b440 Class: LightingDevice Sub: 0, Pkt_id: 0913002198b440017c70)
2018-03-26 23:04:00 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130022969220017a70)

One of the Pkt_id should be the one you need to manually register your sensor
update your config as follows:

- platform: rfxtrx
  automatic_add: True
  devices:
    [insert pkt_id here]:
      name: Door Sensor
      device_class: opening

If that doesn’t work, you may need to set your logs to debug for the RFX to get more data, when you open/close you should see the device ID:

logger:
  default: error
  logs:
    homeassistant.components.rfxtrx: debug

Thanks a lot, I will try it tonight and post the results.

You cannot use the full packet because there is an incrementing sequence number in the RFXtrx packets.

09130000969220017A70 decodes as:
Packettype = Lighting4
subtype = PT2262
Sequence nbr = 0
Code = 969220 decimal:9867808
S1- S24 = 1001 0110 1001 0010 0010 0000
Pulse = 378 usec
Signal level = 7 -64dBm

Important parts in the packet are:
1300 = Lighting4 - PT2262
00 = packet number (next RFXtrx packet this will be 01)
969220 = ID of the PT2262

Hi again,

so here is an update: ‘binary sensor’ does not seem to be the way to go. But if I configure automatic add for the rfxtrx controll for SWITCH (not binary sensor as before) I get 4 different switches added (as shown in the logs below) - 2 for ‘open’ and 2 for ‘close’.
Then you can clearly see that HA ‘recognizes’ the device but not the command itself (“unknown command”). The strange part here is that the command itself is refering to what the row above calls ‘device_id’, of which there are
4 unique, one for each state (i.e. open/close). I should mention that I am using Domoticz for home automation since before and Domoticz is able to detect this device properly.
Question: Is there a way to write something like:

if Pkt_id contains (or even ‘startsWith’) “09130006” and Device_id in (98b440, 9e16b0) then set a virtual door/switch/switch to ‘open’
else if Device_id in (96922, 9c7890) then set to ‘closed’ ?


2018-03-28 21:34:43 WARNING (MainThread) [homeassistant.bootstrap] Python 3.4 support has been deprecated and will be removed in the beginning of 2018. Please upgrade Python or your operating system. More info: https://home-assistant.io/blog/2017/10/06/deprecating-python-3.4-support/
2018-03-28 21:35:05 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 98b440 Class: LightingDevice Sub: 0, Pkt_id: 0913000198b440017a70)
2018-03-28 21:35:05 INFO (Thread-12) [homeassistant.components.rfxtrx] Automatic add 98b440 rfxtrx device (Class: LightingDevice Sub: 0 Packet_id: 0913000198b440017a70)
2018-03-28 21:35:05 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 98b440 device_update. Command: Unknown command (0x98b440)
2018-03-28 21:35:09 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130002969220017a70)
2018-03-28 21:35:09 INFO (Thread-12) [homeassistant.components.rfxtrx] Automatic add 969220 rfxtrx device (Class: LightingDevice Sub: 0 Packet_id: 09130002969220017a70)
2018-03-28 21:35:09 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 969220 device_update. Command: Unknown command (0x969220)
2018-03-28 21:35:14 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9e16b0 Class: LightingDevice Sub: 0, Pkt_id: 091300039e16b0017a70)
2018-03-28 21:35:14 INFO (Thread-12) [homeassistant.components.rfxtrx] Automatic add 9e16b0 rfxtrx device (Class: LightingDevice Sub: 0 Packet_id: 091300039e16b0017a70)
2018-03-28 21:35:14 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 9e16b0 device_update. Command: Unknown command (0x9e16b0)
2018-03-28 21:35:18 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9c7890 Class: LightingDevice Sub: 0, Pkt_id: 091300049c7890017a70)
2018-03-28 21:35:18 INFO (Thread-12) [homeassistant.components.rfxtrx] Automatic add 9c7890 rfxtrx device (Class: LightingDevice Sub: 0 Packet_id: 091300049c7890017a70)
2018-03-28 21:35:18 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 9c7890 device_update. Command: Unknown command (0x9c7890)
2018-03-28 21:35:24 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 98b440 Class: LightingDevice Sub: 0, Pkt_id: 0913000698b440017a70)
2018-03-28 21:35:24 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 98b440 device_update. Command: Unknown command (0x98b440)
2018-03-28 21:35:28 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 09130007969220017a70)
2018-03-28 21:35:28 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 969220 device_update. Command: Unknown command (0x969220)
2018-03-28 21:35:32 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9e16b0 Class: LightingDevice Sub: 0, Pkt_id: 091300089e16b0017a70)
2018-03-28 21:35:32 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 9e16b0 device_update. Command: Unknown command (0x9e16b0)
2018-03-28 21:35:36 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9c7890 Class: LightingDevice Sub: 0, Pkt_id: 091300099c7890017a70)
2018-03-28 21:35:36 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 9c7890 device_update. Command: Unknown command (0x9c7890)
2018-03-28 21:35:39 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 98b440 Class: LightingDevice Sub: 0, Pkt_id: 0913000a98b440017770)
2018-03-28 21:35:39 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 98b440 device_update. Command: Unknown command (0x98b440)
2018-03-28 21:35:41 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 969220 Class: LightingDevice Sub: 0, Pkt_id: 0913000b969220017a70)
2018-03-28 21:35:41 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 969220 device_update. Command: Unknown command (0x969220)
2018-03-28 21:35:44 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9e16b0 Class: LightingDevice Sub: 0, Pkt_id: 0913000c9e16b0017a70)
2018-03-28 21:35:44 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 9e16b0 device_update. Command: Unknown command (0x9e16b0)
2018-03-28 21:35:47 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 9c7890 Class: LightingDevice Sub: 0, Pkt_id: 0913000d9c7890017a70)
2018-03-28 21:35:47 DEBUG (Thread-12) [homeassistant.components.rfxtrx] Device_id: 9c7890 device_update. Command: Unknown command (0x9c7890)

Thanks for your time and advice!

Having the same issue, any pointers would be appreciated!

Hi kazze and alexcf, did you finally manage to have your door contact recognized as binary sensor?

I’m trying to let HA recognize my 433MHz KERUI P829 motion detector and get a similar error as you.

My binary sensor rfxtrx config looks as follows:

binary_sensor:
  platform: rfxtrx
  automatic_add: True

The other rfxtrx sensor types (switch, sensor) have their option “automatic_add” set to False

This is the DEBUG output I get in the HA log file:

2018-09-16 08:43:07 INFO (Thread-2) [homeassistant.components.binary_sensor.rfxtrx] Added binary sensor 09130038df784a00da70 (Device ID: df784a Class: LightingDevice Sub: 0)
2018-09-16 08:43:07 DEBUG (Thread-2) [homeassistant.components.rfxtrx] Device_id: df784a device_update. Command: Unknown command (0xdf784a)

The binary sensor is actually added and visible on the HA UI and has state on, but the state is never updated
image

I found one more post related this topic but without replies: add-remote-led-single-color-dimmer-with-rfx

Is there anyone who can point me to the next best step to take in debugging?

Any help is appreciated!

I’m running HA version 0.77.3

Hi guys,

unfortunately I gave up HA, this was my second try to setup HA and learn it in more detail. Since script languages are not my preferred weapon, this is a dead-end for me now (especially since this device is detected and configured properly by Domoticz). But I am monitoring this thread and I would gladly test it again if somebody else finds something useful.

br
Kazze

Good news, I managed to configure the PT2262 device in HA

The problem was that:

  • I don’t know much about protocols yet
  • I didn’t know if my device was sending an ‘off’ command, and so I didn’t know if I had to configure the command_off property

So I started playing with RFXmngr.exe that comes with the rfxcom transceiver and triggered both motion and tamper alarm with my motion detector.

With Lighting4 and X10 enabled I triggered motion and alarm and received following 2 packages:

With Lighting4 and X10 enabled
18-9-2018 12:28:28:292
Packettype    = Security1
subtype       = X10 security
Sequence nbr  = 30
id1-3         = DF7840 decimal:14645312
status        = Motion
battery level = OK
Signal level  = 7  -64dBm
------------------------------------------------

18-9-2018 12:33:29:424
Packettype    = Security1
subtype       = X10 security
Sequence nbr  = 85
id1-3         = DF7840 decimal:14645312
status        = Alarm + Tamper
battery level = OK
Signal level  = 7  -64dBm
------------------------------------------------

I’m not sure if it means something, but the id1-3 is the same for both motion and alarm, while I expected them to be unique

With Lighting4 enabled and X10 disabled I triggered motion and alarm and received following 2 packages:

With Lighting4 enabled and X10 disabled
18-9-2018 12:28:41:482
Packettype    = Lighting4
subtype       = PT2262
Sequence nbr  = 32
Code          = DF784A decimal:14645322
S1- S24  = 1101 1111 0111 1000 0100 1010
Pulse         = 313 usec
Signal level  = 7  -64dBm
------------------------------------------------


18-9-2018 09:13:29:237
Packettype    = Lighting4
subtype       = PT2262
Sequence nbr  = 54
Code          = DF784B decimal:14645323
S1- S24  = 1101 1111 0111 1000 0100 1011
Pulse         = 313 usec
Signal level  = 7  -64dBm
------------------------------------------------

Now I was clearly seeing two id’s. One for motion DF784A and one for alarm DF784B. The one for motion I recognized seeing in HA before. I liked the idea of unique id’s so I chose to keep X10 disabled at least during integration with HA.

It turned out that HA correctly recognized DF784A before and I just had to mark the letter A as command_on for motion and letter B as command_on for alarm (or problem). I also looked up the device id’s again on the dev states page and configured them as devices:

binary_sensor:
  platform: rfxtrx
  automatic_add: false
  devices:
    09130029df784a013670:
      name: sensor_berging_beweging
      device_class: motion
      off_delay:
        seconds: 5
      data_bits: 4
      command_on: 0xa
    09130073df784b013970:
      name: sensor_berging_sabotage
      device_class: problem
      off_delay:
        seconds: 5
      data_bits: 4
      command_on: 0xb

Using this configuration the motion sensor is correctly firing for both movement and alarm in my case.

Note:

  1. I’m not sure if I really had to disable the X10 protocol.
  2. The binary sensor update message is still shown in the logs, but does not seem to affect the detection of motion or alarm

Results:

no motion
2018-09-18%2013-10-30_rrtpa_

with motion,
2018-09-18%2013-10-35_kswrz_

1 Like

This is really good news, I will start all over with my testing as soon as I get a new installation in place and update my results, thanks for sharing!!

/Kazze

Ok, so I also managed to get my door contact working. I enabled debug logging and disabled X10 protocol (as suggested earlier, just to be sure) and started to monitor. It showed that there was a limited number of id’s after all (16!).
0913000 1 98b440017a70
0913000 2 969220017c70
0913000 3 9e16b0017a70
0913000 4 9c7890017c70

0913000 6 98b440018a70
0913000 7 969220017770
0913000 8 9e16b0017a70
0913000 9 9c7890017a70

0913000 a 98b440017a70
0913000 b 969220017c70
0913000 c 9e16b0017c70
0913000 d 9c7890017a70

0913000 e 98b440017a70
0913000 f 969220017a70
0913001 0 9e16b0017a70
0913001 1 9c7890017770
After adding these (all) as binary sensors, somehow Homeassistant picked up only the 4 top ones (weird) but those react as expected (2 for close and 2 for open). After deleting the ones that are obviously not used (12) it still works (and it actually works like in Domoticz). Now I just have to figure out how templates and stuff works, the syntax to configure devices in Homeassistant is not trivial for newbies ;-). The idea is to replace (hide the ‘original’ devices) with one 'door-icon" virtual device and make it react to the open/close devices above. My first tries so far have been futile :slight_smile:
Thanks for all your input!