Trigger action when Tasmoto flashed Sonoff RF Bridge reads a RF command from a KAKU remote

I have a Tasmoto flashed Sonoff RF Bridge configured in HA. With some thinkering I can turn on and off my KlikAanKlikUit RF switches based on a question I had in the past:

What I now want to do is have my Home Assistent trigger an action when a certain RF signal is read/received.

These are the commands I use to generate the particular signals, but I now want trigger an action when these are read/received.

      woonkamerlicht:
        turn_on:
          service: mqtt.publish
          data:
            topic: 'cmnd/rf-bridge/RfRaw'
            payload: 'AAA8050DDFADB22F55'
        turn_off:
          service: mqtt.publish
          data:
            topic: 'cmnd/rf-bridge/RfRaw'
            payload: 'AAA8050DDFADB23F55'

This is the console reponse for Off and then On

20:43:21.059 CMD: rfraw 177
20:43:21.068 MQT: stat/rf-bridge/RESULT = {“RfRaw”:“ON”}
20:43:21.143 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:43:21”,“RfRaw”:{“Data”:“AAA055”}}
20:43:29.347 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:43:29”,“RfRaw”:{“Data”:“AA B1 04 0122 00D2 04BA 04BA 381828 55”}}
20:43:29.585 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:43:29”,“RfRaw”:{“Data”:“AA B1 05 0122 09D8 00D2 04CE 285A 481828382838382828382838283828382838283838080838380808380838380808380838380808380838380838080838380838083808083808380838083808380838 55”}}
20:43:29.820 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:43:29”,“RfRaw”:{“Data”:“AA B1 05 014A 09B0 00AA 04A6 2832 481828382838382828382838283828382838283838282838382828382838382828382838382828382838382838282838382838283828283828382838283828382838 55”}}
20:43:30.766 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:43:30”,“RfRaw”:{“Data”:“AA B1 05 014A 09B0 00AA 04A6 283C 481828382838382828382838283828382838283838282838382828382838382828382838382828382838382838282838382838283828283828382838283828382838 55”}}
20:43:32.370 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:43:32”,“RfRaw”:{“Data”:“AA B1 04 0122 00D2 04CE 04BA 381828 55”}}
20:43:32.460 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:43:32”,“RfRaw”:{“Data”:“AA B1 03 010E 04CE 04C4 281808 55”}}
20:43:32.921 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:43:32”,“RfRaw”:{“Data”:“AA B1 05 0140 09B0 00AA 04A6 283C 481828382838382828382838283828382838283838282838382828382838382828382838382828382838382838282838382838283828283838282838283828382838 55”}}
20:43:33.866 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:43:33”,“RfRaw”:{“Data”:“AA B1 05 014A 09B0 00AA 04A6 283C 481828382838382828382838283828382838283838282838382828382838382828382838382828382838382838282838382838283828283838282838283828382838 55”}}

And the same for a different RFRaw command

20:44:27.882 CMD: rfraw 166
20:44:27.891 MQT: stat/rf-bridge/RESULT = {“RfRaw”:“ON”}
20:44:27.986 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:44:27”,“RfRaw”:{“Data”:“AAA055”}}
20:44:34.124 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:44:34”,“RfRaw”:{“Data”:“AAA6050DDFADB23F55”}}
20:44:34.990 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:44:34”,“RfRaw”:{“Data”:“AAA6050DDFADB23F55”}}
20:44:37.540 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:44:37”,“RfRaw”:{“Data”:“AAA6050DDFADB22F55”}}
20:44:38.406 MQT: tele/rf-bridge/RESULT = {“Time”:“2025-07-03T20:44:38”,“RfRaw”:{“Data”:“AAA6050DDFADB22F55”}}

something like this?

alias: RF KlikAanKlikUit Handler
description: "Handles multiple RF codes from the RF Bridge"
trigger:
  - platform: mqtt
    topic: tele/rf-bridge/RESULT

condition: []

action:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfRaw.Data == 'AAA6050DDFADB22F55' }}"
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.woonkamer

      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfRaw.Data == 'AAA6050DDFADB23F55' }}"
        sequence:
          - service: light.turn_off
            target:
              entity_id: light.woonkamer

mode: queued

Just copy a - conditions: block under choose: for each new RF code and target entity. This way, you can manage all RF signal responses in a single automation.

