Compare commits

...

3 Commits

Author SHA1 Message Date
Paul Wieland 6885b566c2
toggle door when both dry contacts are closed (#307) 2024-07-12 11:21:39 -04:00
Paul Wieland 95eabcb98d
Wall panel detection (#306)
* Fix wall panel detection
2024-07-12 09:16:59 -04:00
Paul Wieland 348e4403db
Wall panel detection (#305)
* Fix wall panel detection
2024-07-12 08:05:28 -04:00
3 changed files with 13 additions and 8 deletions

View File

@ -149,6 +149,8 @@ binary_sensor:
binary_sensor.is_off: ${id_prefix}_dry_contact_close
then:
- cover.open: ${id_prefix}_garage_door
else:
- cover.toggle: ${id_prefix}_garage_door
- platform: gpio
id: "${id_prefix}_dry_contact_close"
pin:

View File

@ -101,6 +101,8 @@ binary_sensor:
binary_sensor.is_off: ${id_prefix}_dry_contact_close
then:
- cover.open: ${id_prefix}_garage_door
else:
- cover.toggle: ${id_prefix}_garage_door
- platform: gpio
id: "${id_prefix}_dry_contact_close"
pin:

View File

@ -64,15 +64,17 @@ namespace ratgdo {
void Secplus1::wall_panel_emulation(size_t index)
{
if (this->wall_panel_emulation_state_ == WallPanelEmulationState::WAITING) {
ESP_LOG1(TAG, "Looking for security+ 1.0 wall panel...");
if (this->wall_panel_starting_) {
this->wall_panel_emulation_state_ = WallPanelEmulationState::WAITING;
} else if (this->wall_panel_emulation_state_ == WallPanelEmulationState::WAITING) {
ESP_LOGD(TAG, "Looking for security+ 1.0 wall panel...");
if (this->door_state != DoorState::UNKNOWN || this->light_state != LightState::UNKNOWN) {
ESP_LOG1(TAG, "Wall panel detected");
return;
}
if (millis() - this->wall_panel_emulation_start_ > 35000 && !this->wall_panel_starting_) {
ESP_LOG1(TAG, "No wall panel detected. Switching to emulation mode.");
ESP_LOGD(TAG, "No wall panel detected. Switching to emulation mode.");
this->wall_panel_emulation_state_ = WallPanelEmulationState::RUNNING;
}
this->scheduler_->set_timeout(this->ratgdo_, "wall_panel_emulation", 2000, [=] {
@ -293,7 +295,10 @@ namespace ratgdo {
void Secplus1::handle_command(const RxCommand& cmd)
{
if (cmd.req == CommandType::QUERY_DOOR_STATUS) {
if (cmd.req == CommandType::TOGGLE_DOOR_RELEASE || cmd.resp == 0x31) {
ESP_LOGD(TAG, "wall panel is starting");
this->wall_panel_starting_ = true;
} else if (cmd.req == CommandType::QUERY_DOOR_STATUS) {
DoorState door_state;
auto val = cmd.resp & 0x7;
@ -365,10 +370,6 @@ namespace ratgdo {
} else if (cmd.req == CommandType::OBSTRUCTION) {
ObstructionState obstruction_state = cmd.resp == 0 ? ObstructionState::CLEAR : ObstructionState::OBSTRUCTED;
this->ratgdo_->received(obstruction_state);
} else if (cmd.req == CommandType::TOGGLE_DOOR_RELEASE) {
if (cmd.resp == 0x31) {
this->wall_panel_starting_ = true;
}
} else if (cmd.req == CommandType::TOGGLE_LIGHT_PRESS) {
// motion was detected, or the light toggle button was pressed
// either way it's ok to trigger motion detection