Skip to content

Commit

Permalink
Add display protocol support of the "Soyosource with display" version (
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi committed Mar 15, 2023
1 parent 7bbe206 commit 3083345
Show file tree
Hide file tree
Showing 14 changed files with 420 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ jobs:
- name: Validate esp8266 example configurations
run: |
esphome -s external_components_source components config esp8266-example.yaml
esphome -s external_components_source components config esp8266-display-display-version-example.yaml
esphome -s external_components_source components config esp8266-display-wifi-version-example.yaml
esphome -s external_components_source components config esp8266-display-wifi-version-limiter-example.yaml
esphome -s external_components_source components config esp8266-limiter-example.yaml
Expand Down Expand Up @@ -228,6 +229,7 @@ jobs:
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 config esp8266-display-display-version-example.yaml
# esphome -s external_components_source components compile esp8266-display-wifi-version-example.yaml
esphome -s external_components_source components compile esp8266-display-wifi-version-limiter-example.yaml
esphome -s external_components_source components compile esp8266-wifi-dongle-example.yaml
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ It looks like there is no GTW (waterproof) version of the device with limiter /
| [esp8266-example.yaml](esp8266-example.yaml) | Monitor[^1] the inverter and control the power output on demand **both** via RS485 using a ESP8266 |
| [esp32-limiter-example.yaml](esp32-limiter-example.yaml) | Control the power output only on demand via RS485 using a ESP32 |
| [esp8266-limiter-example.yaml](esp8266-limiter-example.yaml) | Control the power output only on demand via RS485 using a ESP8266 |
| [esp8266-display-wifi-version-example.yaml](esp8266-display-wifi-version-example.yaml) | Monitor and control the inverter (WiFi version) using the **display port** |
| [esp8266-display-wifi-version-limiter-example.yaml](esp8266-display-wifi-version-limiter-example.yaml) | Monitor and control the inverter (WiFi version) using the **display port** and control the power output on demand via RS485 |
| [esp8266-display-display-version-example.yaml](esp8266-display-display-version-example.yaml) | Monitor and control the inverter (Display version) using the **internal display port** |
| [esp8266-display-wifi-version-example.yaml](esp8266-display-wifi-version-example.yaml) | Monitor and control the inverter (WiFi version) using the **display port** |
| [esp8266-display-wifi-version-limiter-example.yaml](esp8266-display-wifi-version-limiter-example.yaml) | Monitor and control the inverter (WiFi version) using the **display port** and control the power output on demand via RS485 |
| [esp8266-wifi-dongle-example.yaml](esp8266-wifi-dongle-example.yaml) | Monitor and control the inverter using the **OEM WiFi dongle** with a custom firmware |
| [esp8266-wifi-dongle-example-web-only.yaml](esp8266-wifi-dongle-example-web-only.yaml) | Monitor and control the inverter using the **OEM WiFi dongle** with a custom firmware providing a nice **web interface** |
| [esp8266-wifi-dongle-limiter-example.yaml](esp8266-wifi-dongle-limiter-example.yaml) | Monitor and control the inverter using the **OEM WiFi dongle** and control the power output on demand via RS485 |
Expand Down
13 changes: 12 additions & 1 deletion components/soyosource_display/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@
"SoyosourceDisplay", cg.PollingComponent, uart.UARTDevice
)

ProtocolVersion = soyosource_display_ns.enum("ProtocolVersion")
PROTOCOL_VERSION_OPTIONS = {
"SOYOSOURCE_WIFI_VERSION": ProtocolVersion.SOYOSOURCE_WIFI_VERSION,
"SOYOSOURCE_DISPLAY_VERSION": ProtocolVersion.SOYOSOURCE_DISPLAY_VERSION,
}

MULTI_CONF = True

CONF_SOYOSOURCE_DISPLAY_ID = "soyosource_display_id"
CONF_PROTOCOL_VERSION = "protocol_version"

CONF_SOYOSOURCE_DISPLAY_COMPONENT_SCHEMA = cv.Schema(
{
Expand All @@ -26,6 +33,9 @@
cv.Schema(
{
cv.GenerateID(): cv.declare_id(SoyosourceDisplay),
cv.Optional(
CONF_PROTOCOL_VERSION, default="SOYOSOURCE_WIFI_VERSION"
): cv.enum(PROTOCOL_VERSION_OPTIONS, upper=True),
}
)
.extend(cv.polling_component_schema("2s"))
Expand All @@ -36,5 +46,6 @@
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)

await uart.register_uart_device(var, config)

cg.add(var.set_protocol_version(config[CONF_PROTOCOL_VERSION]))
4 changes: 1 addition & 3 deletions components/soyosource_display/button/soyosource_button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ namespace soyosource_display {
static const char *const TAG = "soyosource_display.button";

void SoyosourceButton::dump_config() { LOG_BUTTON("", "SoyosourceDisplay Button", this); }
void SoyosourceButton::press_action() {
this->parent_->send_command(this->holding_register_, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
}
void SoyosourceButton::press_action() { this->parent_->send_command(this->holding_register_); }

} // namespace soyosource_display
} // namespace esphome
6 changes: 3 additions & 3 deletions components/soyosource_display/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
import esphome.config_validation as cv
from esphome.const import (
CONF_BATTERY_VOLTAGE,
ICON_COUNTER,
DEVICE_CLASS_ENERGY,
CONF_TEMPERATURE,
STATE_CLASS_TOTAL_INCREASING,
DEVICE_CLASS_CURRENT,
DEVICE_CLASS_EMPTY,
DEVICE_CLASS_ENERGY,
DEVICE_CLASS_POWER,
DEVICE_CLASS_TEMPERATURE,
DEVICE_CLASS_VOLTAGE,
ENTITY_CATEGORY_DIAGNOSTIC,
ICON_COUNTER,
ICON_CURRENT_AC,
ICON_EMPTY,
STATE_CLASS_MEASUREMENT,
STATE_CLASS_TOTAL_INCREASING,
UNIT_AMPERE,
UNIT_CELSIUS,
UNIT_EMPTY,
Expand Down
Loading

0 comments on commit 3083345

Please sign in to comment.