i2c:
  - id: i2c_ade7953
    scl: 5
    sda: 4

sensor:
  - platform: ade7953_i2c
    irq_pin: 6
    voltage:
      name: ADE7953 Voltage
      id: ade7953_voltage
    current_a:
      name: ADE7953 Current A
      id: ade7953_current_a
    current_b:
      name: ADE7953 Current B
      id: ade7953_current_b
    power_factor_a:
      name: ADE7953 Power Factor A
    power_factor_b:
      name: ADE7953 Power Factor B
    apparent_power_a:
      name: ADE7953 Apparent Power A
    apparent_power_b:
      name: ADE7953 Apparent Power B
    active_power_a:
      name: ADE7953 Active Power A
    active_power_b:
      name: ADE7953 Active Power B
    reactive_power_a:
      name: ADE7953 Reactive Power A
    reactive_power_b:
      name: ADE7953 Reactive Power B
    update_interval: 1s

switch:
  - platform: template
    id: template_switch1
    optimistic: true
  - platform: template
    id: template_switch2
    optimistic: true

cover:
  - platform: current_based
    name: Current Based Cover
    id: current_based_cover
    open_sensor: ade7953_current_a
    open_moving_current_threshold: 0.5
    open_obstacle_current_threshold: 0.8
    open_duration: 12s
    open_action:
      - switch.turn_on: template_switch1
    close_sensor: ade7953_current_b
    close_moving_current_threshold: 0.5
    close_obstacle_current_threshold: 0.8
    close_duration: 10s
    close_action:
      - switch.turn_on: template_switch2
    stop_action:
      - switch.turn_off: template_switch1
      - switch.turn_off: template_switch2
    obstacle_rollback: 30%
    start_sensing_delay: 0.8s
    malfunction_detection: true
    malfunction_action:
      then:
        - logger.log: Malfunction Detected