Chuango door sensor via RFXtrx433XL

that’s probably because you added it as a switch instead of a binary_sensor…

Hi lolouk44,

Thanks for that bit of info. I can find very little information in the internet about how to arrange this properly, which is probably why I’m making rather newbie mistakes. I’ve changed the configuration to:

rfxtrx:
  device: /dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO3ZUL2A-if00-port0
  debug: true

switch:
  platform: rfxtrx
  automatic_add: false

binary_sensor:
  platform: rfxtrx
  devices:
    '082000122198900279':
      name: Chuango Door Sensor

The device id is the last id that I got from opening the door, then checking the log. The sensor is now correctly shown as a binary sensor (a circle icon), but doesn’t respond to opening and closing the door.

Am I making another mistake?

I have retained the switch with automatic_add as false, and added another element called binary_sensor that contains the device. This does follow a different format from what I’ve seen online regarding the RfxTrx443XL configurations.

Remove the switch bit since you’ve got nothing declared in there
Add the automatic_add: true in the binary_sensor section:

binary_sensor:
  platform: rfxtrx
  automatic_add: true
  devices:
    '082000122198900279':
      name: Chuango Door Sensor

Restart HA
This should add the door sensor automatically as you open/close it
You will see a new device listed like binary_sensor.082000122198900279
Copy the id and replace it in the binary_sensor definition above, then restart HA

I’ve done as you asked, removing the switch bit and moving the automatic add to the binary_sensor. My config now reads:

rfxtrx:
  device: /dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO3ZUL2A-if00-port0
  debug: true

binary_sensor:
  platform: rfxtrx
  automatic_add: true
  devices:
    08200002219d900279:
      name: Chuango Kitchen Door

I’ve restarted HA and then open and closed the (kitchen) door. The documentation and your reply state that the new sensor should be visible in HA, but it doesn’t get added. Do you know any reason why this could be the case?

I’m not sure to be honest, it looks like you have lightning4 enabled since you’re getting data in the logs (provided the log entry is the data from your sensor)
The sensor should therefore automatically be added…

I’ve restarted hass via the CLI, having set the following configuration:

rfxtrx:
  device: /dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO3ZUL2A-if00-port0
  debug: true
  dummy: false


binary_sensor:
  platform: rfxtrx
  automatic_add: true

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

It results in the following output in the CLI:

RFXTRX: Send: 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
RFXTRX: Send: 0x0d 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
RFXTRX: Recv: 0x14 0x01 0x00 0x01 0x02 0x53 0x2b 0x08 0x00 0x27 0x00 0x03 0x00 0x1c 0x10 0x6b 0x46 0x58 0x43 0x4f 0x4d
RFXTRX:  Status [subtype=433.92MHz, firmware=43, output_power=28, devices=['ac', 'arc', 'lighting4', 'oregon', 'x10']]
RFXTRX: Send: 0x0d 0x00 0x00 0x03 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
RFXTRX: Recv: 0x14 0x01 0x07 0x03 0x07 0x43 0x6f 0x70 0x79 0x72 0x69 0x67 0x68 0x74 0x20 0x52 0x46 0x58 0x43 0x4f 0x4d
RFXTRX: Recv: 0x08 0x20 0x00 0x00 0x5c 0xbc 0x20 0x04 0x79
2020-06-04 21:08:16 DEBUG (Thread-2) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 5cbc20_32 Class: RFXtrxDevice Sub: 0, Pkt_id: 082000005cbc200479)
RFXTRX: Recv: 0x08 0x20 0x00 0x01 0x5c 0xbc 0x20 0x04 0x79
2020-06-04 21:08:33 DEBUG (Thread-2) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 5cbc20_32 Class: RFXtrxDevice Sub: 0, Pkt_id: 082000015cbc200479)
RFXTRX: Recv: 0x08 0x20 0x00 0x02 0x5c 0xbc 0x20 0x04 0x69
2020-06-04 21:11:00 DEBUG (Thread-2) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 5cbc20_32 Class: RFXtrxDevice Sub: 0, Pkt_id: 082000025cbc200469)
RFXTRX: Recv: 0x08 0x20 0x00 0x03 0x5c 0xbc 0x20 0x04 0x79
2020-06-04 21:12:24 DEBUG (Thread-2) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 5cbc20_32 Class: RFXtrxDevice Sub: 0, Pkt_id: 082000035cbc200479)
RFXTRX: Recv: 0x08 0x20 0x00 0x04 0x5c 0xbc 0x20 0x04 0x79
2020-06-04 21:12:33 DEBUG (Thread-2) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 5cbc20_32 Class: RFXtrxDevice Sub: 0, Pkt_id: 082000045cbc200479)
RFXTRX: Recv: 0x08 0x20 0x00 0x05 0x5c 0xbc 0x20 0x04 0x79
2020-06-04 21:12:40 DEBUG (Thread-2) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 5cbc20_32 Class: RFXtrxDevice Sub: 0, Pkt_id: 082000055cbc200479)
RFXTRX: Recv: 0x08 0x20 0x00 0x06 0x5c 0xbc 0x20 0x04 0x79
2020-06-04 21:12:49 DEBUG (Thread-2) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 5cbc20_32 Class: RFXtrxDevice Sub: 0, Pkt_id: 082000065cbc200479)
RFXTRX: Recv: 0x08 0x20 0x00 0x07 0x5c 0xbc 0x20 0x04 0x79
2020-06-04 21:13:09 DEBUG (Thread-2) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 5cbc20_32 Class: RFXtrxDevice Sub: 0, Pkt_id: 082000075cbc200479)
RFXTRX: Recv: 0x08 0x20 0x00 0x08 0x5c 0xbc 0x20 0x04 0x79
2020-06-04 21:13:30 DEBUG (Thread-2) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 5cbc20_32 Class: RFXtrxDevice Sub: 0, Pkt_id: 082000085cbc200479)

