[SOLVED] Sync light in HA when use a remote RF with Sonoff RF Bridge + Broadlink RM4 PRO

Hello,

i search a long time for a solution to sync my ceiling fan RF LED remotes, i have 6 ceiling fan in my house : i explain : i have a Broadlink RM4 PRO only to send learned codes from RF Remote of my 6 ceiling fan. it works great. BUT if i use the remotes, there is no SYNC between fan and HA, and when i use the light entity in HA to light up the ceiling LED, it work ok.

So, because Broadlink cant “read” or “listen” RF code, i buy a SonOff RF Bridge 433 R2. First i reflash with Esphome and hack it (cut the traces and dont use the microcontroler for dump codes), but always get inconstant codes for remotes. So i buy a new one and do nothing apart install the SonOffLocal AddOn from Alexxit and learn codes from my remote, for the moment only the “LED” button, wich are the same for On and Off, just toggling.

Ok, so after some days, seems MY solution is :

1-learn code into WeLink App Android, rename by a clear and explicit name, then in HA they will be 0, 1, 2, … by using {{ trigger.event.data.command == 0 }} where 0 is the remote button read.

2-create 2 light template : one for the ceiling for broadlink send code and one for the SonOff Bridge to read code, linking, like this:

- platform: template
  lights:
    brasseur_bureau_led:
      friendly_name: "Brasseur Bureau Led"
      unique_id: "brasseur bureau led"
      turn_on:
        - condition: state
          entity_id: light.brasseur_bureau_led_remote
          state: "off"
        - service: script.brasseur_bureau_led
      turn_off:
        - condition: state
          entity_id: light.brasseur_bureau_led_remote
          state: "on"
        - service: script.brasseur_bureau_led
    brasseur_bureau_led_remote:
      friendly_name: "Brasseur Bureau Led Remote"
      unique_id: "brasseur bureau led Remote"
      turn_on:
        - condition: state
          entity_id: light.brasseur_bureau_led_remote
          state: "off"
      turn_off:
        - condition: state
          entity_id: light.brasseur_bureau_led_remote
          state: "on"

3-create 4 automations : 2 for linking the LED from Broadlink to the LED from SonOff (ON and OFF)
and 2 for the LED from SonOff to the LED from Broadlink : SYNCING in 2 ways : WORK!

1 : SonOff OFF

alias: Brasseur Bureau Led Remote Off
description: ""
trigger:
  - platform: event
    event_type: sonoff.remote
condition:
  - condition: and
    conditions:
      - condition: template
        value_template: "{{ trigger.event.data.command == 0 }}"
      - condition: state
        entity_id: light.brasseur_bureau_led_remote
        state: "on"
action:
  - service: light.turn_off
    data: {}
    target:
      entity_id: light.brasseur_bureau_led_remote
mode: single

2: SonOff ON

alias: Brasseur Bureau Led Remote On
description: ""
trigger:
  - platform: event
    event_type: sonoff.remote
condition:
  - condition: and
    conditions:
      - condition: template
        value_template: "{{ trigger.event.data.command == 0 }}"
      - condition: state
        entity_id: light.brasseur_bureau_led_remote
        state: "off"
action:
  - service: light.turn_on
    data: {}
    target:
      entity_id: light.brasseur_bureau_led_remote
mode: single

3-Broadlink OFF

alias: Brasseur Bureau Led Off par Remote
description: ""
trigger:
  - platform: state
    entity_id:
      - light.brasseur_bureau_led_remote
    from: "on"
    to: "off"
condition: []
action:
  - service: light.turn_off
    data: {}
    target:
      entity_id:
        - light.brasseur_bureau_led
mode: single

4-Broadlink ON

alias: Brasseur Bureau Led On par Remote
description: ""
trigger:
  - platform: state
    entity_id:
      - light.brasseur_bureau_led_remote
    from: "off"
    to: "on"
condition: []
action:
  - service: light.turn_on
    data: {}
    target:
      entity_id: light.brasseur_bureau_led
mode: single

Conclusion : SYNC work as expect : when you ask Google to light up the “brasseur bureau led” the entity is on and the light template “remote” is on too. When then you use the Remote to lightoff, the template light remote go off and the template light too. So its SYNC. No more problem to have the light stay on all the night because in HA you see the light is on, but you lightoff with the remote and when you lightoff in HA, it will lighton the LED…LOL…that the problem when its not SYNC. Have to look at the camera if the light is really OFF…now, no more problem. Be sure to place the SonOff RF Bridge in a central place of your house, because if he lost the button press of the remotes…no more Sync again.

The Tx of the Broadlink is really powerfull and even at a corner of a large house, it works from anywhere, even from the 2nd floor, so dont matter where he is.

OK, its not a light solution, but i found anything on the HA forum and anywhere about the SYNC problem when you use a remote AND HA to toggle a light (or Google Home).

Perhaps someone has an easy way to SYNC. I will be please to read some improvements.Up to you.

Enjoy

1 Like