Compare commits

..

No commits in common. "fbf979cab9d16b287cafecf9960a5918e19543eb" and "31fa0e8082f9c1ff0f4d6e637483565025e85c3d" have entirely different histories.

8 changed files with 16 additions and 41 deletions

View File

@ -9,10 +9,6 @@ external_components:
preferences:
flash_write_interval: 1min
text_sensor:
- platform: version
name: "Firmware Version"
ratgdo:
id: ${id_prefix}
input_gdo_pin: ${uart_rx_pin}

View File

@ -9,10 +9,6 @@ external_components:
preferences:
flash_write_interval: 1min
text_sensor:
- platform: version
name: "Firmware Version"
ratgdo:
id: ${id_prefix}
input_gdo_pin: ${uart_rx_pin}

View File

@ -102,10 +102,9 @@ namespace ratgdo {
virtual void dump_config();
virtual void sync();
// dry contact methods
virtual void set_open_limit(bool);
virtual void set_close_limit(bool);
virtual void set_discrete_open_pin(InternalGPIOPin* pin);
virtual void set_discrete_close_pin(InternalGPIOPin* pin);

View File

@ -52,11 +52,6 @@ namespace ratgdo {
// many things happening at startup, use some delay for sync
set_timeout(SYNC_DELAY, [=] { this->sync(); });
ESP_LOGD(TAG, " _____ _____ _____ _____ ____ _____ ");
ESP_LOGD(TAG, "| __ | _ |_ _| __| \\| |");
ESP_LOGD(TAG, "| -| | | | | | | | | | |");
ESP_LOGD(TAG, "|__|__|__|__| |_| |_____|____/|_____|");
ESP_LOGD(TAG, "https://paulwieland.github.io/ratgdo/");
}
// initializing protocol, this gets called before setup() because
@ -423,14 +418,16 @@ namespace ratgdo {
void RATGDOComponent::sync()
{
this->protocol_->sync();
}
// dry contact protocol:
// needed to trigger the intial state of the limit switch sensors
// ideally this would be in drycontact::sync
#ifdef PROTOCOL_DRYCONTACT
this->protocol_->set_open_limit(this->dry_contact_open_sensor_->state);
this->protocol_->set_close_limit(this->dry_contact_close_sensor_->state);
#endif
void RATGDOComponent::set_open_limit(bool state)
{
this->protocol_->set_open_limit(state);
}
void RATGDOComponent::set_close_limit(bool state)
{
this->protocol_->set_close_limit(state);
}
void RATGDOComponent::door_open()
@ -686,23 +683,21 @@ namespace ratgdo {
this->learn_state.subscribe([=](LearnState state) { defer("learn_state", [=] { f(state); }); });
}
// dry contact methods
void RATGDOComponent::set_dry_contact_open_sensor(esphome::gpio::GPIOBinarySensor* dry_contact_open_sensor)
{
dry_contact_open_sensor_ = dry_contact_open_sensor;
dry_contact_open_sensor_->add_on_state_callback([this](bool sensor_value)
{
this->protocol_->set_open_limit(sensor_value);
this->set_open_limit(sensor_value);
}
);
}
void RATGDOComponent::set_dry_contact_close_sensor(esphome::gpio::GPIOBinarySensor* dry_contact_close_sensor)
{
dry_contact_close_sensor_ = dry_contact_close_sensor;
dry_contact_close_sensor_->add_on_state_callback([this](bool sensor_value)
{
this->protocol_->set_close_limit(sensor_value);
this->set_close_limit(sensor_value);
}
);
}

View File

@ -92,9 +92,9 @@ namespace ratgdo {
void set_input_gdo_pin(InternalGPIOPin* pin) { this->input_gdo_pin_ = pin; }
void set_input_obst_pin(InternalGPIOPin* pin) { this->input_obst_pin_ = pin; }
// dry contact methods
void set_dry_contact_open_sensor(esphome::gpio::GPIOBinarySensor* dry_contact_open_sensor_);
void set_dry_contact_close_sensor(esphome::gpio::GPIOBinarySensor* dry_contact_close_sensor_);
void set_discrete_open_pin(InternalGPIOPin* pin){ this->protocol_->set_discrete_open_pin(pin); }
void set_discrete_close_pin(InternalGPIOPin* pin){ this->protocol_->set_discrete_close_pin(pin); }
@ -152,6 +152,8 @@ namespace ratgdo {
void query_status();
void query_openings();
void sync();
void set_open_limit(bool);
void set_close_limit(bool);
// children subscriptions
void subscribe_rolling_code_counter(std::function<void(uint32_t)>&& f);

View File

@ -96,13 +96,6 @@ namespace ratgdo {
const Traits& traits() const { return this->traits_; }
// methods not used by secplus1
void set_open_limit(bool state){}
void set_close_limit(bool state){}
void set_discrete_open_pin(InternalGPIOPin* pin){}
void set_discrete_close_pin(InternalGPIOPin* pin){}
protected:
void wall_panel_emulation(size_t index = 0);

View File

@ -101,12 +101,6 @@ namespace ratgdo {
const Traits& traits() const { return this->traits_; }
// methods not used by secplus2
void set_open_limit(bool state){}
void set_close_limit(bool state){}
void set_discrete_open_pin(InternalGPIOPin* pin){}
void set_discrete_close_pin(InternalGPIOPin* pin){}
protected:
void increment_rolling_code_counter(int delta = 1);
void set_rolling_code_counter(uint32_t counter);

View File

@ -22,7 +22,7 @@ esphome:
version: "2.5"
esp8266:
board: d1_mini
board: d1_mini_lite
restore_from_flash: true
dashboard_import: