syssi / esphome-soyosource-gtn-virtual-meter

ESPHome component to simulate the current clamp to control the Soyosource GTN1200 limiter
Apache License 2.0
73 stars 20 forks source link

Buffer is needed, but not working? #146

Closed odroegehorn closed 11 months ago

odroegehorn commented 11 months ago

Hi there, I'm using now the Version 2.1.0. I understood the buffer in such a way, that with a buffer of 20 the Soyo is not producing 500W (with that demand) but 480W. But this is not the case. It's producing exactly, what the demand requests.

How to make it work, that the Soyo produces $Buffer Watts less, than the demand, which comes from a SmartMeter? Thanks, best, Olaf

Chickenbreast0 commented 11 months ago

Can you paste your *.yaml code here?

The buffer is the amount which your setup takes from the grid - in other words: If the buffer is set to 5 then the power from the grid to your home is around 5 Watts, if 10, then it takes 10 Watt from the grid and so on.

With a negative value, -10 Watts for example, then the soyo produces more power to export around 10 Watts to the grid.

@syssi please correct me, if I am wrong. ;)

odroegehorn commented 11 months ago

My .yaml code:

substitutions:
  name: soyosource-line1
  device_description: "Monitor and control the WiFi version of the Soyosource GTN using the OEM WiFi dongle with a alternative firmware"
  external_components_source: github://syssi/esphome-soyosource-gtn-virtual-meter@main
  tx_pin_ttl_wifi: GPIO1
  rx_pin_ttl_wifi: GPIO3
  tx_pin_rs485: GPIO14
  rx_pin_rs485: GPIO5

esphome:
  name: ${name}
  comment: ${device_description}
  project:
    name: "syssi.esphome-soyosource-gtn-virtual-meter"
    version: 2.1.0

esp8266:
  board: esp12e

external_components:
  - source: ${external_components_source}
    refresh: 0s

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

captive_portal:

web_server:
  local: true

ota:

# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component!
mqtt:
  broker: !secret mqtt_host
  username: !secret mqtt_username
  password: !secret mqtt_password
  id: Soyosource_L12
  discovery: false

# api:

logger:
  baud_rate: 0
  level: INFO
  logs:
    soyosource_display: ERROR

uart:
  - id: uart0
    baud_rate: 9600
    tx_pin: ${tx_pin_ttl_wifi}
    rx_pin: ${rx_pin_ttl_wifi}
  - id: uart1
    baud_rate: 4800
    tx_pin: ${tx_pin_rs485}
    rx_pin: ${rx_pin_rs485}

soyosource_modbus:
  - id: modbus0
    uart_id: uart1
    # flow_control_pin: GPIO12

    # Optional settings
    #
    # The name is used as prefix for some log messages and should
    # help to distinguish between different instances/devices
    name: soyosource-line1

soyosource_virtual_meter:
  - id: virtualmeter0
    soyosource_modbus_id: modbus0

    # the state of this sensor (instantaneous power in watt) is used as source
    power_id: powermeter0

    # Optional settings
    power_sensor_inactivity_timeout: 0s
    power_demand_calculation: NEGATIVE_MEASUREMENTS_REQUIRED
    min_power_demand: 0
    max_power_demand: 900
    zero_output_on_min_power_demand: true
    # Split/distribute the power demand if you have multiple inverters attached to the same RS485 bus
    power_demand_divider: 1
    # A positive buffer value (10) tries to avoid exporting power to the grid (demand - 10 watts)
    # A negative buffer value (-10) exports power to the grid (demand + 10 watts)
    buffer: 0
    # The operation_status_id sensor is expected here. Passing the operation_status won't work
    # The state is used to suspend the limiter if the operation status of the inverter isn't 0x0 (normal)
    operation_status_id: operation_status_id0

    # The update interval is important and defaults to 3 seconds. If the demand is sent too frequently
    # or rarely the interverter stops. TODO: Identify and validate the lower and upper update limit
    update_interval: 3s

soyosource_display:
  - id: display0
    uart_id: uart0
    protocol_version: SOYOSOURCE_WIFI_VERSION
    update_interval: 20s

binary_sensor:
  - platform: soyosource_display
    fan_running:
      name: "${name} fan running"
    limiter_connected:
      name: "${name} limiter connected"

button:
  - platform: soyosource_display
    restart:
      name: "${name} restart"