I’ve noticed more users have commented on this in the past. One user @y-pollart appears to have extensively researched this (here), but I’m wondering if his code is in the current version of HA.

I’ve dug a bit deeper. After connecting the RFXtrx443XL to my Windows laptop and using RFXmngr.exe, I’ve looked at the various messages that my sensors (PIR, Door, Control) produce:

Every message contains a set of 9 hexes, as can be seen in my previous post. I’ll refer to the following message as an example:

   0    1    2    3    4    5    6    7    8
0x08 0x20 0x00 0x07 0x5c 0xbc 0x20 0x04 0x79

Hexes 0, 1, and 2 are always 0x082000, which I guess means their supplier’s code or something.

Hex 3 contains the sequence number. My example shows this as 0x07, meaning the 7th message. This number auto increments regardless of what sensor is activated, and in what order. Are all sensors aware of each other (this seems unlikely to me) or is this the RFXtrx433XL that simply dictates this number and supplies it?

Hex 4 to 6 contain the device’s actual id. In the example, this is 5cbc20. This value never changes per sensor. The final 2 hexes, 7 and 8, contain the status code (hex 7) and the signal level + battery level (hex 8).

Assuming that I need to add the PIR as a binary sensor, and with the above information and the code by @y-pollart that appears to have been merged into the current version of HA (and which has since been refactored somewhat) I guess the useful data to connect the PIR on are a combination of all hexes after masking hexes 3, 7 and 8. I’ve noticed the data-bits property that can be set for a sensor, as well as the cmd_on and cmd_off values.

For posterity and completeness sake, I’ve noticed these values and their meanings for Hex 7:

0x02 > Alarm (door sensor open)
0x04 > Motion (PIR sensor detecting movement)
0x82 > Alarm + Tamper (PIR sensor case physically opened)
0x06 > Panic (remote control panic button)
0x09 > Arm Away (remote control away button)
0x0B > Arm Home (remote control home button)
0x0D > Disarm (remote control disarm button)

Does data_bits support masking of hex 3, or is this possible in some other way? I’m willing to fork the repo and code it myself if this is currently not possible.

Beyond my skills. Is @Danielhiversen able to help? I know he’s been really helpful with me in the past

Thanks for helping though, time is our most valuable commodity.

1 Like

@Danielhiversen, I see the pull request here isn’t merged according to GitHub, though there obviously is a binary_sensor.py in the repo.

I’ve followed the instructions for manual installation of Home Assistant, placing it in /srv/homeassistant. Can I rebuild it with a changed binary_sensor.py? I would like to add some debugging information.

I’ve been in contact with the supplier of the RFXtrx433XL. They note that the sequence number is added by them, and that this is quite normal and others have been able to connect their sensors regardless of this. I’ve also taken a look at the code and the debug log. It notes that:

2020-06-05 22:53:19 DEBUG (SyncWorker_16) [homeassistant.components.rfxtrx.binary_sensor] Masked device id: None
2020-06-05 22:53:19 DEBUG (SyncWorker_16) [homeassistant.components.rfxtrx.binary_sensor] Add Chuango Kitchen PIR rfxtrx.binary_sensor (class motion)

I feel that the log entry saying that the masked device id is none is highly relevant.

My configuration is:

binary_sensor:
  platform: rfxtrx
  automatic_add: true
  devices:
    0820001a5cbc200479:
      name: Chuango Kitchen PIR
      data_bits: 4
      device_class: motion
      off_delay: 5

Is anyone able to help me with this? I’d really not want to have to reinvest in new door sensors and pir sensors if I’ve already got half a dozen in my home and HASS should be able to connect to them.

Insert jumpers D0, D1 and D2 to receive the Chuango door sensor as X10 door sensor.

Obviously you have to enable X10 on your RfxTrx.

Dear Francis,

thanks for your help. I’ve checked my motion sensor (also did this for door sensors with the same result), and it is already set to D0, D1, and D2. MY RfxTrx has x10 enabled, and I also see the message in the log.

After manually firing the message from the sensor, I see that the RfxCom event is received:

Receive RFXCOM event from (Device_id: 0940c0_32 Class: RFXtrxDevice Sub: 0, Pkt_id: 082000000940c00269

I added the id (082000000940c00269) to my configuration as a device, but the state never changes.

The documentation says the sensor should be added automatically if the interface is on, but I don’t see that happening. I also noticed this in my log after a restart of HASS:

2020-06-08 10:14:50 DEBUG (SyncWorker_7) [homeassistant.components.rfxtrx.binary_sensor] Masked device id: None
2020-06-08 10:14:50 DEBUG (SyncWorker_7) [homeassistant.components.rfxtrx.binary_sensor] Add Chuango Sensor rfxtrx.binary_sensor (class motion)

Am I using the wrong number of bits? I find the terminology of bits odd here, because the information at the end of the packet is much more than just 4 bits; it’s 4 hexadecimal characters, and thus 4x16 bits at the very least.

I’ve decided to bite the bullet and reinstall home assistant, since most of my initial configuration was minor, and I really want the chuango sensors online. I used to run the manual installation in a virtual python environment, but decided to switch to this installer instead, which optically changed home assistant in a number of small ways.

I see a Supervisor tab now, and can also view logs there. I’ve re-enabled the RFXcom transceiver and see the messages it sends to an fro.

After setting automatic_add to true, my interface still doesn’t add sensors when I manually fire them. This is not really a problem; I’m more than willing to add devices myself. Doing so by taking the following message:

2020-06-10 14:16:20 DEBUG (Thread-2) [homeassistant.components.rfxtrx] Receive RFXCOM event from (Device_id: 0940c0_32 Class: RFXtrxDevice Sub: 0, Pkt_id: 082000010940c00269)

Extracting the Pkt_id, and pasting it into the configuration like so:

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

rfxtrx:
  device: /dev/serial/by-id/usb-RFXCOM_RFXtrx433XL_DO3ZUL2A-if00-port0
  debug: true

binary_sensor:
  platform: rfxtrx
  automatic_add: true
  devices:
    '082000020940c00279':
      name: PIR
      device_class: motion
      off_delay: 100000
      data_bits: 4
      command_on: 0x02


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

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

When I restart home assistant, i still get this message:

2020-06-10 14:15:19 DEBUG (SyncWorker_14) [homeassistant.components.rfxtrx.binary_sensor] Masked device id: None

Which means the sensor won’t work, because the masked device id is required to extract the message from the device_id.

The last 4 bytes of the Pkt_id (0269 in my example above) show the command sent by the sensor (0x02) the signal strength (6) and the battery level (9).

Can anyone spot a glaring mistake in my configuration? Is anything clearly amiss? Why won’t HASS on my RPI 4 do what I want it to do?

Bumping this post in hopes of a reply.

Note that I’ve quoted the sensor’s id, by the way, which should be allowed and fixes issues with completely numeric ids.

Is there anything I can do as a user to further debug this issue than I already have? Is there a way to run a development version that I can use to tweak things in or debug this issue?

I don’t have a RFXTRX myself, so can’t help any further.

@Danielhiversen, you wrote the RFXtrx package that integrates with HomeAssistant. Do you have any ideas on what might be wrong?