Ultra: Growatt uitlezen

Onderstaande configuratie is gebruikt voor het uitlezen van een Growatt omvormern via de modbus RS485 (RTU) poort van de Ultra Mini. Alles verzamelde gegevens Slimme meter, Modbus en waterlezer worden zo gecombineerd.

Met dank aan Bart :-)

esphome:
  name: ultra-p1-h2o-kwh-growatt
  comment: "Smart-stuff ultra"
  name_add_mac_suffix: false
  platformio_options:
    upload_speed: 1500000

esp32:
  variant: esp32s3
  board: esp32-s3-devkitc-1

mqtt:
  broker: 192.168.1.20
  username: *****
  password: *****

ethernet:
  type: W5500
  cs_pin: 10
  clk_pin: 12
  mosi_pin: 11
  miso_pin: 13
  interrupt_pin: 14

ota:

web_server:

# improv_serial:
#   next_url: http://{{ip_address}}

api:
  services:
    - service: p1_dongle_reboot
      then:
        - button.press:
            id: reboot
    - service: set_water_total
      variables:
        set_value: int
      then:
        - globals.set:
            id: totalWaterUsage
            value: !lambda 'return set_value;'

globals:
  - id: totalWaterUsage
    type: int
    restore_value: true      # aanpassen naar no indien de nieuwe waarde onder de oude ligt
    initial_value: '0'
  - id: pulse_rate
    type: int
    restore_value: no  # aanpassen naar no indien de nieuwe waarde onder de oude ligt
    initial_value: '800'   # pulse rate van de kWh meter -> xxx pulses / kWh

# Enable logging
logger:
  level: error

uart:
  - id: uart_pv
    tx_pin: 3
    rx_pin: 1
    baud_rate: 9600
    parity: even
    stop_bits: 1
  - id: uart_p1
    rx_pin:
      number: 18
      inverted: true
    baud_rate: 115200
    rx_buffer_size: 1700

modbus:
  - uart_id: uart_pv
    id: modbus_client
    flow_control_pin: 2
    send_wait_time: 200ms

modbus_controller:
  - id: modbus_pv
    modbus_id: modbus_client
    address: 1
    setup_priority: -10
    update_interval: 5s
    command_throttle: 200ms

dsmr:
 id: dsmr_instance
 uart_id: uart_p1
 receive_timeout: 200ms
 max_telegram_length: 1700
 request_pin:
    number: 17
    inverted: true

light:
  - platform: status_led
    name: "status led"
    output: status_output
    internal: true
  - platform: neopixelbus
    variant: WS2812
    pin: 42
    num_leds: 1
    name: "_Status LED"
    id: esp32c3_rgb_led
    entity_category: config
    restore_mode: ALWAYS_OFF
    internal: true

switch:
  - platform: template
    id: status_led_switch
    # name: "Status LED Switch"
    optimistic: true
    on_turn_on:
      - light.turn_on:
          id: esp32c3_rgb_led
          red:   0%
          green: 0%
          blue: 100%
          brightness: 40%
          transition_length: 50ms
    on_turn_off:
      - light.turn_off:
          id: esp32c3_rgb_led
          transition_length: 50ms
  - platform: modbus_controller
    register_type: holding
    address: 0
    name: "PV State"
    bitmask: 1

output:
  - platform: template
    id: status_output
    type: binary
    write_action:
      - if:
          condition:
             lambda: return state > 0;
          then:
            - if:
                condition:
                  switch.is_off: status_led_switch
                then:
                  switch.turn_on: status_led_switch
          else:
            - if:
                condition:
                  switch.is_on: status_led_switch
                then:
                  switch.turn_off: status_led_switch

button:
  - platform: restart
    name: "_Restart device"
    id: reboot
  - platform: factory_reset
    name: "_Restart with Factory Default Settings"

binary_sensor:
  - platform: gpio
    pin:
      number: 0
      inverted: true
      mode:
        input: true
        pullup: true
    name: _PushButton
    on_press:
      then:
        - switch.toggle: status_led_switch

