substitutions: hostname: soyosource-gtn-virtual-meter name: soyo device_description: "Monitor a Soyosource GTN and control the power output on demand both via RS485" external_components_source: github://syssi/esphome-soyosource-gtn-virtual-meter@main tx_pin: GPIO4 rx_pin: GPIO5 esphome: name: ${hostname} comment: ${device_description} project: name: "syssi.esphome-soyosource-gtn-virtual-meter" version: 2.0.0 esp8266: board: d1_mini external_components: - source: ${external_components_source} refresh: 0s wifi: ssid: !secret wifi_ssid password: !secret wifi_password ap: ssid: "wifi-setup" password: "soyosource" captive_portal: web_server: local: true ota: # The API is enabled to allow connections from the ESPHome CLI to retrieve some log messages via network api: reboot_timeout: 0s logger: level: DEBUG uart: - id: uart0 baud_rate: 4800 tx_pin: ${tx_pin} rx_pin: ${rx_pin} soyosource_modbus: - id: modbus0 uart_id: uart0 # Optional settings # # The name is used as prefix for some log messages and should # help to distinguish between different instances/devices name: firstfloor_inverter 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 # Setting the timeout to 0s is important because there won't be any powermeter sensor updates power_sensor_inactivity_timeout: 0s power_demand_calculation: NEGATIVE_MEASUREMENTS_REQUIRED min_power_demand: 0 max_power_demand: 900 # 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: 10 # 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_inverter: - id: inverter0 soyosource_modbus_id: modbus0 binary_sensor: - platform: soyosource_inverter soyosource_inverter_id: inverter0 fan_running: name: "${name} fan running" number: - platform: soyosource_virtual_meter soyosource_virtual_meter_id: virtualmeter0 buffer: name: "${name} buffer" initial_value: 10 restore_value: true manual_power_demand: name: "${name} manual power demand" # Use this setting to set a good default on boot up initial_value: 600 max_value: 900 max_power_demand: name: "${name} max power demand" initial_value: 900 max_value: 900 restore_value: true power_demand_divider: name: "${name} power demand divider" initial_value: 1 restore_value: true sensor: - platform: soyosource_virtual_meter soyosource_virtual_meter_id: virtualmeter0 power_demand: name: "${name} power demand" - platform: soyosource_inverter soyosource_inverter_id: inverter0 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" - platform: template name: "dummy powermeter" id: powermeter0 internal: true update_interval: never lambda: |- return 100.0; switch: - platform: soyosource_virtual_meter soyosource_virtual_meter_id: virtualmeter0 manual_mode: name: "${name} manual mode" # You don't want to control this switch. Let's turn in on always and hide it restore_mode: ALWAYS_ON internal: true 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_inverter soyosource_inverter_id: inverter0 operation_status: name: "${name} operation status"