substitutions: name: soyosource-gtn-display hostname: soyo device_description: "Monitor and control the Soyosource GTN via the display port and control the power output on demand via RS485" external_components_source: github://syssi/esphome-soyosource-gtn-virtual-meter@main tx_pin_ttl_wifi: GPIO4 rx_pin_ttl_wifi: GPIO5 tx_pin_rs485: GPIO14 rx_pin_rs485: GPIO12 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 # Please be careful: The display port has a logic level of 5V. uart: - id: uart0 baud_rate: 9600 tx_pin: ${tx_pin_ttl_wifi} rx_pin: ${rx_pin_ttl_wifi} debug: direction: BOTH - id: uart1 baud_rate: 4800 tx_pin: ${tx_pin_rs485} rx_pin: ${rx_pin_rs485} debug: direction: BOTH soyosource_modbus: - id: modbus0 uart_id: uart1 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_display: - id: display0 uart_id: uart0 update_interval: 5s 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: 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 - 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" output_power: name: "${name} output power" - 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_display errors: name: "${name} errors" operation_mode: name: "${name} operation mode" operation_status: name: "${name} operation status"