sensor:
  # Battery 0
  - platform: integration
    source: sensor.batteries_jk0_charging_power
    name: "JK0 energy in"
    unique_id: jk0_energy_in_kwh
    unit_prefix: k
    method: trapezoidal
    round: 3
    max_sub_interval:
      minutes: 5
  - platform: integration
    source: sensor.batteries_jk0_discharging_power
    name: "JK0 energy out"
    unique_id: jk0_energy_out_kwh
    unit_prefix: k
    method: trapezoidal
    round: 3
    max_sub_interval:
      minutes: 5

  # Battery 1
  - platform: integration
    source: sensor.battery1_jk1_charging_power
    name: "JK1 energy in"
    unique_id: jk1_energy_in_kwh
    unit_prefix: k
    method: trapezoidal
    round: 3
    max_sub_interval:
      minutes: 5
  - platform: integration
    source: sensor.battery1_jk1_discharging_power
    name: "JK1 energy out"
    unique_id: jk1_energy_out_kwh
    unit_prefix: k
    method: trapezoidal
    round: 3
    max_sub_interval:
      minutes: 5

utility_meter:
  # Battery 0
  jk0_energy_in_daily:
    source: sensor.jk0_energy_in
    name: "JK0 Energy In Daily"
    cycle: daily
  jk0_energy_out_daily:
    source: sensor.jk0_energy_out
    name: "JK0 Energy Out Daily"
    cycle: daily

  # Battery 1
  jk1_energy_in_daily:
    source: sensor.jk1_energy_in
    name: "JK1 Energy In Daily"
    cycle: daily
  jk1_energy_out_daily:
    source: sensor.jk1_energy_out
    name: "JK1 Energy Out Daily"
    cycle: daily
