From ca41ef4ace83c624f855a3380a163e0c98bcd6de Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Thu, 30 Jun 2022 07:52:41 +0200 Subject: [PATCH] Use MQTT per default and mention `api` as alternative (#63) --- README.md | 10 ++++++---- esp32-example.yaml | 16 ++++++++++------ esp32-multiple-uarts-example.yaml | 24 +++++++++++++++--------- esp8266-display-example.yaml | 27 +++++++++++++++++++-------- esp8266-example.yaml | 16 ++++++++++------ esp8266-fake-display.yaml | 8 ++++---- esp8266-inverter-emulator.yaml | 8 +++----- esp8266-wifi-dongle-example.yaml | 11 ++++++++++- 8 files changed, 77 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index c19db7c..b3ec202 100644 --- a/README.md +++ b/README.md @@ -102,17 +102,19 @@ wifi: password: !secret wifi_password ota: -# api: - -logger: - baud_rate: 0 +# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component! mqtt: broker: !secret mqtt_host username: !secret mqtt_username password: !secret mqtt_password id: mqtt_client +# api: + +logger: + baud_rate: 0 + uart: baud_rate: 4800 tx_pin: GPIO1 diff --git a/esp32-example.yaml b/esp32-example.yaml index e9fc5ac..f2ef23c 100644 --- a/esp32-example.yaml +++ b/esp32-example.yaml @@ -2,6 +2,8 @@ substitutions: name: soyosource-gtn-virtual-meter 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: GPIO1 + rx_pin: GPIO3 esphome: name: ${name} @@ -22,21 +24,23 @@ wifi: password: !secret wifi_password ota: -# api: - -logger: - baud_rate: 0 +# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component! mqtt: broker: !secret mqtt_host username: !secret mqtt_username password: !secret mqtt_password id: mqtt_client +# api: + +logger: + baud_rate: 0 + uart: baud_rate: 4800 - tx_pin: GPIO1 - rx_pin: GPIO3 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} soyosource_modbus: # Optional settings diff --git a/esp32-multiple-uarts-example.yaml b/esp32-multiple-uarts-example.yaml index e69bfa5..18e3194 100644 --- a/esp32-multiple-uarts-example.yaml +++ b/esp32-multiple-uarts-example.yaml @@ -4,6 +4,10 @@ substitutions: 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_uart0: GPIO1 + rx_pin_uart0: GPIO3 + tx_pin_uart1: GPIO14 + rx_pin_uart1: GPIO4 esphome: name: ${name} @@ -26,28 +30,30 @@ ethernet: clk_mode: GPIO17_OUT phy_addr: 0 -# api: ota: -logger: - baud_rate: 0 - level: INFO - +# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component! mqtt: broker: !secret mqtt_host username: !secret mqtt_username password: !secret mqtt_password id: mqtt_client +# api: + +logger: + baud_rate: 0 + level: INFO + uart: - id: uart0 baud_rate: 4800 - tx_pin: GPIO1 - rx_pin: GPIO3 + tx_pin: ${tx_pin_uart0} + rx_pin: ${rx_pin_uart0} - id: uart1 baud_rate: 4800 - tx_pin: GPIO14 - rx_pin: GPIO4 + tx_pin: ${tx_pin_uart1} + rx_pin: ${rx_pin_uart1} soyosource_modbus: - id: modbus0 diff --git a/esp8266-display-example.yaml b/esp8266-display-example.yaml index d207bf9..38371ac 100644 --- a/esp8266-display-example.yaml +++ b/esp8266-display-example.yaml @@ -1,7 +1,11 @@ substitutions: name: soyosource-gtn-display - device_description: "Monitor and control the WiFi version of the Soyosource GTN via the USB-TTL port and control the power output on demand via RS485" + device_description: "Monitor and control the WiFi version of the Soyosource GTN via the TTL-WIFI 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: GPIO14 + rx_pin_ttl_wifi: GPIO12 + tx_pin_rs485: GPIO4 + rx_pin_rs485: GPIO5 esphome: name: ${name} @@ -22,7 +26,16 @@ wifi: password: !secret wifi_password ota: -api: + +# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component! +mqtt: + broker: !secret mqtt_host + username: !secret mqtt_username + password: !secret mqtt_password + id: mqtt_client + +# api: + logger: level: INFO @@ -30,15 +43,13 @@ logger: uart: - id: uart0 baud_rate: 9600 - tx_pin: GPIO14 - rx_pin: GPIO12 - debug: - direction: BOTH + tx_pin: ${tx_pin_ttl_wifi} + rx_pin: ${rx_pin_ttl_wifi} - id: uart1 baud_rate: 4800 - tx_pin: GPIO4 - rx_pin: GPIO5 + tx_pin: ${tx_pin_rs485} + rx_pin: ${rx_pin_rs485} soyosource_modbus: - id: modbus0 diff --git a/esp8266-example.yaml b/esp8266-example.yaml index 61ec33a..e7dd84f 100644 --- a/esp8266-example.yaml +++ b/esp8266-example.yaml @@ -2,6 +2,8 @@ substitutions: name: soyosource-gtn-virtual-meter 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: GPIO1 + rx_pin: GPIO3 esphome: name: ${name} @@ -22,21 +24,23 @@ wifi: password: !secret wifi_password ota: -# api: - -logger: - baud_rate: 0 +# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component! mqtt: broker: !secret mqtt_host username: !secret mqtt_username password: !secret mqtt_password id: mqtt_client +# api: + +logger: + baud_rate: 0 + uart: baud_rate: 4800 - tx_pin: GPIO1 - rx_pin: GPIO3 + tx_pin: ${tx_pin} + rx_pin: ${rx_pin} soyosource_modbus: # Optional settings diff --git a/esp8266-fake-display.yaml b/esp8266-fake-display.yaml index 391e12a..33d4b8d 100644 --- a/esp8266-fake-display.yaml +++ b/esp8266-fake-display.yaml @@ -1,8 +1,8 @@ substitutions: name: fake-display - device_description: "Emulate the USB-TTL port traffic of the Soyosource GTN (WiFi version)" - tx_pin: GPIO5 - rx_pin: GPIO4 + device_description: "Emulate the TTL-WIFI port traffic of the Soyosource GTN (WiFi version)" + tx_pin: GPIO4 + rx_pin: GPIO5 esphome: name: ${name} @@ -18,8 +18,8 @@ wifi: ssid: !secret wifi_ssid password: !secret wifi_password -api: ota: +api: logger: uart: diff --git a/esp8266-inverter-emulator.yaml b/esp8266-inverter-emulator.yaml index 37106f6..30ac979 100644 --- a/esp8266-inverter-emulator.yaml +++ b/esp8266-inverter-emulator.yaml @@ -1,9 +1,9 @@ substitutions: name: soyosource-gtn-inverter-emu - device_description: "Emulate the USB-TTL port traffic of the Soyosource GTN (WiFi version)" + device_description: "Emulate the TTL-WIFI port traffic of the Soyosource GTN (WiFi version)" external_components_source: github://syssi/esphome-soyosource-gtn-virtual-meter@main - tx_pin: GPIO1 - rx_pin: GPIO3 + tx_pin: GPIO4 + rx_pin: GPIO5 esphome: name: ${name} @@ -25,9 +25,7 @@ wifi: ota: api: - logger: - baud_rate: 0 # Please be careful: The display port has a logic level of 5V. uart: diff --git a/esp8266-wifi-dongle-example.yaml b/esp8266-wifi-dongle-example.yaml index c05222b..25ccb45 100644 --- a/esp8266-wifi-dongle-example.yaml +++ b/esp8266-wifi-dongle-example.yaml @@ -22,7 +22,16 @@ wifi: password: !secret wifi_password ota: -api: + +# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component! +mqtt: + broker: !secret mqtt_host + username: !secret mqtt_username + password: !secret mqtt_password + id: mqtt_client + +# api: + logger: baud_rate: 0 level: INFO