this one is what i use to recive data

alias: RF Control con mĂşltiples botones lizzy
description: AutomatizaciĂłn que reacciona a varios cĂłdigos RF del RF Bridge
triggers:
  - topic: tele/RF_Bridge2/RESULT
    trigger: mqtt
conditions:
  - condition: template
    value_template: "{{ trigger.payload_json.RfReceived is defined }}"
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfReceived.Data == '335208' }}"
        sequence:
          - target:
              entity_id: light.luz_cuarto
            data:
              brightness: 60
            action: light.toggle
        alias: boton 1 lizzy
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfReceived.Data == '33520C' }}"
        sequence:
          - target:
              entity_id: light.luces_cabecera
            action: light.toggle
            data: {}
        alias: boton 2 lizzy
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfReceived.Data == '335209' }}"
        sequence:
          - target:
              entity_id: light.luces_cabecera
            data:
              brightness: >
                {% set b = state_attr('light.luces_cabecera', 'brightness') |
                int(0) %} {{ [b + 70, 255] | min }}
            action: light.turn_on
        alias: boton 3 lizzy
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfReceived.Data == '335205' }}"
        sequence:
          - target:
              entity_id: light.luces_cabecera
            data:
              brightness: >
                {% set b = state_attr('light.luces_cabecera', 'brightness') |
                int(0) %} {{ [b - 70, 1] | max }}
            action: light.turn_on
        alias: boton 4 lizzy
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfReceived.Data == '335204' }}"
        sequence:
          - action: climate.turn_off
            metadata: {}
            data: {}
            target:
              entity_id: climate.clima_recamara
        alias: boton 5 lizzy
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfReceived.Data == '335202' }}"
        sequence:
          - data:
              name: RF Bridge
              message: CĂłdigo 335202 recibido (reservado para acciĂłn futura).
            action: logbook.log
        alias: boton 6 lizzy
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfReceived.Data == '335201' }}"
        sequence:
          - data:
              name: RF Bridge
              message: CĂłdigo 335201 recibido (reservado para acciĂłn futura).
            action: logbook.log
        alias: boton 7 lizzy
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfReceived.Data == '335203' }}"
        sequence:
          - data:
              name: RF Bridge
              message: CĂłdigo 335203 recibido (reservado para acciĂłn futura).
            action: logbook.log
        alias: boton 8 lizzy
    default: []
mode: queued
1 Like

It works, it triggers a tbd action when the payload is received. I needed to make sure the automation would not run 2 times so I put the mode to single instead of qued and had it wait for a bit to make sure it would not trigger twice during the RF transmittal.

I needed to have a switch turn on and off quickly to tell a light dimmer to toggle between on/off.

Fun fact: When I have the RF bridge send the command via Home Assistant, it does not read the sent command during transmittal. Not a big deal and I can fix that in automation too, but when it is sending, it does not seem to be receiving too.

alias: Wandlamp schakelen op KaKu
description: Handles multiple RF codes from the RF Bridge
triggers:
  - topic: tele/rf-bridge/RESULT
    trigger: mqtt
conditions: []
actions:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfRaw.Data == 'AAA6050DDFADB22F55' }}"
        sequence:
          - type: turn_on
            device_id: 665735e8bd847014112f2dd22e8e5a8a
            entity_id: 4eb7498cbdfb616ef2a361557ec08ac3
            domain: switch
          - delay:
              hours: 0
              minutes: 0
              seconds: 0
              milliseconds: 100
          - type: turn_off
            device_id: 665735e8bd847014112f2dd22e8e5a8a
            entity_id: 4eb7498cbdfb616ef2a361557ec08ac3
            domain: switch
      - conditions:
          - condition: template
            value_template: "{{ trigger.payload_json.RfRaw.Data == 'AAA6050DDFADB23F55' }}"
        sequence:
          - type: turn_on
            device_id: 665735e8bd847014112f2dd22e8e5a8a
            entity_id: 4eb7498cbdfb616ef2a361557ec08ac3
            domain: switch
          - delay:
              hours: 0
              minutes: 0
              seconds: 0
              milliseconds: 100
          - type: turn_off
            device_id: 665735e8bd847014112f2dd22e8e5a8a
            entity_id: 4eb7498cbdfb616ef2a361557ec08ac3
            domain: switch
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
mode: single