This commit is contained in:
J. Nick Koston 2023-06-18 17:55:46 -05:00
parent 4a5414e983
commit 5eece34862
No known key found for this signature in database
5 changed files with 23 additions and 2 deletions

View File

@ -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"

View File

@ -14,6 +14,7 @@ CONF_TYPE = "type"
TYPES = {
"sync": ButtonType.RATGDO_SYNC,
"query": ButtonType.RATGDO_QUERY,
"close_beep": ButtonType.RATGDO_CLOSE_BEEP,
}

View File

@ -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();
}
}

View File

@ -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 {

View File

@ -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();