spi:
  - id: spi_atm90e32
    clk_pin: ${clk_pin}
    mosi_pin: ${mosi_pin}
    miso_pin: ${miso_pin}

sensor:
  - platform: atm90e32
    cs_pin: ${cs_pin}
    id: atm90e32_chip1
    phase_a:
      voltage:
        name: EMON Line Voltage A
      current:
        name: EMON CT1 Current
      power:
        name: EMON Active Power CT1
      reactive_power:
        name: EMON Reactive Power CT1
      apparent_power:
        name: EMON Apparent Power CT1
      harmonic_power:
        name: EMON Harmonic Power CT1
      power_factor:
        name: EMON Power Factor CT1
      phase_angle:
        name: EMON Phase Angle CT1
      peak_current:
        name: EMON Peak Current CT1
      gain_voltage: 7305
      gain_ct: 27961
      offset_voltage: 0
      offset_current: 0
      offset_active_power: 0
      offset_reactive_power: 0
    phase_b:
      current:
        name: EMON CT2 Current
      power:
        name: EMON Active Power CT2
      reactive_power:
        name: EMON Reactive Power CT2
      apparent_power:
        name: EMON Apparent Power CT2
      harmonic_power:
        name: EMON Harmonic Power CT2
      power_factor:
        name: EMON Power Factor CT2
      phase_angle:
        name: EMON Phase Angle CT2
      peak_current:
        name: EMON Peak Current CT2
      gain_voltage: 7305
      gain_ct: 27961
      offset_voltage: 0
      offset_current: 0
      offset_active_power: 0
      offset_reactive_power: 0
    phase_c:
      current:
        name: EMON CT3 Current
      power:
        name: EMON Active Power CT3
      reactive_power:
        name: EMON Reactive Power CT3
      apparent_power:
        name: EMON Apparent Power CT3
      harmonic_power:
        name: EMON Harmonic Power CT3
      power_factor:
        name: EMON Power Factor CT3
      phase_angle:
        name: EMON Phase Angle CT3
      peak_current:
        name: EMON Peak Current CT3
      gain_voltage: 7305
      gain_ct: 27961
      offset_voltage: 0
      offset_current: 0
      offset_active_power: 0
      offset_reactive_power: 0
    frequency:
      name: EMON Line Frequency
    chip_temperature:
      name: EMON Chip Temp
    line_frequency: 60Hz
    current_phases: 3
    gain_pga: 1X
    enable_offset_calibration: True
    enable_gain_calibration: True

text_sensor:
  - platform: atm90e32
    id: atm90e32_chip1
    phase_status:
      phase_a:
        name: "Phase A Status"
      phase_b:
        name: "Phase B Status"
      phase_c:
        name: "Phase C Status"
    frequency_status:
      name: "Frequency Status"

button:
  - platform: atm90e32
    id: atm90e32_chip1
    run_gain_calibration:
      name: "Run Gain Calibration"
    clear_gain_calibration:
      name: "Clear Gain Calibration"
    run_offset_calibration:
      name: "Run Offset Calibration"
    clear_offset_calibration:
      name: "Clear Offset Calibration"
    run_power_offset_calibration:
      name: "Run Power Offset Calibration"
    clear_power_offset_calibration:
      name: "Clear Power Offset Calibration"

number:
  - platform: atm90e32
    id: atm90e32_chip1
    reference_voltage:
      phase_a:
        name: "Phase A Ref Voltage"
      phase_b:
        name: "Phase B Ref Voltage"
      phase_c:
        name: "Phase C Ref Voltage"
    reference_current:
      phase_a:
        name: "Phase A Ref Current"
      phase_b:
        name: "Phase B Ref Current"
      phase_c:
        name: "Phase C Ref Current"
