send both sensor values

This commit is contained in:
Paul Wieland 2024-04-13 15:07:34 -04:00
parent d969618d79
commit 587845820a
2 changed files with 9 additions and 21 deletions

View File

@ -16,6 +16,8 @@ ratgdo:
input_gdo_pin: ${uart_rx_pin} input_gdo_pin: ${uart_rx_pin}
output_gdo_pin: ${uart_tx_pin} output_gdo_pin: ${uart_tx_pin}
input_obst_pin: ${input_obst_pin} input_obst_pin: ${input_obst_pin}
dry_contact_open_sensor: ${id_prefix}_dry_contact_open
dry_contact_close_sensor: ${id_prefix}_dry_contact_close
protocol: drycontact protocol: drycontact
on_sync_failed: on_sync_failed:
then: then:
@ -37,7 +39,7 @@ switch:
id: "${id_prefix}_status_door" id: "${id_prefix}_status_door"
internal: true internal: true
pin: pin:
number: ${status_door_pin} # D0 output door status, HIGH for open, LOW for closed number: ${status_door_pin}
mode: mode:
output: true output: true
name: "Status door" name: "Status door"
@ -46,7 +48,7 @@ switch:
id: "${id_prefix}_status_obstruction" id: "${id_prefix}_status_obstruction"
internal: true internal: true
pin: pin:
number: ${status_obstruction_pin} # D8 output for obstruction status, HIGH for obstructed, LOW for clear number: ${status_obstruction_pin}
mode: mode:
output: true output: true
name: "Status obstruction" name: "Status obstruction"
@ -78,7 +80,7 @@ binary_sensor:
- platform: gpio - platform: gpio
id: "${id_prefix}_dry_contact_open" id: "${id_prefix}_dry_contact_open"
pin: pin:
number: ${dry_contact_open_pin} # D5 dry contact for opening door number: ${dry_contact_open_pin}
inverted: true inverted: true
mode: mode:
input: true input: true
@ -87,14 +89,10 @@ binary_sensor:
entity_category: diagnostic entity_category: diagnostic
filters: filters:
- delayed_on_off: 500ms - delayed_on_off: 500ms
on_state:
then:
lambda: |-
id($id_prefix)->set_open_limit(x);
- platform: gpio - platform: gpio
id: "${id_prefix}_dry_contact_close" id: "${id_prefix}_dry_contact_close"
pin: pin:
number: ${dry_contact_close_pin} # D6 dry contact for closing door number: ${dry_contact_close_pin}
inverted: true inverted: true
mode: mode:
input: true input: true
@ -103,14 +101,10 @@ binary_sensor:
entity_category: diagnostic entity_category: diagnostic
filters: filters:
- delayed_on_off: 500ms - delayed_on_off: 500ms
on_state:
then:
lambda: |-
id($id_prefix)->set_close_limit(x);
- platform: gpio - platform: gpio
id: "${id_prefix}_dry_contact_light" id: "${id_prefix}_dry_contact_light"
pin: pin:
number: ${dry_contact_light_pin} # D3 dry contact for triggering light (no discrete light commands, so toggle only) number: ${dry_contact_light_pin}
inverted: true inverted: true
mode: mode:
input: true input: true

View File

@ -688,10 +688,7 @@ namespace ratgdo {
dry_contact_open_sensor_ = dry_contact_open_sensor; dry_contact_open_sensor_ = dry_contact_open_sensor;
dry_contact_open_sensor_->add_on_state_callback([this](bool sensor_value) dry_contact_open_sensor_->add_on_state_callback([this](bool sensor_value)
{ {
if (sensor_value) { this->set_open_limit(sensor_value);
ESP_LOGD(TAG,"Dry Contact Open Sensor Triggered");
this->set_open_limit(true);
}
} }
); );
} }
@ -700,10 +697,7 @@ namespace ratgdo {
dry_contact_close_sensor_ = dry_contact_close_sensor; dry_contact_close_sensor_ = dry_contact_close_sensor;
dry_contact_close_sensor_->add_on_state_callback([this](bool sensor_value) dry_contact_close_sensor_->add_on_state_callback([this](bool sensor_value)
{ {
if (sensor_value) { this->set_close_limit(sensor_value);
ESP_LOGD(TAG,"Dry Contact Close Sensor Triggered");
set_close_limit(true);
}
} }
); );
} }