433Mhz newbie question: multiple door sensors

I’m looking to utilize some cheap 433Mhz sensors. This is my first foray into the 433Mhz world.

I just picked up a Sonoff RF Bridge, which after soldering changes (it’s the new 2.2 version) is running ESPHome. It is working.

My primary project at the moment is for door and window sensors. I have one of these door sensors for testing. It supports both open and close codes, which is good. I can see the RC_Switch Raw code on the RF Bridge via ESPHome logs, e.g the open code:

Received RCSwitch Raw: protocol=1 data='111100100010000000001010'

And the closed code, which is different:

Received RCSwitch Raw: protocol=1 data='111100100010000000001110'

A newbie question: how does one deal with multiple 433mhz door/window sensors? Does each device send a unique code somehow, so you can identify which door/window is open and closed? I anticipate I’ll have several of these around and want to make sure how this will work before going all-in on the solution.

Thanks in advance!

I know with the Sonoff RF Bridge without the ESPHome or Tasmota reflashing does send a unique set of information for each button. Here’s what I get in the Event Listener:

{
    "event_type": "sonoff.remote",
    "data": {
        "command": 4,
        "ts": "2022-01-27T00:09:59.000Z",
        "name": "R4",
        "entity_id": "remote.sonoff_1001109681"
    },
    "origin": "LOCAL",
    "time_fired": "2022-01-27T00:09:59.286186+00:00",
    "context": {
        "id": "e32c3e0612acfd3b16822758d1861eeb",
        "parent_id": null,
        "user_id": null
    }
}

I have automations set up to trigger on entity_id and then act according to name as follows:

# R remote
- alias: Sonoff R RF Receive
  trigger:
    platform: event
    event_type: sonoff.remote  # this is NOT entity_id, don't change it!
    event_data:
      entity_id: remote.sonoff_1001109681
  action:
  - choose:
    - conditions:
      - '{{ trigger.event.data.name == "R0" }}'
      sequence: 
        - service: homeassistant.toggle
          entity_id: switch.r_desk_lamp
    - conditions:
      - '{{ trigger.event.data.name == "R1" }}'
      sequence: 
        - service: homeassistant.toggle
          entity_id: light.lr_sonoff
    - conditions:
      - '{{ trigger.event.data.name == "R3" }}'
      sequence:
        - service: script.good_night_02
          data:
            lights_wait: '10'
            in_bed_wait: '15'
    - conditions:
      - '{{ trigger.event.data.name == "R4" }}'
      sequence:
        - service: homeassistant.toggle
          entity_id: input_boolean.zoom_lighting
    - conditions:
      - '{{ trigger.event.data.name == "R5" }}'
      sequence: 
        - service: homeassistant.toggle
          entity_id: fan.lr_sonoff
    - conditions:
      - '{{ trigger.event.data.name == "R7" }}'
      sequence:
        - service: homeassistant.toggle
          entity_id: input_boolean.in_bed

It looks like you could do a similar thing with the data with automations for each of the data strings you noted.

Depends on the door switch.

Some only send open code, some send open and closed with a single bit toggled to identify which state.

I have the Tasmota firmware running on 3 bridges scattered around the house, then use a Python script to demux and translate the codes sent for Tasmota. The same can be achieved using Node-Red. You could probably also achieve it using Automations only.

With ESPhome I assume you are using the API, you basically do a lookup of th single sensor in a list and output a sensor for the specific object that matches.

If you are interested I can post the sensors and the Python, remembering that Tasmota uses MQTT so you will need to change some things if you use the API.

Thanks all. As I mentioned, the sensor I have (a Garosa unit from Amazon, which according to the internal PCB pics I’ve seen, is also known as a GS-WDS07) does do separate codes for open and close.

My question was really about how the sensors are identified uniquely. For example, a BT / BLE device has a unique MAC address, so it’s easy to target a specific device. I wasn’t sure if there was a similar mechanism used for 433Mhz. There must be, right?

I went ahead and ordered a second door sensor (they’re pretty darn cheap). I’ll see what it squawks as a code when it comes in. I’d imagine it should be different than the other somehow…

Also, here’s my ESPHome code for the Sonoff RF Gateway. I had to play around with some of the timings (tolerance, filter, idle) to read the sensor reliably. I haven’t added any binary sensors yet, just reading codes for now.

I ended up with the 2.2 version of the Sonoff RF board, which is quite different than the previous versions. Broke out the soldering iron and wire and modified according to this:

New Sonoff RF Bridge Board - Need Flashing Help - Configuration - Home Assistant Community (home-assistant.io)

esphome:
  name: rfbridge-1

esp8266:
  board: esp8285

logger:

api:

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

web_server:

status_led:
  pin:
    number: GPIO13
    inverted: yes

# USBRX = GPIO4 ---> receiver
# USBTX = GPIO5 ---> trasmitter

# receiver = pin 5 of the 8-legged chip (the one closer to the wifi antenna)
# transmitter = pin 4 of the 6-legged chip (closest to r12)

remote_receiver:
  pin:
    number: GPIO4
  dump: rc_switch
  # Modified these to get stability
  tolerance: 50%
  filter: 4us
  idle: 4ms

remote_transmitter:
  pin: GPIO05
  carrier_duty_percent: 100%

There is not. The only unique thing they have is the codes sent. You only can identify them with their codes.

Here’s a bunch of codes sent by my door sensors - which are the same as yours, as Francis says the only identifying feature is the code they send:

      '92A90A':['433mhz/sensor_lounge_door','ON','true'],
      '92A90E':['433mhz/sensor_lounge_door','OFF','true'],
      '92A906':['433mhz/battery_lounge_door','ON','true'],
      '0F400A':['433mhz/sensor_east_front_window','ON','true'],
      '0F400E':['433mhz/sensor_east_front_window','OFF','true'],
      '0F4006':['433mhz/battery_east_front_window','ON','true'],
      '14760A':['433mhz/sensor_east_sunroom_door','ON','true'],
      '14760E':['433mhz/sensor_east_sunroom_door','OFF','true'],
      '147606':['433mhz/battery_east_sunroom_door','ON','true'],
      'DDDE0A':['433mhz/sensor_back_door','ON','true'],
      'DDDE0E':['433mhz/sensor_back_door','OFF','true'],
      'DDDE06':['433mhz/battery_back_door','ON','true'],

This is an extract from my Python script. The values are in hex, those ending in A are OPEN, ending in E are CLOSED and ending in 6 are LOW BATTERY.

These correspond to various bits toggling in your binary value - use a binary to hex converter to see.

These sensors are very handy - they have a tamper sensor on the board that can be used to generate a 4th code.

I use them as light switches - see this:

This is exactly what I was looking for! I figured they sent different codes to differentiate themselves from one another.

Thanks everybody!