CircuitSetup / Expandable-6-Channel-ESP32-Energy-Meter

Hardware & Software documentation for the CircuitSetup Expandable 6 Channel ESP32 Energy Meter. Works with ESPHome and Home Assistant.
https://circuitsetup.us/product/expandable-6-channel-esp32-energy-meter/
MIT License
519 stars 104 forks source link

[power_factor] is an invalid option for [phase_b]. Please check the indentation #15

Closed elyorkhakimov closed 3 years ago

elyorkhakimov commented 3 years ago

I have ran into indentation issue and can't seem to resolve it. Here is a portion of YAML file I'm trying to run:

root@tuyaconvert:/home/user# cat 6chan_energy_meter-add-on_jp8-jp11.yaml
# Example config for when jp8-jp11 are all bridged - this connects all the voltage channels and allows for power to be calculated by the meter directly.
# Boards >= v1.4 jp8-jp11 are removed and have all voltage channels connected
# 1 add-on board

substitutions:
# Change the disp_name to something you want
  disp_name: cs_nrg_mtr
# Interval of how often the power is updated
  update_time: 10s
# Current Transformers:
#  20A/25mA SCT-006: 11143
#  30A/1V SCT-013-030: 8650
#  50A/1V SCT-013-050: 15420
#  80A/26.6mA SCT-010: 41660
#  100A/50ma SCT-013-000: 27518
#  120A/40mA: SCT-016: 41787
#  200A/100mA SCT-024: 27518
  current_cal: '27518'
# Jameco 9VAC Transformer:
#  For meter versions:
#  >= v1.3: 7305
#  <= v1.2: 42620
  voltage_cal: '7305'

esphome:
  name: cs_nrg_mtr
  platform: ESP32
  board: nodemcu-32s

wifi:
  ssid: XXX
  password: XXX
  manual_ip:
    static_ip: 192.168.17.110
    gateway: 192.168.17.1
    subnet: 255.255.255.0
    dns1: 192.168.17.1

mqtt:
  broker: XXX
  username: XXX
  password: XXX

# Enable logging
logger:
  level: INFO
# Enable Home Assistant API
#api:

ota:

web_server:
  port: 80

spi:
  clk_pin: 18
  miso_pin: 19
  mosi_pin: 23

sensor:
  - platform: wifi_signal
    name: ${disp_name} WiFi
    update_interval: 60s
#IC1 Main
  - platform: atm90e32
    cs_pin: 5
    phase_a:
      voltage:
        name: ${disp_name} Volts A
        id: ic1Volts
        accuracy_decimals: 2
      current:
        name: ${disp_name} CT1 Amps
        id: ct1Amps
# The max value for current that the meter can output is 65.535. If you expect to measure current over 65A,
# divide the gain_ct by 2 (120A CT) or 4 (200A CT) and multiply the current and power values by 2 or 4 by uncommenting the filter below
#        filters:
#          - multiply: 2
      power:
        name: ${disp_name} CT1 Watts
        id: ct1Watts
#        filters:
#          - multiply: 2
      gain_voltage: ${voltage_cal}
      gain_ct: ${current_cal}
    phase_b:
      current:
        name: ${disp_name} CT2 Amps
        id: ct2Amps
      power_factor:
        name: somename
      power:
        name: ${disp_name} CT2 Watts
        id: ct2Watts
      gain_voltage: ${voltage_cal}
      gain_ct: ${current_cal}
    phase_c:
      current:
        name: ${disp_name} CT3 Amps
        id: ct3Amps
      power:
        name: ${disp_name} CT3 Watts
        id: ct3Watts
      gain_voltage: ${voltage_cal}
      gain_ct: ${current_cal}
    frequency:
      name: ${disp_name} Freq A
    line_frequency: 60Hz
    gain_pga: 1X
    update_interval: ${update_time}
