substitutions: name: soyosource-gtn-virtual-meter device_description: "Monitor multiple Soyosource GTNs and control the power output on demand both via RS485" device0: firstfloor_soyosource_gtn_virtual_meter device1: groundfloor_soyosource_gtn_virtual_meter external_components_source: github://syssi/esphome-soyosource-gtn-virtual-meter@main tx_pin_uart_0: GPIO1 rx_pin_uart_0: GPIO3 tx_pin_uart_1: GPIO14 rx_pin_uart_1: GPIO4 esphome: name: ${name} friendly_name: ${name} comment: ${device_description} project: name: "syssi.esphome-soyosource-gtn-virtual-meter" version: 2.6.0 devices: - id: device0 name: "${device0}" - id: device1 name: "${device1}" esp32: board: esp-wrover-kit framework: type: esp-idf external_components: - source: ${external_components_source} refresh: 0s ethernet: type: LAN8720 mdc_pin: GPIO23 mdio_pin: GPIO18 clk_mode: GPIO17_OUT phy_addr: 0 ota: platform: esphome logger: baud_rate: 0 level: INFO # If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component! # The native API has many advantages over MQTT: https://esphome.io/components/api.html#advantages-over-mqtt mqtt: broker: !secret mqtt_host username: !secret mqtt_username password: !secret mqtt_password id: mqtt_client # api: uart: - id: uart_0 baud_rate: 4800 tx_pin: ${tx_pin_uart_0} rx_pin: ${rx_pin_uart_0} - id: uart_1 baud_rate: 4800 tx_pin: ${tx_pin_uart_1} rx_pin: ${rx_pin_uart_1} soyosource_modbus: - id: modbus0 uart_id: uart_0 # flow_control_pin: GPIO12 # The name is used as prefix for some log messages and should # help to distinguish between different instances/devices name: firstfloor - id: modbus1 uart_id: uart_1 name: groundfloor # flow_control_pin: GPIO13 soyosource_inverter: - id: inverter0 soyosource_modbus_id: modbus0 - id: inverter1 soyosource_modbus_id: modbus1 soyosource_virtual_meter: - id: virtualmeter0 soyosource_modbus_id: modbus0 update_interval: 3s # the state of this sensor (instantaneous power in watt) is used as source power_id: powermeter0 power_sensor_inactivity_timeout: 20s power_demand_calculation: NEGATIVE_MEASUREMENTS_REQUIRED min_power_demand: 0 max_power_demand: 900 zero_output_on_min_power_demand: true # 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 - id: virtualmeter1 soyosource_modbus_id: modbus1 update_interval: 3s # the state of this sensor (instantaneous power in watt) is used as source power_id: powermeter1 power_sensor_inactivity_timeout: 20s power_demand_calculation: NEGATIVE_MEASUREMENTS_REQUIRED min_power_demand: 0 max_power_demand: 900 zero_output_on_min_power_demand: true # 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_id1 binary_sensor: - platform: soyosource_inverter soyosource_inverter_id: inverter0 fan_running: name: "fan running" device_id: device0 - platform: soyosource_inverter soyosource_inverter_id: inverter1 fan_running: name: "fan running" device_id: device1 number: - platform: soyosource_virtual_meter soyosource_virtual_meter_id: virtualmeter0 buffer: name: "buffer" device_id: device0 initial_value: 10 restore_value: true manual_power_demand: name: "manual power demand" device_id: device0 max_power_demand: name: "max power demand" device_id: device0 initial_value: 600 restore_value: true power_demand_divider: name: "power demand divider" device_id: device0 initial_value: 1 restore_value: true - platform: soyosource_virtual_meter soyosource_virtual_meter_id: virtualmeter1 buffer: name: "buffer" device_id: device1 initial_value: 10 restore_value: true manual_power_demand: name: "manual power demand" device_id: device1 max_power_demand: name: "max power demand" device_id: device1 initial_value: 600 restore_value: true power_demand_divider: name: "power demand divider" device_id: device1 initial_value: 1 restore_value: true sensor: - platform: soyosource_virtual_meter soyosource_virtual_meter_id: virtualmeter0 power_demand: name: "power demand" device_id: device0 - platform: soyosource_virtual_meter soyosource_virtual_meter_id: virtualmeter1 power_demand: name: "power demand" device_id: device1 - platform: soyosource_inverter soyosource_inverter_id: inverter0 operation_status_id: name: "operation status id" device_id: device0 id: operation_status_id0 battery_voltage: name: "battery voltage" device_id: device0 battery_current: name: "battery current" device_id: device0 battery_power: name: "battery power" device_id: device0 ac_voltage: name: "ac voltage" device_id: device0 ac_frequency: name: "ac frequency" device_id: device0 temperature: name: "temperature" device_id: device0 - platform: soyosource_inverter soyosource_inverter_id: inverter1 operation_status_id: name: "operation status id" device_id: device1 id: operation_status_id1 battery_voltage: name: "battery voltage" device_id: device1 battery_current: name: "battery current" device_id: device1 battery_power: name: "battery power" device_id: device1 ac_voltage: name: "ac voltage" device_id: device1 ac_frequency: name: "ac frequency" device_id: device1 temperature: name: "temperature" device_id: device1 # mqtt subscribe example - id: powermeter0 internal: true platform: mqtt_subscribe name: "${device0} instantaneous power consumption" topic: "smartmeter/sensor/firstfloor/obis/1-0:16.7.0/255/value" accuracy_decimals: 2 unit_of_measurement: W device_class: power filters: - throttle_average: 15s - id: powermeter1 internal: true platform: mqtt_subscribe name: "${device1} instantaneous power consumption" topic: "smartmeter/sensor/groundfloor/obis/1-0:16.7.0/255/value" accuracy_decimals: 2 unit_of_measurement: W device_class: power filters: - throttle_average: 15s # # import smartmeter reading from homeassistant f.e. # # requires the "api" component see above # - platform: homeassistant # id: powermeter0 # name: "${device0} smartmeter instantaneous power" # entity_id: sensor.firstfloor_smartmeter_instantaneous_power # # - platform: homeassistant # id: powermeter1 # name: "${device1} smartmeter instantaneous power" # entity_id: sensor.groundfloor_smartmeter_instantaneous_power switch: - platform: soyosource_virtual_meter soyosource_virtual_meter_id: virtualmeter0 manual_mode: name: "manual mode" device_id: device0 - platform: soyosource_virtual_meter soyosource_virtual_meter_id: virtualmeter1 manual_mode: name: "manual mode" device_id: device1 text_sensor: - platform: soyosource_inverter soyosource_inverter_id: inverter0 operation_status: name: "operation status" device_id: device0 - platform: soyosource_inverter soyosource_inverter_id: inverter1 operation_status: name: "operation status" device_id: device1 - platform: soyosource_virtual_meter soyosource_virtual_meter_id: virtualmeter0 operation_mode: name: "limiter operation mode" device_id: device0 - platform: soyosource_virtual_meter soyosource_virtual_meter_id: virtualmeter1 operation_mode: name: "limiter operation mode" device_id: device1