number:
  - platform: soyosource_virtual_meter
    soyosource_virtual_meter_id: virtualmeter0
    buffer:
      name: "${name} buffer"
      initial_value: 0
      restore_value: true
    manual_power_demand:
      name: "${name} manual power demand"
      max_value: 900
    max_power_demand:
      name: "${name} max power demand"
      initial_value: 900
      max_value: 900
      restore_value: false
    power_demand_divider:
      name: "${name} power demand divider"
      initial_value: 1
      restore_value: true

  - platform: soyosource_display
    start_voltage:
      name: "${name} start voltage"
    shutdown_voltage:
      name: "${name} shutdown voltage"
    # Maximum output power in limiter mode / Output power in constant power mode
    output_power_limit:
      name: "${name} output power limit"
    start_delay:
      name: "${name} start delay"

select:
  - platform: soyosource_display
    operation_mode:
      name: "${name} operation mode"
      optionsmap:
        1: "PV"
        2: "Battery Constant Power"
        17: "PV Limit"
        18: "Battery Limit"

sensor:
  - platform: soyosource_virtual_meter
    soyosource_virtual_meter_id: virtualmeter0
    power_demand:
      name: "${name} power demand"

  - platform: soyosource_display
    error_bitmask:
      name: "${name} error bitmask"
    operation_mode_id:
      name: "${name} operation mode id"
    operation_status_id:
      name: "${name} operation status id"
      id: operation_status_id0
    battery_voltage:
      name: "${name} battery voltage"
    battery_current:
      name: "${name} battery current"
    battery_power:
      name: "${name} battery power"
    ac_voltage:
      name: "${name} ac voltage"
    ac_frequency:
      name: "${name} ac frequency"
    temperature:
      name: "${name} temperature"
    total_energy:
      name: "${name} total energy"
    output_power:
      name: "${name} output power"

  # mqtt subscribe example
  - id: powermeter0
    internal: true
    platform: mqtt_subscribe
    name: "${name} instantaneous power consumption"
    topic: "soyosource-line1/sensor/powerdemand/value"
    accuracy_decimals: 2
    unit_of_measurement: W
    device_class: power
    filters:
      - throttle_average: 15s

#   # import smartmeter reading from homeassistant
#   # requires the "api" component see above
#   - platform: homeassistant
#     id: powermeter0
#     name: "${name} smartmeter instantaneous power"
#     entity_id: sensor.firstfloor_smartmeter_instantaneous_power
#     filters:
#       - throttle_average: 15s

switch:
  - platform: soyosource_virtual_meter
    soyosource_virtual_meter_id: virtualmeter0
    manual_mode:
      name: "${name} manual mode"
      restore_mode: RESTORE_DEFAULT_OFF
    emergency_power_off:
      name: "${name} emergency power off"
      restore_mode: RESTORE_DEFAULT_OFF

text_sensor:
  - platform: soyosource_virtual_meter
    soyosource_virtual_meter_id: virtualmeter0
    operation_mode:
      name: "${name} limiter operation mode"

  - platform: soyosource_display
    errors:
      name: "${name} errors"
    operation_mode:
      name: "${name} operation mode"
    operation_status:
      name: "${name} operation status"
odroegehorn commented 11 months ago

Does it mean, that the power_demand is reduced of the amount of buffer?

Chickenbreast0 commented 11 months ago

Does it mean, that the power_demand is reduced of the amount of buffer?

For my understanding and in my experience so far, yes, because: Power Consumption of the house total: 200 Watt - 25 Watt Buffer = 175 Watt need to generated by the soyo. The "reduced" 25 Watt need to be imported from the grid then. I can see clearly a change, when I change the buffer value. I track my total consumption on all 3 phases by using a Shelly 3EM. If I set the buffer to 10, I clearly see a power import of around 10 Watts. Same thing changes for a negative value -> export to grid.

As a suggestion: I recommend using a WT32-ETH01 device instead of an ESP8266 ;)

odroegehorn commented 11 months ago

Thanks, I'm using the Wifi-Dongle with attached RS4845 board, as I don't have fixed Ethernet, where the Soyos are installed. Ok, so understood the Buffer thing now. Tested it, and it works as you described. Thanks.

Chickenbreast0 commented 11 months ago

I am glad, that we sorted it out ;)

syssi commented 11 months ago

Good job guys! :-) I have nothing to add.