logo elektroda
logo elektroda
X
logo elektroda

Setup outdoor relay (openbeken) with different pins for on and off state.

daviddevries 651 3
ADVERTISEMENT
  • #1 20758153
    daviddevries
    Level 2  
    I'm having trouble configuring my lsc relay (https://github.com/tuya-cloudcutter/tuya-cloudcutter.github.io/blob/4934b68d31df1b00eb7e73ab4811919f50d5de20/devices/lsc-3004200-wifi-outdoor-dual-socket.json)

    The challenging part is that it appears you need two pins for one socket. P14 needs to be on and P25off to turn the relay on mirrored to turn it off.
    I had it set up like this with esphome:

    
    esphome:
      name: 2x_outdoor_power
    
    bk72xx:
      board: generic-bk7231t-qfn32-tuya
      framework:
        version: dev
        loglevel: verbose
    
    logger:
    
    web_server:
    
    captive_portal:
    
    mdns:
    
    api:
      password: ""
    
    ota:
      password: ""
    
    wifi:
      ssid: !secret wifi_ssid
      password: !secret wifi_password
      ap:
    
    button:
      - platform: restart
        name: Restart
    
    debug:
      update_interval: 30s
    
    text_sensor:
      - platform: debug
        reset_reason:
          name: Reset Reason
      - platform: libretiny
        version:
          name: LibreTiny Version
    
    sensor:
      - platform: uptime
        name: Uptime
    
    binary_sensor:
      - platform: gpio
        id: binary_switch_all
        pin:
          number: P7
          inverted: true
          mode: INPUT_PULLUP
    
    
    
    switch:
      - platform: template
        name: "Relay 1"
        id: relay1
        optimistic: true
        assumed_state: true     
        turn_on_action:
          - switch.template.publish: 
              id: relay1
              state: ON
          - switch.turn_off: switch_1_off 
          - switch.turn_on: switch_1_on  
          - logger.log: "Switch 1 Turned On!"
          #- light.turn_on: stat_led
        turn_off_action:
          - switch.template.publish: 
              id: relay2
              state: ON
          - switch.turn_off: switch_1_on 
          - switch.turn_on: switch_1_off  
          - logger.log: "Switch 1 Turned Off!"
          #- light.turn_off: stat_led
    
      - platform: template
        name: "Relay 2"
        id: relay2
        optimistic: true
        assumed_state: true     
        turn_on_action:
          - switch.turn_off: switch_2_off 
          - switch.turn_on: switch_2_on  
          - logger.log: "Switch 2 Turned On!"
      #    - light.turn_on: stat_led
        turn_off_action:
          - switch.turn_off: switch_2_on 
          - switch.turn_on: switch_2_off  
          - logger.log: "Switch 2 Turned Off!"
       #   - light.turn_off: stat_led     
    
      - platform: gpio
        id: switch_1_on
        name: 1on
        pin: P14 
    
      - platform: gpio
        id: switch_2_on
        name: 2on    
        pin: P9
    
      - platform: gpio
        id: switch_1_off
        name: 1off    
        pin: P26
    
      - platform: gpio
        id: switch_2_off
        name: 2off
        pin: P8  
    
    #  - platform: gpio
    #    id: switch_all
    #    name: Relay 1&2
    #    pin: P7
    #    on_turn_on:
    #    - switch.turn_off: switch_1_off
    #    - switch.turn_on: switch_1_on
    #    - switch.turn_off: switch_2_off
    #    - switch.turn_on: switch_2_on
    #    - logger.log: "Switch Turned On!"
    #    - light.turn_on: stat_led
    #    on_turn_off:
    #    - switch.turn_on: switch_1_off
    #    - switch.turn_off: switch_1_on
    #    - switch.turn_on: switch_2_off    
    #    - switch.turn_off: switch_2_on
    #    - logger.log: "Switch Turned Off!"
    #    - light.turn_off: stat_led
    
    
    light:
      - platform: status_led
        id: stat_led
        name: "Switch state"
        pin:
          number: P1
          inverted: true
    
    #status_led:
    #  pin:
    #    number: P1
    #    inverted: true
    

    It 'worked' however the outdoor relay crashes/reboots non stop. With OpenBeken it is stable. I just do not know how to set something like this up. Any help appreciated.
  • ADVERTISEMENT
  • #2 20758155
    p.kaczmarek2
    Moderator Smart Home
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • Helpful post
    #4 20758449
    p.kaczmarek2
    Moderator Smart Home
    Well, then you can always just set two pins to one channel, one as Relay, and second as Relay_n
    Helpful post? Buy me a coffee.
ADVERTISEMENT