diff --git a/base.yaml b/base.yaml index 4dac3a3..7de8a57 100644 --- a/base.yaml +++ b/base.yaml @@ -166,3 +166,8 @@ button: entity_category: diagnostic ratgdo_id: ${id_prefix} name: "Query" + - platform: ratgdo + id: ${id_prefix}_close_beep + type: close_beep + ratgdo_id: ${id_prefix} + name: "Close with beep" \ No newline at end of file diff --git a/components/ratgdo/button/__init__.py b/components/ratgdo/button/__init__.py index e74f93b..af9bf34 100644 --- a/components/ratgdo/button/__init__.py +++ b/components/ratgdo/button/__init__.py @@ -14,6 +14,7 @@ CONF_TYPE = "type" TYPES = { "sync": ButtonType.RATGDO_SYNC, "query": ButtonType.RATGDO_QUERY, + "close_beep": ButtonType.RATGDO_CLOSE_BEEP, } diff --git a/components/ratgdo/button/ratgdo_button.cpp b/components/ratgdo/button/ratgdo_button.cpp index bec2478..6c46b37 100644 --- a/components/ratgdo/button/ratgdo_button.cpp +++ b/components/ratgdo/button/ratgdo_button.cpp @@ -10,7 +10,13 @@ namespace ratgdo { void RATGDOButton::dump_config() { LOG_BUTTON("", "RATGDO Button", this); - ESP_LOGCONFIG(TAG, " Type: %s", this->button_type_ == ButtonType::RATGDO_SYNC ? "Sync" : "Query"); + if (this->button_type_ == ButtonType::RATGDO_SYNC) { + ESP_LOGCONFIG(TAG, " Type: Sync"); + } else if (this->button_type_ == ButtonType::RATGDO_QUERY) { + ESP_LOGCONFIG(TAG, " Type: Query"); + } else if (this->button_type_ == ButtonType::RATGDO_CLOSE_BEEP) { + ESP_LOGCONFIG(TAG, " Type: Close Beep"); + } } void RATGDOButton::press_action() @@ -19,6 +25,8 @@ namespace ratgdo { this->parent_->sync(); } else if (this->button_type_ == ButtonType::RATGDO_QUERY) { this->parent_->query(); + } else if (this->button_type == ButtonType::RATGDO_CLOSE_BEEP) { + this->parent_->closeBeep(); } } diff --git a/components/ratgdo/button/ratgdo_button.h b/components/ratgdo/button/ratgdo_button.h index 4efcb2d..7b0f51e 100644 --- a/components/ratgdo/button/ratgdo_button.h +++ b/components/ratgdo/button/ratgdo_button.h @@ -11,7 +11,8 @@ namespace ratgdo { enum ButtonType { RATGDO_SYNC, - RATGDO_QUERY + RATGDO_QUERY, + RATGDO_CLOSE_BEEP }; class RATGDOButton : public button::Button, public RATGDOClient, public Component { diff --git a/components/ratgdo/ratgdo.h b/components/ratgdo/ratgdo.h index dcd68d3..ffe8aa4 100644 --- a/components/ratgdo/ratgdo.h +++ b/components/ratgdo/ratgdo.h @@ -53,6 +53,7 @@ namespace ratgdo { cmd DOOR2; cmd LIGHT; cmd LOCK; + cmd CLOSE_BEEP; } cmds; const cmds Command = { @@ -66,6 +67,10 @@ namespace ratgdo { .DOOR2 = (cmd) { 0x200000000, 0x01009280 }, .LIGHT = (cmd) { 0x200000000, 0x00009281 }, .LOCK = (cmd) { 0x0100000000, 0x0000728c }, + .CLOSE_BEEP = (cmd) { 0x0400000000, 0x0000010a }, + // command: cmd=040a nibble=01 byte1=01 byte2=e0 fixed=c4a3d2c00a data=e001010a + // time = (byte1 << 8) | byte2; + // .AUTO_CLOSE = (cmd) { 0x0400000000, 0x0000010a }, }; struct RATGDOStore { ISRInternalGPIOPin input_obst; @@ -132,6 +137,7 @@ namespace ratgdo { void lightOff(); bool isLightOn(); void toggleLock(); + void closeBeep(); void lock(); void unlock(); void query();