mirror of
https://github.com/esphome/esphome.git
synced 2025-10-25 05:03:52 +01:00
Merge branch 'integration' into memory_api
This commit is contained in:
@@ -67,7 +67,7 @@ void GPIOSwitch::write_state(bool state) {
|
|||||||
this->pin_->digital_write(state);
|
this->pin_->digital_write(state);
|
||||||
this->publish_state(state);
|
this->publish_state(state);
|
||||||
}
|
}
|
||||||
void GPIOSwitch::set_interlock(const std::vector<Switch *> &interlock) { this->interlock_ = interlock; }
|
void GPIOSwitch::set_interlock(const std::initializer_list<Switch *> &interlock) { this->interlock_ = interlock; }
|
||||||
|
|
||||||
} // namespace gpio
|
} // namespace gpio
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
|
|
||||||
#include "esphome/core/component.h"
|
#include "esphome/core/component.h"
|
||||||
#include "esphome/core/hal.h"
|
#include "esphome/core/hal.h"
|
||||||
|
#include "esphome/core/helpers.h"
|
||||||
#include "esphome/components/switch/switch.h"
|
#include "esphome/components/switch/switch.h"
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace gpio {
|
namespace gpio {
|
||||||
|
|
||||||
@@ -19,14 +18,14 @@ class GPIOSwitch : public switch_::Switch, public Component {
|
|||||||
|
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
void set_interlock(const std::vector<Switch *> &interlock);
|
void set_interlock(const std::initializer_list<Switch *> &interlock);
|
||||||
void set_interlock_wait_time(uint32_t interlock_wait_time) { interlock_wait_time_ = interlock_wait_time; }
|
void set_interlock_wait_time(uint32_t interlock_wait_time) { interlock_wait_time_ = interlock_wait_time; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void write_state(bool state) override;
|
void write_state(bool state) override;
|
||||||
|
|
||||||
GPIOPin *pin_;
|
GPIOPin *pin_;
|
||||||
std::vector<Switch *> interlock_;
|
FixedVector<Switch *> interlock_;
|
||||||
uint32_t interlock_wait_time_{0};
|
uint32_t interlock_wait_time_{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -12,3 +12,20 @@ switch:
|
|||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: ${switch_pin}
|
pin: ${switch_pin}
|
||||||
id: gpio_switch
|
id: gpio_switch
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
pin: ${switch_pin_2}
|
||||||
|
id: gpio_switch_interlock_1
|
||||||
|
interlock: [gpio_switch_interlock_2, gpio_switch_interlock_3]
|
||||||
|
interlock_wait_time: 100ms
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
pin: ${switch_pin_3}
|
||||||
|
id: gpio_switch_interlock_2
|
||||||
|
interlock: [gpio_switch_interlock_1, gpio_switch_interlock_3]
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
pin: ${switch_pin_4}
|
||||||
|
id: gpio_switch_interlock_3
|
||||||
|
interlock: [gpio_switch_interlock_1, gpio_switch_interlock_2]
|
||||||
|
interlock_wait_time: 50ms
|
||||||
|
|||||||
@@ -2,5 +2,8 @@ substitutions:
|
|||||||
binary_sensor_pin: GPIO2
|
binary_sensor_pin: GPIO2
|
||||||
output_pin: GPIO3
|
output_pin: GPIO3
|
||||||
switch_pin: GPIO4
|
switch_pin: GPIO4
|
||||||
|
switch_pin_2: GPIO5
|
||||||
|
switch_pin_3: GPIO6
|
||||||
|
switch_pin_4: GPIO7
|
||||||
|
|
||||||
<<: !include common.yaml
|
<<: !include common.yaml
|
||||||
|
|||||||
@@ -2,5 +2,8 @@ substitutions:
|
|||||||
binary_sensor_pin: GPIO12
|
binary_sensor_pin: GPIO12
|
||||||
output_pin: GPIO13
|
output_pin: GPIO13
|
||||||
switch_pin: GPIO14
|
switch_pin: GPIO14
|
||||||
|
switch_pin_2: GPIO15
|
||||||
|
switch_pin_3: GPIO16
|
||||||
|
switch_pin_4: GPIO17
|
||||||
|
|
||||||
<<: !include common.yaml
|
<<: !include common.yaml
|
||||||
|
|||||||
@@ -2,5 +2,8 @@ substitutions:
|
|||||||
binary_sensor_pin: GPIO0
|
binary_sensor_pin: GPIO0
|
||||||
output_pin: GPIO2
|
output_pin: GPIO2
|
||||||
switch_pin: GPIO15
|
switch_pin: GPIO15
|
||||||
|
switch_pin_2: GPIO12
|
||||||
|
switch_pin_3: GPIO13
|
||||||
|
switch_pin_4: GPIO14
|
||||||
|
|
||||||
<<: !include common.yaml
|
<<: !include common.yaml
|
||||||
|
|||||||
@@ -12,3 +12,20 @@ switch:
|
|||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: P1.2
|
pin: P1.2
|
||||||
id: gpio_switch
|
id: gpio_switch
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
pin: P1.3
|
||||||
|
id: gpio_switch_interlock_1
|
||||||
|
interlock: [gpio_switch_interlock_2, gpio_switch_interlock_3]
|
||||||
|
interlock_wait_time: 100ms
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
pin: P1.4
|
||||||
|
id: gpio_switch_interlock_2
|
||||||
|
interlock: [gpio_switch_interlock_1, gpio_switch_interlock_3]
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
pin: P1.5
|
||||||
|
id: gpio_switch_interlock_3
|
||||||
|
interlock: [gpio_switch_interlock_1, gpio_switch_interlock_2]
|
||||||
|
interlock_wait_time: 50ms
|
||||||
|
|||||||
@@ -12,3 +12,20 @@ switch:
|
|||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: P1.2
|
pin: P1.2
|
||||||
id: gpio_switch
|
id: gpio_switch
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
pin: P1.3
|
||||||
|
id: gpio_switch_interlock_1
|
||||||
|
interlock: [gpio_switch_interlock_2, gpio_switch_interlock_3]
|
||||||
|
interlock_wait_time: 100ms
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
pin: P1.4
|
||||||
|
id: gpio_switch_interlock_2
|
||||||
|
interlock: [gpio_switch_interlock_1, gpio_switch_interlock_3]
|
||||||
|
|
||||||
|
- platform: gpio
|
||||||
|
pin: P1.5
|
||||||
|
id: gpio_switch_interlock_3
|
||||||
|
interlock: [gpio_switch_interlock_1, gpio_switch_interlock_2]
|
||||||
|
interlock_wait_time: 50ms
|
||||||
|
|||||||
@@ -2,5 +2,8 @@ substitutions:
|
|||||||
binary_sensor_pin: GPIO2
|
binary_sensor_pin: GPIO2
|
||||||
output_pin: GPIO3
|
output_pin: GPIO3
|
||||||
switch_pin: GPIO4
|
switch_pin: GPIO4
|
||||||
|
switch_pin_2: GPIO5
|
||||||
|
switch_pin_3: GPIO6
|
||||||
|
switch_pin_4: GPIO7
|
||||||
|
|
||||||
<<: !include common.yaml
|
<<: !include common.yaml
|
||||||
|
|||||||
Reference in New Issue
Block a user