Sonoff RF Bridge (Tasmota/Portisch) + RF plugs

Hello!
Quite a newbie, managed to get things above working somehow.

Problem is: when I switch a plug ON, it stays on only for a second and pops OFF.
What should I do / what’s wrong?

My config YAML, this was quite a learning experience… some copy-pasting and then trying to figure out why its not working…

BR Mikko


mqtt:
  binary_sensor:
    - name: "rfplug1"
      state_topic: "tele/rf/RESULT"
      value_template: >-
        {% if value_json.RfReceived.Data == 'DD4554' %}
        {{'ON'}}
        {% elif value_json.RfReceived.Data == 'DD4551' %}
        {{'OFF'}}
        {% else %}
        {{states('binary_sensor.rfplug1') | upper}}
        {% endif %}
        device_class: power
     
    - name: 'rfplug2'
      state_topic: "tele/rf/RESULT"
      value_template: >-
        {% if value_json.RfReceived.Data == 'DD5154' %}
        {{'ON'}}
        {% elif value_json.RfReceived.Data == 'DD5151' %}
        {{'OFF'}}
        {% else %}
        {{states('binary_sensor.rfplug2') | upper}}
        {% endif %}
        device_class: power

switch:
  - platform: template
    switches:
      rfplug1:
        value_template: "{{ is_state('binary_sensor.rfplug1', 'on') }}"
        turn_on:
        - service: mqtt.publish
          data:
            payload: '#DD4554'
            topic: cmnd/rf/RfCode
        turn_off:
          - service: mqtt.publish
            data:
              payload: '#DD4551'
              topic: cmnd/rf/RfCode
      rfplug_2:        
        value_template: "{{ is_state('binary_sensor.rfplug2', 'on') }}"
        turn_on:
        - service: mqtt.publish
          data:
            payload: '#DD5154'
            topic: cmnd/rf/RfCode
        turn_off:
        - service: mqtt.publish
          data:
            payload: '#DD5151'
            topic: cmnd/rf/RfCode