Skip to content

Commit

Permalink
Streamline configuration examples (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi authored Feb 5, 2023
1 parent 334ec20 commit 37a940f
Show file tree
Hide file tree
Showing 10 changed files with 489 additions and 165 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,20 @@ jobs:
- name: Write secrets.yaml
shell: bash
run: 'echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password" > secrets.yaml'
- name: Write tests/secrets.yaml
shell: bash
run: 'echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password" > tests/secrets.yaml'
- run: |
esphome -s external_components_source components config esp32-example.yaml
esphome -s external_components_source components config esp32-multiple-uarts-example.yaml
- run: |
esphome -s external_components_source components config esp8266-example.yaml
esphome -s external_components_source components config esp8266-display-example.yaml
esphome -s external_components_source components config esp8266-inverter-emulator.yaml
esphome -s external_components_source components config esp8266-wifi-dongle-example.yaml
esphome -s external_components_source components config esp8266-wifi-dongle-example-web-only.yaml
- run: |
esphome -s external_components_source ../components config tests/esp8266-inverter-emulator.yaml
esphome -s external_components_source ../components config tests/esp8266-fake-display.yaml
esphome-compile:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -205,12 +210,17 @@ jobs:
- name: Write secrets.yaml
shell: bash
run: 'echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password" > secrets.yaml'
- name: Write tests/secrets.yaml
shell: bash
run: 'echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password" > tests/secrets.yaml'
- run: |
esphome -s external_components_source components compile esp32-example.yaml
esphome -s external_components_source components compile esp32-multiple-uarts-example.yaml
- run: |
esphome -s external_components_source components compile esp8266-example.yaml
esphome -s external_components_source components compile esp8266-display-example.yaml
esphome -s external_components_source components compile esp8266-inverter-emulator.yaml
esphome -s external_components_source components compile esp8266-wifi-dongle-example.yaml
esphome -s external_components_source components compile esp8266-wifi-dongle-example-web-only.yaml
- run: |
esphome -s external_components_source ../components compile tests/esp8266-inverter-emulator.yaml
esphome -s external_components_source ../components compile tests/esp8266-fake-display.yaml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ secrets.yaml
__pycache__/
*.py[cod]
*$py.class

local/
131 changes: 74 additions & 57 deletions esp32-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,57 +36,82 @@ mqtt:

logger:
baud_rate: 0
level: INFO

uart:
baud_rate: 4800
tx_pin: ${tx_pin}
rx_pin: ${rx_pin}
- id: uart0
baud_rate: 4800
tx_pin: ${tx_pin}
rx_pin: ${rx_pin}

soyosource_modbus:
# Optional settings
#
# The name is used as prefix for some log messages and should
# help to distinguish between different instances/devices
name: firstfloor_inverter
- id: modbus0
uart_id: uart0

soyosource_inverter:
# 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:
# The state of this sensor (instantaneous power in watt) is used as source
power_id: powermeter

# Optional settings
power_sensor_inactivity_timeout: 20s
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_mode_id sensor is expected here. Passing the operation_mode won't work
# The state is used to suspend the limiter if the operation mode of the inverter isn't 0x0 (normal)
operation_mode_id: operation_mode_id

# 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
- 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: 20s
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_mode_id sensor is expected here. Passing the operation_mode won't work
# The state is used to suspend the limiter if the operation mode of the inverter isn't 0x0 (normal)
# operation_mode_id: operation_mode_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
manual_power_demand:
name: "${name} manual power demand"
max_value: 900
max_power_demand:
name: "${name} max power demand"
initial_value: 600
max_value: 900
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_mode_id:
name: "${name} operation mode id"
id: operation_mode_id
id: operation_mode_id0
battery_voltage:
name: "${name} battery voltage"
battery_current:
Expand All @@ -101,7 +126,7 @@ sensor:
name: "${name} temperature"

# mqtt subscribe example
- id: powermeter
- id: powermeter0
internal: true
platform: mqtt_subscribe
name: "${name} instantaneous power consumption"
Expand All @@ -112,39 +137,31 @@ sensor:
filters:
- throttle_average: 15s

text_sensor:
- platform: soyosource_inverter
operation_mode:
name: "${name} operation mode"
- platform: soyosource_virtual_meter
operation_mode:
name: "${name} operation mode"

number:
- platform: soyosource_virtual_meter
manual_power_demand:
name: "${name} manual power demand"
max_value: 900
max_power_demand:
name: "${name} max power demand"
initial_value: 600
max_value: 900
restore_value: true
# # 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_ON
emergency_power_off:
name: "${name} emergency power off"
restore_mode: RESTORE_DEFAULT_OFF

# # import smartmeter reading from homeassistant
# # requires the "api" component see above
# - platform: homeassistant
# id: powermeter
# name: "${name} smartmeter instantaneous power"
# entity_id: sensor.firstfloor_smartmeter_instantaneous_power
# filters:
# - throttle_average: 15s
text_sensor:
- platform: soyosource_inverter
soyosource_inverter_id: inverter0
operation_mode:
name: "${name} operation mode"
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
operation_mode:
name: "${name} operation mode"
96 changes: 53 additions & 43 deletions esp32-multiple-uarts-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ soyosource_virtual_meter:
# 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_mode_id sensor is expected here. Passing the operation_mode won't work
# The state is used to suspend the limiter if the operation mode of the inverter isn't 0x0 (normal)
# operation_mode_id: operation_mode_id0

- id: virtualmeter1
soyosource_modbus_id: modbus1
update_interval: 3s
Expand All @@ -97,6 +101,9 @@ soyosource_virtual_meter:
# 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_mode_id sensor is expected here. Passing the operation_mode won't work
# The state is used to suspend the limiter if the operation mode of the inverter isn't 0x0 (normal)
# operation_mode_id: operation_mode_id1

binary_sensor:
- platform: soyosource_inverter
Expand All @@ -108,6 +115,29 @@ binary_sensor:
fan_running:
name: "${device1} fan running"

number:
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
manual_power_demand:
name: "${device0} manual power demand"
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter1
manual_power_demand:
name: "${device1} manual power demand"

- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
max_power_demand:
name: "${device0} max power demand"
initial_value: 600
restore_value: true
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter1
max_power_demand:
name: "${device1} max power demand"
initial_value: 600
restore_value: true

sensor:
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
Expand All @@ -122,6 +152,7 @@ sensor:
soyosource_inverter_id: inverter0
operation_mode_id:
name: "${device0} operation mode id"
id: operation_mode_id0
battery_voltage:
name: "${device0} battery voltage"
battery_current:
Expand All @@ -138,6 +169,7 @@ sensor:
soyosource_inverter_id: inverter1
operation_mode_id:
name: "${device1} operation mode id"
id: operation_mode_id1
battery_voltage:
name: "${device1} battery voltage"
battery_current:
Expand Down Expand Up @@ -174,16 +206,27 @@ sensor:
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
# # 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: "${device0} manual mode"
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter1
manual_mode:
name: "${device1} manual mode"

text_sensor:
- platform: soyosource_inverter
Expand All @@ -202,36 +245,3 @@ text_sensor:
soyosource_virtual_meter_id: virtualmeter1
operation_mode:
name: "${device1} operation mode"

switch:
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
manual_mode:
name: "${device0} manual mode"
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter1
manual_mode:
name: "${device1} manual mode"

number:
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
manual_power_demand:
name: "${device0} manual power demand"
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter1
manual_power_demand:
name: "${device1} manual power demand"

- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter0
max_power_demand:
name: "${device0} max power demand"
initial_value: 600
restore_value: true
- platform: soyosource_virtual_meter
soyosource_virtual_meter_id: virtualmeter1
max_power_demand:
name: "${device1} max power demand"
initial_value: 600
restore_value: true
Loading

0 comments on commit 37a940f

Please sign in to comment.