#IC2 Main
  - platform: atm90e32
    cs_pin: 4
    phase_a:
      voltage:
        name: ${disp_name} Volts B
        id: ic2Volts
        accuracy_decimals: 2
      current:
        name: ${disp_name} CT4 Amps
        id: ct4Amps
      power:
        name: ${disp_name} CT4 Watts
        id: ct4Watts
      gain_voltage: ${voltage_cal}
      gain_ct: ${current_cal}
    phase_b:
      current:
        name: ${disp_name} CT5 Amps
        id: ct5Amps
      power:
        name: ${disp_name} CT5 Watts
        id: ct5Watts
      gain_voltage: ${voltage_cal}
      gain_ct: ${current_cal}
    phase_c:
      current:
        name: ${disp_name} CT6 Amps
        id: ct6Amps
      power:
        name: ${disp_name} CT6 Watts
        id: ct6Watts
      gain_voltage: ${voltage_cal}
      gain_ct: ${current_cal}
    line_frequency: 60Hz
    gain_pga: 1X
    update_interval: ${update_time}

#Total Amps Main
  - platform: template
    name: ${disp_name} Total Amps Main
    id: totalAmpsMain
    lambda: return id(ct1Amps).state + id(ct2Amps).state + id(ct3Amps).state + id(ct4Amps).state + id(ct5Amps).state + id(ct6Amps).state ;
    accuracy_decimals: 2
    unit_of_measurement: A
#    icon: "mdi:flash"
    update_interval: ${update_time}
#Total Amps
  - platform: template
    name: ${disp_name} Total Amps
    id: totalAmps
    lambda: return id(totalAmpsMain).state;
    accuracy_decimals: 2
    unit_of_measurement: A
#    icon: "mdi:flash"
    update_interval: ${update_time}

#Total Watts Main
  - platform: template
    name: ${disp_name} Total Watts Main
    id: totalWattsMain
    lambda: return id(ct1Watts).state + id(ct2Watts).state + id(ct3Watts).state + id(ct4Watts).state + id(ct5Watts).state + id(ct6Watts).state ;
    accuracy_decimals: 1
    unit_of_measurement: W
#    icon: "mdi:flash-circle"
    update_interval: ${update_time}

switch:
  - platform: restart
    name: ${disp_name} Restart
time:
  - platform: sntp
    id: sntp_time
root@tuyaconvert:/home/user#

I'm getting this output when trying to run it:

root@tuyaconvert:/home/user# esphome 6chan_energy_meter-add-on_jp8-jp11.yaml run
INFO Reading configuration 6chan_energy_meter-add-on_jp8-jp11.yaml...
INFO Detected timezone 'UTC' with UTC offset 0
Failed config

sensor.atm90e32: [source 6chan_energy_meter-add-on_jp8-jp11.yaml:65]
  platform: atm90e32
  cs_pin: 5
  phase_a:
    voltage:
      name: cs_nrg_mtr Volts A
      id: ic1Volts
      accuracy_decimals: 2
    current:
      name: cs_nrg_mtr CT1 Amps
      id: ct1Amps
    power:
      name: cs_nrg_mtr CT1 Watts
      id: ct1Watts
    gain_voltage: 7305
    gain_ct: 27518
  phase_b:  [source 6chan_energy_meter-add-on_jp8-jp11.yaml:87]
    current:
      name: cs_nrg_mtr CT2 Amps
      id: ct2Amps

    [power_factor] is an invalid option for [phase_b]. Please check the indentation.
    power_factor:  [source 6chan_energy_meter-add-on_jp8-jp11.yaml:91]
      name: somename
    power:
      name: cs_nrg_mtr CT2 Watts
      id: ct2Watts
    gain_voltage: 7305
    gain_ct: 27518
  phase_c:
    current:
      name: cs_nrg_mtr CT3 Amps
      id: ct3Amps
    power:
      name: cs_nrg_mtr CT3 Watts
      id: ct3Watts
    gain_voltage: 7305
    gain_ct: 27518
  frequency:
    name: cs_nrg_mtr Freq A
  line_frequency: 60Hz
  gain_pga: 1X
  update_interval: 10s
root@tuyaconvert:/home/user#

What am I doing wrong?

elyorkhakimov commented 3 years ago

Never mind, turns out I needed to run ESPhome dev branch

CircuitSetup commented 3 years ago

@elyorkhakimov yes, power factor and a couple others are still in the dev build.