sensor:
  - platform: pulse_counter
    pin:
      number: 46
      mode:
        input: true
        pullup: true
    id: watermeter_pulse
    name: "Watermeter pulse"
    count_mode:
      rising_edge: DISABLE
      falling_edge: INCREMENT
    state_class: measurement
    update_interval: 1s
    accuracy_decimals: 0
    unit_of_measurement: 'L/min'

  - platform: template
    name: "Watermeter total"
    state_class: "total_increasing"
    device_class: "water"
    icon: mdi:water
    update_interval: 1s
    unit_of_measurement: L
    accuracy_decimals: 0
    lambda: |-
      if (id(watermeter_pulse).state > 0) id(totalWaterUsage) += 1;
      return id(totalWaterUsage);

  - platform: pulse_meter
    id: pulse
    name: EVSE Current Power
    pin:
      number: 45
      mode:
        input: true
        pullup: true #v3.5 aanzetten
    state_class: measurement
    unit_of_measurement: 'W'
    device_class: power
    internal_filter: 100ms
    internal_filter_mode: EDGE
    icon: mdi:flash-outline
    filters:
      #- multiply: 0.06 # (60s/1000 pulses per kWh)
      - lambda: return x * ((60.0 / id(pulse_rate)) * 1000.0);
    total:
      name: "EVSE Total Energy"
      id: pulse_tot
      unit_of_measurement: "kWh"
      icon: mdi:circle-slice-3
      state_class: total_increasing
      device_class: energy
      accuracy_decimals: 3
      filters:
        - lambda: return x * (1.0 / id(pulse_rate));

  - platform: dsmr
    energy_delivered_tariff1:
      name: "Energy Consumed Tariff 1"
      state_class: total_increasing
    energy_delivered_tariff2:
      name: "Energy Consumed Tariff 2"
      state_class: total_increasing
    energy_returned_tariff1:
      name: "Energy Produced Tariff 1"
      state_class: total_increasing
    energy_returned_tariff2:
      name: "Energy Produced Tariff 2"
      state_class: total_increasing
    power_delivered:
      name: "Power Consumed"
      unit_of_measurement: "W"
      state_class: "measurement"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_returned:
      name: "Power Produced"
      unit_of_measurement: "W"
      state_class: "measurement"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    electricity_failures:
      name: "Electricity Failures"
      icon: mdi:alert
    electricity_long_failures:
      name: "Long Electricity Failures"
      icon: mdi:alert
    voltage_l1:
      name: "Voltage Phase 1"
    voltage_l2:
      name: "Voltage Phase 2"
    voltage_l3:
      name: "Voltage Phase 3"
    current_l1:
      name: "Current Phase 1"
    current_l2:
      name: "Current Phase 2"
    current_l3:
      name: "Current Phase 3"
    power_delivered_l1:
      name: "Power Consumed Phase 1"
      unit_of_measurement: "W"
      state_class: "measurement"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_delivered_l2:
      name: "Power Consumed Phase 2"
      unit_of_measurement: "W"
      state_class: "measurement"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_delivered_l3:
      name: "Power Consumed Phase 3"
      unit_of_measurement: "W"
      state_class: "measurement"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_returned_l1:
      name: "Power Produced Phase 1"
      unit_of_measurement: "W"
      state_class: "measurement"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_returned_l2:
      name: "Power Produced Phase 2"
      unit_of_measurement: "W"
      state_class: "measurement"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_returned_l3:
      name: "Power Produced Phase 3"
      unit_of_measurement: "W"
      state_class: "measurement"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    gas_delivered:
      name: "Gas Consumed"
      state_class: total_increasing
    gas_delivered_be:
      name: "Gas Consumed Belgium"
      state_class: total_increasing
  - platform: uptime
    name: "_Uptime"

  - platform: modbus_controller
    name: "PV Power"
    address: 6
    register_type: "read"
    unit_of_measurement: W
    device_class: power
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
  - platform: modbus_controller
    name: "PV Today"
    address: 54
    register_type: "read"
    unit_of_measurement: kWh
    device_class: power
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
  - platform: modbus_controller
    name: "PV Total"
    address: 56
    register_type: "read"
    unit_of_measurement: kWh
    device_class: power
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
  - platform: modbus_controller
    name: "PV Voltage"
    address: 3
    register_type: "read"
    unit_of_measurement: V
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
  - platform: modbus_controller
    name: "PV Current"
    address: 4
    register_type: "read"
    unit_of_measurement: A
    icon: mdi:flash
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1
  - platform: modbus_controller
    name: "PV Inverter Temperature"
    address: 93
    register_type: "read"
    unit_of_measurement: °C
    device_class: temperature
    icon: mdi:thermometer
    value_type: U_WORD
    accuracy_decimals: 1
    filters:
    - multiply: 0.1

text_sensor:
  - platform: dsmr
    identification:
      name: "DSMR Identification"
    p1_version:
      name: "DSMR Version"
    p1_version_be:
      name: "DSMR Version Belgium"
  - platform: version
    name: "_ESPHome Version"
    hide_timestamp: true

Last updated