Date: Sat, 6 Jan 2024 09:27:39 -1000
Subject: [PATCH] chore: prepare for v1 support
---
.github/workflows/build.yml | 17 ++++++-----
README.md | 15 ++++-----
components/ratgdo/__init__.py | 14 +++++++++
static/index.html | 28 +++++++++++------
static/v25iboard_secplusv1.png | Bin 0 -> 303545 bytes
static/v25iboard_secplusv1.yaml | 52 ++++++++++++++++++++++++++++++++
v25iboard_secplusv1.yaml | 1 +
7 files changed, 103 insertions(+), 24 deletions(-)
create mode 100644 static/v25iboard_secplusv1.png
create mode 100644 static/v25iboard_secplusv1.yaml
create mode 120000 v25iboard_secplusv1.yaml
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ef23eb0..49b4c8b 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -17,26 +17,29 @@ jobs:
matrix:
firmware:
- file: v2board_esp8266_d1_mini_lite.yaml
- name: V2.0 Board ESP8266 D1 Mini Lite
+ name: V2.0 Board ESP8266 D1 Mini Lite Security+ 2.0
manifest_filename: v2board_esp8266_d1_mini_lite-manifest.json
- file: v2board_esp8266_d1_mini.yaml
- name: V2.0 Board ESP8266 D1 Mini
+ name: V2.0 Board ESP8266 D1 Mini Security+ 2.0
manifest_filename: v2board_esp8266_d1_mini-manifest.json
- file: v2board_esp32_d1_mini.yaml
- name: V2.0 Board ESP32 D1 Mini
+ name: V2.0 Board ESP32 D1 Mini Security+ 2.0
manifest_filename: v2board_esp32_d1_mini-manifest.json
- file: v2board_esp32_lolin_s2_mini.yaml
- name: V2.0 Board ESP32 lolin S2 mini
+ name: V2.0 Board ESP32 lolin S2 mini Security+ 2.0
manifest_filename: v2board_esp32_lolin_s2_mini-manifest.json
- file: v25board_esp8266_d1_mini_lite.yaml
- name: V2.5 Board ESP8266 D1 Mini Lite
+ name: V2.5 Board ESP8266 D1 Mini Lite Security+ 2.0
manifest_filename: v25board_esp8266_d1_mini_lite-manifest.json
- file: v25board_esp32_d1_mini.yaml
- name: V2.5 Board ESP32 D1 Mini
+ name: V2.5 Board ESP32 D1 Mini Security+ 2.0
manifest_filename: v25board_esp32_d1_mini-manifest.json
- file: v25iboard.yaml
- name: V2.5i Board
+ name: V2.5i Board Security+ 2.0
manifest_filename: v25iboard-manifest.json
+ - file: v25iboard_secplusv1.yaml
+ name: V2.5i Board Security+ 1.0
+ manifest_filename: v25iboard-manifest_secplusv1.json
fail-fast: false
steps:
- name: Checkout source code
diff --git a/README.md b/README.md
index 1975f3f..d096344 100644
--- a/README.md
+++ b/README.md
@@ -19,13 +19,14 @@ The ESPHome firmware will allow you to open the door to any position after calib
## ESPHome config
-- [ESPHome config for v2.0 board with ESP8266 D1 Mini](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v2board_esp8266_d1_mini.yaml)
-- [ESPHome config for v2.0 board with ESP8266 D1 Mini lite](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v2board_esp8266_d1_mini_lite.yaml)
-- [ESPHome config for v2.0 board with ESP32 D1 Mini](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v2board_esp32_d1_mini.yaml)
-- [ESPHome config for v2.0 board with ESP32 Lolin D2 Mini](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v2board_esp32_lolin_s2_mini.yaml)
-- [ESPHome config for v2.5 board with ESP8266 D1 Mini lite](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v25board_esp8266_d1_mini_lite.yaml)
-- [ESPHome config for v2.5 board with ESP32 D1 Mini](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v25board_esp32_d1_mini.yaml)
-- [ESPHome config for v2.5i board](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v25iboard.yaml)
+- [Security+ 2.0 ESPHome config for v2.0 board with ESP8266 D1 Mini](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v2board_esp8266_d1_mini.yaml)
+- [Security+ 2.0 ESPHome config for v2.0 board with ESP8266 D1 Mini lite](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v2board_esp8266_d1_mini_lite.yaml)
+- [Security+ 2.0 ESPHome config for v2.0 board with ESP32 D1 Mini](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v2board_esp32_d1_mini.yaml)
+- [Security+ 2.0 ESPHome config for v2.0 board with ESP32 Lolin D2 Mini](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v2board_esp32_lolin_s2_mini.yaml)
+- [Security+ 2.0 ESPHome config for v2.5 board with ESP8266 D1 Mini lite](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v25board_esp8266_d1_mini_lite.yaml)
+- [Security+ 2.0 ESPHome config for v2.5 board with ESP32 D1 Mini](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v25board_esp32_d1_mini.yaml)
+- [Security+ 2.0 ESPHome config for v2.5i board](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v25iboard.yaml)
+- [Security+ 1.0 ESPHome config for v2.5i board](https://github.com/RATGDO/esphome-ratgdo/blob/main/static/v25iboard_secplusv1.yaml)
- [Web Installer](https://ratgdo.github.io/esphome-ratgdo/)
diff --git a/components/ratgdo/__init__.py b/components/ratgdo/__init__.py
index d584c33..5892646 100644
--- a/components/ratgdo/__init__.py
+++ b/components/ratgdo/__init__.py
@@ -2,6 +2,7 @@ import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import automation, pins
from esphome.const import CONF_ID, CONF_TRIGGER_ID
+import voluptuous as vol
DEPENDENCIES = ["preferences"]
MULTI_CONF = True
@@ -28,6 +29,11 @@ CONF_RATGDO_ID = "ratgdo_id"
CONF_ON_SYNC_FAILED = "on_sync_failed"
+CONF_PROTOCOL = "protocol"
+
+PROTOCOL_SECPLUSV1 = "secplusv1"
+PROTOCOL_SECPLUSV2 = "secplusv2"
+SUPPORTED_PROTOCOLS = [PROTOCOL_SECPLUSV1, PROTOCOL_SECPLUSV2]
CONFIG_SCHEMA = cv.Schema(
{
@@ -46,6 +52,9 @@ CONFIG_SCHEMA = cv.Schema(
cv.GenerateID(CONF_TRIGGER_ID): cv.declare_id(SyncFailed),
}
),
+ cv.Optional(
+ CONF_PROTOCOL, default=PROTOCOL_SECPLUSV2
+ ): vol.In(SUPPORTED_PROTOCOLS)
}
).extend(cv.COMPONENT_SCHEMA)
@@ -85,3 +94,8 @@ async def to_code(config):
repository="https://github.com/ratgdo/espsoftwareserial#autobaud",
version=None,
)
+
+ if config[CONF_PROTOCOL] == PROTOCOL_SECPLUSV1:
+ cg.add_define("PROTOCOL_SECPLUSV1")
+ elif config[CONF_PROTOCOL] == PROTOCOL_SECPLUSV2:
+ cg.add_define("PROTOCOL_SECPLUSV2")
diff --git a/static/index.html b/static/index.html
index 9493603..2bb2e1f 100644
--- a/static/index.html
+++ b/static/index.html
@@ -158,11 +158,11 @@
Note: At the moment ESPHome only supports Security + 2.0 door openers (Yellow learn button). Support for other protocols is coming.
- v2.5i/2.52i Board
+ v2.5i/2.52i Board Security+ 2.0
@@ -171,16 +171,24 @@
Version 2.5i Dry Contact Wiring Diagram