CodeRabbitAI suggestions
This commit is contained in:
@@ -56,129 +56,15 @@ esphome:
|
|||||||
on_boot:
|
on_boot:
|
||||||
- priority: 700
|
- priority: 700
|
||||||
then:
|
then:
|
||||||
- wait_until:
|
- script.execute: boot_initialize
|
||||||
condition:
|
|
||||||
- lambda: return sl_tx_model_format->active_index().has_value();
|
|
||||||
- lambda: return sl_tx_model_gang->active_index().has_value();
|
|
||||||
- lambda: |-
|
|
||||||
const bool us_model = sl_tx_model_format->active_index().has_value() and
|
|
||||||
sl_tx_model_format->active_index().value() == 1;
|
|
||||||
const uint8_t num_gangs = (sl_tx_model_gang->active_index().has_value()) ?
|
|
||||||
(sl_tx_model_gang->active_index().value() + 1) : 0;
|
|
||||||
bs_button_1->publish_state(false);
|
|
||||||
bs_button_1->set_internal(num_gangs < 1);
|
|
||||||
sl_button_1_action->set_internal(num_gangs < 1);
|
|
||||||
bs_button_2->publish_state(false);
|
|
||||||
bs_button_2->set_internal(num_gangs < 2);
|
|
||||||
sl_button_2_action->set_internal(num_gangs < 2);
|
|
||||||
bs_button_3->publish_state(false);
|
|
||||||
bs_button_3->set_internal(num_gangs < 3);
|
|
||||||
sl_button_3_action->set_internal(num_gangs < 3);
|
|
||||||
bs_button_4->publish_state(false);
|
|
||||||
bs_button_4->set_internal(num_gangs < 4);
|
|
||||||
sl_button_4_action->set_internal(num_gangs < 4);
|
|
||||||
bs_multi_touch->publish_state(false);
|
|
||||||
bs_swipe_down->publish_state(false);
|
|
||||||
bs_swipe_down->set_internal(!us_model);
|
|
||||||
bs_swipe_left->publish_state(false);
|
|
||||||
bs_swipe_left->set_internal(us_model);
|
|
||||||
bs_swipe_right->publish_state(false);
|
|
||||||
bs_swipe_right->set_internal(us_model);
|
|
||||||
bs_swipe_up->publish_state(false);
|
|
||||||
bs_swipe_up->set_internal(!us_model);
|
|
||||||
light_28->set_internal(!us_model);
|
|
||||||
light_29->set_internal(!us_model);
|
|
||||||
light_30->set_internal(!us_model);
|
|
||||||
light_31->set_internal(!us_model);
|
|
||||||
light_eu->set_internal(us_model);
|
|
||||||
light_eu_bottom->set_internal(us_model);
|
|
||||||
light_eu_left->set_internal(us_model);
|
|
||||||
light_eu_right->set_internal(us_model);
|
|
||||||
light_eu_top->set_internal(us_model);
|
|
||||||
light_us->set_internal(!us_model);
|
|
||||||
light_us_bottom->set_internal(!us_model);
|
|
||||||
light_us_left->set_internal(!us_model);
|
|
||||||
light_us_right->set_internal(!us_model);
|
|
||||||
light_us_top->set_internal(!us_model);
|
|
||||||
sl_relay_1_mode->set_internal(num_gangs < 1);
|
|
||||||
sl_relay_1_light_mode_eu->set_internal(us_model or num_gangs < 1);
|
|
||||||
sl_relay_1_light_mode_us->set_internal(!us_model or num_gangs < 1);
|
|
||||||
sl_relay_2_mode->set_internal(num_gangs < 2);
|
|
||||||
sl_relay_2_light_mode_eu->set_internal(us_model or num_gangs < 2);
|
|
||||||
sl_relay_2_light_mode_us->set_internal(!us_model or num_gangs < 2);
|
|
||||||
sl_relay_3_mode->set_internal(num_gangs < 3);
|
|
||||||
sl_relay_3_light_mode_eu->set_internal(us_model or num_gangs < 3);
|
|
||||||
sl_relay_3_light_mode_us->set_internal(!us_model or num_gangs < 3);
|
|
||||||
sl_relay_4_mode->set_internal(num_gangs < 4);
|
|
||||||
sl_relay_4_light_mode_eu->set_internal(us_model or num_gangs < 4);
|
|
||||||
sl_relay_4_light_mode_us->set_internal(!us_model or num_gangs < 4);
|
|
||||||
auto relay_mode_index = sl_relay_1_mode->active_index();
|
|
||||||
if (relay_mode_index.has_value()) {
|
|
||||||
ligth_output_1->set_internal(false or relay_mode_index.value() != 1);
|
|
||||||
sw_relay_1->set_internal(false or relay_mode_index.value() != 0);
|
|
||||||
}
|
|
||||||
relay_mode_index = sl_relay_2_mode->active_index();
|
|
||||||
if (relay_mode_index.has_value()) {
|
|
||||||
ligth_output_2->set_internal(num_gangs < 2 or relay_mode_index.value() != 1);
|
|
||||||
sw_relay_2->set_internal(num_gangs < 2 or relay_mode_index.value() != 0);
|
|
||||||
}
|
|
||||||
relay_mode_index = sl_relay_3_mode->active_index();
|
|
||||||
if (relay_mode_index.has_value()) {
|
|
||||||
ligth_output_3->set_internal(num_gangs < 3 or relay_mode_index.value() != 1);
|
|
||||||
sw_relay_3->set_internal(num_gangs < 3 or relay_mode_index.value() != 0);
|
|
||||||
}
|
|
||||||
relay_mode_index = sl_relay_4_mode->active_index();
|
|
||||||
if (relay_mode_index.has_value()) {
|
|
||||||
ligth_output_4->set_internal(num_gangs < 4 or relay_mode_index.value() != 1);
|
|
||||||
sw_relay_4->set_internal(num_gangs < 4 or relay_mode_index.value() != 0);
|
|
||||||
}
|
|
||||||
switch (num_gangs) {
|
|
||||||
case 1: // 1 Gang
|
|
||||||
if (us_model) {
|
|
||||||
id(gb_lights_1) = { light_us_rl_1_1_left };
|
|
||||||
id(gb_lights_2) = { light_us_rl_1_1_right };
|
|
||||||
} else {
|
|
||||||
id(gb_lights_1) = { light_eu_rl_1_1_bottom };
|
|
||||||
id(gb_lights_2) = { light_eu_rl_1_1_top };
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2: // 2 Gang
|
|
||||||
if (us_model) {
|
|
||||||
id(gb_lights_1) = { light_us_rl_1_2_left, light_us_rl_2_2_left };
|
|
||||||
id(gb_lights_2) = { light_us_rl_1_2_right, light_us_rl_2_2_right };
|
|
||||||
} else {
|
|
||||||
id(gb_lights_1) = { light_eu_rl_1_2_bottom, light_eu_rl_2_2_bottom };
|
|
||||||
id(gb_lights_2) = { light_eu_rl_1_2_top, light_eu_rl_2_2_top };
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3: // 3 Gang
|
|
||||||
if (us_model) {
|
|
||||||
id(gb_lights_1) = { light_us_rl_1_3_left, light_us_rl_2_3_left, light_us_rl_3_3_left };
|
|
||||||
id(gb_lights_2) = { light_us_rl_1_3_right, light_us_rl_2_3_right, light_us_rl_3_3_right };
|
|
||||||
} else {
|
|
||||||
id(gb_lights_1) = { light_eu_rl_1_3_bottom, light_eu_rl_2_3_bottom, light_eu_rl_3_3_bottom };
|
|
||||||
id(gb_lights_2) = { light_eu_rl_1_3_top, light_eu_rl_2_3_top, light_eu_rl_3_3_top };
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4: // 3 Gang
|
|
||||||
if (us_model) {
|
|
||||||
id(gb_lights_1) = { light_us_rl_1_4_left, light_us_rl_2_4_left, light_us_rl_3_4_left, light_us_rl_4_4_left };
|
|
||||||
id(gb_lights_2) = { light_us_rl_1_4_right, light_us_rl_2_4_right, light_us_rl_3_4_right, light_us_rl_4_4_right };
|
|
||||||
} else {
|
|
||||||
id(gb_lights_1) = { light_eu_rl_1_4_bottom, light_eu_rl_2_4_bottom, light_eu_rl_3_4_bottom, light_eu_rl_4_4_bottom };
|
|
||||||
id(gb_lights_2) = { light_eu_rl_1_4_top, light_eu_rl_2_4_top, light_eu_rl_3_4_top, light_eu_rl_4_4_top };
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
- priority: 600 # This is where most sensors are set up.
|
- priority: 600 # This is where most sensors are set up.
|
||||||
then:
|
then:
|
||||||
- lambda: |-
|
- script.execute: boot_sequence
|
||||||
tx_fw_version->publish_state("${version}");
|
|
||||||
tx_device_name->publish_state("${name}");
|
|
||||||
- priority: -100 # At this priority, pretty much everything should already be initialized.
|
- priority: -100 # At this priority, pretty much everything should already be initialized.
|
||||||
then:
|
then:
|
||||||
- lambda: send_event_to_ha->execute("boot", "done");
|
- script.execute: boot_done
|
||||||
|
|
||||||
improv_serial:
|
improv_serial:
|
||||||
id: serial_improv
|
id: serial_improv
|
||||||
@@ -191,9 +77,25 @@ ota:
|
|||||||
psram:
|
psram:
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- id: boot_done
|
||||||
|
mode: restart
|
||||||
|
then:
|
||||||
|
- lambda: send_event_to_ha->execute("boot", "done");
|
||||||
|
|
||||||
- id: boot_initialize
|
- id: boot_initialize
|
||||||
mode: restart
|
mode: restart
|
||||||
then: # There's nothing here so far
|
then: # There's nothing here so far
|
||||||
|
# Extended by:
|
||||||
|
# - HW Buttons
|
||||||
|
# - HW Relays
|
||||||
|
# - HW Touch
|
||||||
|
|
||||||
|
- id: boot_sequence
|
||||||
|
mode: restart
|
||||||
|
then:
|
||||||
|
- lambda: |-
|
||||||
|
tx_fw_version->publish_state("${version}");
|
||||||
|
tx_device_name->publish_state("${name}");
|
||||||
|
|
||||||
select:
|
select:
|
||||||
- id: sl_tx_model_format
|
- id: sl_tx_model_format
|
||||||
|
|||||||
@@ -21,8 +21,11 @@ api:
|
|||||||
then:
|
then:
|
||||||
- lambda: |-
|
- lambda: |-
|
||||||
if (!isnan(val)) {
|
if (!isnan(val)) {
|
||||||
if (component == "latitude") sun_entity->set_latitude(val);
|
if (component == "latitude" && val >= -90 && val <= 90) {
|
||||||
else if (component == "longitude") sun_entity->set_longitude(val);
|
sun_entity->set_latitude(val);
|
||||||
|
} else if (component == "longitude" && val >= -180 && val <= 180) {
|
||||||
|
sun_entity->set_longitude(val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
|||||||
@@ -121,6 +121,32 @@ binary_sensor:
|
|||||||
event: long_click
|
event: long_click
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- id: !extend boot_initialize
|
||||||
|
then:
|
||||||
|
- script.execute: boot_initialize_buttons
|
||||||
|
|
||||||
|
- id: boot_initialize_buttons
|
||||||
|
mode: restart
|
||||||
|
then:
|
||||||
|
- wait_until:
|
||||||
|
condition:
|
||||||
|
- lambda: return sl_tx_model_gang->active_index().has_value();
|
||||||
|
- lambda: |-
|
||||||
|
const uint8_t num_gangs = (sl_tx_model_gang->active_index().has_value()) ?
|
||||||
|
(sl_tx_model_gang->active_index().value() + 1) : 0;
|
||||||
|
bs_button_1->publish_state(false);
|
||||||
|
bs_button_1->set_internal(num_gangs < 1);
|
||||||
|
sl_button_1_action->set_internal(num_gangs < 1);
|
||||||
|
bs_button_2->publish_state(false);
|
||||||
|
bs_button_2->set_internal(num_gangs < 2);
|
||||||
|
sl_button_2_action->set_internal(num_gangs < 2);
|
||||||
|
bs_button_3->publish_state(false);
|
||||||
|
bs_button_3->set_internal(num_gangs < 3);
|
||||||
|
sl_button_3_action->set_internal(num_gangs < 3);
|
||||||
|
bs_button_4->publish_state(false);
|
||||||
|
bs_button_4->set_internal(num_gangs < 4);
|
||||||
|
sl_button_4_action->set_internal(num_gangs < 4);
|
||||||
|
|
||||||
- id: button_action
|
- id: button_action
|
||||||
mode: parallel
|
mode: parallel
|
||||||
parameters:
|
parameters:
|
||||||
@@ -133,34 +159,15 @@ script:
|
|||||||
- id: buttons_release
|
- id: buttons_release
|
||||||
mode: restart
|
mode: restart
|
||||||
then:
|
then:
|
||||||
- if:
|
- lambda: |-
|
||||||
condition:
|
std::vector<binary_sensor::BinarySensor*> buttons = {
|
||||||
binary_sensor.is_on: bs_button_1
|
bs_button_1, bs_button_2, bs_button_3, bs_button_4
|
||||||
then:
|
};
|
||||||
- binary_sensor.template.publish:
|
for (auto* button : buttons) {
|
||||||
id: bs_button_1
|
if (button->state) {
|
||||||
state: OFF # yamllint disable-line rule:truthy
|
button->publish_state(false);
|
||||||
- if:
|
}
|
||||||
condition:
|
}
|
||||||
binary_sensor.is_on: bs_button_2
|
|
||||||
then:
|
|
||||||
- binary_sensor.template.publish:
|
|
||||||
id: bs_button_2
|
|
||||||
state: OFF # yamllint disable-line rule:truthy
|
|
||||||
- if:
|
|
||||||
condition:
|
|
||||||
binary_sensor.is_on: bs_button_3
|
|
||||||
then:
|
|
||||||
- binary_sensor.template.publish:
|
|
||||||
id: bs_button_3
|
|
||||||
state: OFF # yamllint disable-line rule:truthy
|
|
||||||
- if:
|
|
||||||
condition:
|
|
||||||
binary_sensor.is_on: bs_button_4
|
|
||||||
then:
|
|
||||||
- binary_sensor.template.publish:
|
|
||||||
id: bs_button_4
|
|
||||||
state: OFF # yamllint disable-line rule:truthy
|
|
||||||
|
|
||||||
- id: !extend touch_on_multi_touch_release
|
- id: !extend touch_on_multi_touch_release
|
||||||
then:
|
then:
|
||||||
|
|||||||
@@ -23,22 +23,22 @@ globals:
|
|||||||
restore_value: false
|
restore_value: false
|
||||||
|
|
||||||
light:
|
light:
|
||||||
- id: ligth_output_1
|
- id: light_output_1
|
||||||
name: Light output 1
|
name: Light output 1
|
||||||
internal: true
|
internal: true
|
||||||
platform: binary
|
platform: binary
|
||||||
output: output_relay_1
|
output: output_relay_1
|
||||||
- id: ligth_output_2
|
- id: light_output_2
|
||||||
name: Light output 2
|
name: Light output 2
|
||||||
internal: true
|
internal: true
|
||||||
platform: binary
|
platform: binary
|
||||||
output: output_relay_2
|
output: output_relay_2
|
||||||
- id: ligth_output_3
|
- id: light_output_3
|
||||||
name: Light output 3
|
name: Light output 3
|
||||||
internal: true
|
internal: true
|
||||||
platform: binary
|
platform: binary
|
||||||
output: output_relay_3
|
output: output_relay_3
|
||||||
- id: ligth_output_4
|
- id: light_output_4
|
||||||
name: Light output 4
|
name: Light output 4
|
||||||
internal: true
|
internal: true
|
||||||
platform: binary
|
platform: binary
|
||||||
@@ -748,6 +748,71 @@ light:
|
|||||||
from: 7
|
from: 7
|
||||||
to: 7
|
to: 7
|
||||||
|
|
||||||
|
script:
|
||||||
|
- id: !extend boot_initialize
|
||||||
|
then:
|
||||||
|
- wait_until:
|
||||||
|
condition:
|
||||||
|
- lambda: return sl_tx_model_format->active_index().has_value();
|
||||||
|
- lambda: return sl_tx_model_gang->active_index().has_value();
|
||||||
|
- lambda: |-
|
||||||
|
const bool is_model_us = sl_tx_model_format->active_index().has_value() and
|
||||||
|
sl_tx_model_format->active_index().value() == 1;
|
||||||
|
const uint8_t num_gangs = (sl_tx_model_gang->active_index().has_value()) ?
|
||||||
|
(sl_tx_model_gang->active_index().value() + 1) : 0;
|
||||||
|
light_28->set_internal(!is_model_us);
|
||||||
|
light_29->set_internal(!is_model_us);
|
||||||
|
light_30->set_internal(!is_model_us);
|
||||||
|
light_31->set_internal(!is_model_us);
|
||||||
|
light_eu->set_internal(is_model_us);
|
||||||
|
light_eu_bottom->set_internal(is_model_us);
|
||||||
|
light_eu_left->set_internal(is_model_us);
|
||||||
|
light_eu_right->set_internal(is_model_us);
|
||||||
|
light_eu_top->set_internal(is_model_us);
|
||||||
|
light_us->set_internal(!is_model_us);
|
||||||
|
light_us_bottom->set_internal(!is_model_us);
|
||||||
|
light_us_left->set_internal(!is_model_us);
|
||||||
|
light_us_right->set_internal(!is_model_us);
|
||||||
|
light_us_top->set_internal(!is_model_us);
|
||||||
|
switch (num_gangs) {
|
||||||
|
case 1: // 1 Gang
|
||||||
|
if (is_model_us) {
|
||||||
|
id(gb_lights_1) = { light_us_rl_1_1_left };
|
||||||
|
id(gb_lights_2) = { light_us_rl_1_1_right };
|
||||||
|
} else {
|
||||||
|
id(gb_lights_1) = { light_eu_rl_1_1_bottom };
|
||||||
|
id(gb_lights_2) = { light_eu_rl_1_1_top };
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2: // 2 Gang
|
||||||
|
if (is_model_us) {
|
||||||
|
id(gb_lights_1) = { light_us_rl_1_2_left, light_us_rl_2_2_left };
|
||||||
|
id(gb_lights_2) = { light_us_rl_1_2_right, light_us_rl_2_2_right };
|
||||||
|
} else {
|
||||||
|
id(gb_lights_1) = { light_eu_rl_1_2_bottom, light_eu_rl_2_2_bottom };
|
||||||
|
id(gb_lights_2) = { light_eu_rl_1_2_top, light_eu_rl_2_2_top };
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3: // 3 Gang
|
||||||
|
if (is_model_us) {
|
||||||
|
id(gb_lights_1) = { light_us_rl_1_3_left, light_us_rl_2_3_left, light_us_rl_3_3_left };
|
||||||
|
id(gb_lights_2) = { light_us_rl_1_3_right, light_us_rl_2_3_right, light_us_rl_3_3_right };
|
||||||
|
} else {
|
||||||
|
id(gb_lights_1) = { light_eu_rl_1_3_bottom, light_eu_rl_2_3_bottom, light_eu_rl_3_3_bottom };
|
||||||
|
id(gb_lights_2) = { light_eu_rl_1_3_top, light_eu_rl_2_3_top, light_eu_rl_3_3_top };
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4: // 3 Gang
|
||||||
|
if (is_model_us) {
|
||||||
|
id(gb_lights_1) = { light_us_rl_1_4_left, light_us_rl_2_4_left, light_us_rl_3_4_left, light_us_rl_4_4_left };
|
||||||
|
id(gb_lights_2) = { light_us_rl_1_4_right, light_us_rl_2_4_right, light_us_rl_3_4_right, light_us_rl_4_4_right };
|
||||||
|
} else {
|
||||||
|
id(gb_lights_1) = { light_eu_rl_1_4_bottom, light_eu_rl_2_4_bottom, light_eu_rl_3_4_bottom, light_eu_rl_4_4_bottom };
|
||||||
|
id(gb_lights_2) = { light_eu_rl_1_4_top, light_eu_rl_2_4_top, light_eu_rl_3_4_top, light_eu_rl_4_4_top };
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
select:
|
select:
|
||||||
# EU relay light mode template
|
# EU relay light mode template
|
||||||
- &relay_light_mode_eu
|
- &relay_light_mode_eu
|
||||||
|
|||||||
@@ -78,6 +78,55 @@ output:
|
|||||||
pin: GPIO23
|
pin: GPIO23
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- id: !extend boot_initialize
|
||||||
|
then:
|
||||||
|
- script.execute: boot_initialize_relays
|
||||||
|
|
||||||
|
- id: boot_initialize_relays
|
||||||
|
mode: restart
|
||||||
|
then:
|
||||||
|
- wait_until:
|
||||||
|
condition:
|
||||||
|
- lambda: return sl_tx_model_format->active_index().has_value();
|
||||||
|
- lambda: return sl_tx_model_gang->active_index().has_value();
|
||||||
|
- lambda: |-
|
||||||
|
const bool is_model_us = sl_tx_model_format->active_index().has_value() and
|
||||||
|
sl_tx_model_format->active_index().value() == 1;
|
||||||
|
const uint8_t num_gangs = (sl_tx_model_gang->active_index().has_value()) ?
|
||||||
|
(sl_tx_model_gang->active_index().value() + 1) : 0;
|
||||||
|
sl_relay_1_mode->set_internal(num_gangs < 1);
|
||||||
|
sl_relay_1_light_mode_eu->set_internal(is_model_us or num_gangs < 1);
|
||||||
|
sl_relay_1_light_mode_us->set_internal(!is_model_us or num_gangs < 1);
|
||||||
|
sl_relay_2_mode->set_internal(num_gangs < 2);
|
||||||
|
sl_relay_2_light_mode_eu->set_internal(is_model_us or num_gangs < 2);
|
||||||
|
sl_relay_2_light_mode_us->set_internal(!is_model_us or num_gangs < 2);
|
||||||
|
sl_relay_3_mode->set_internal(num_gangs < 3);
|
||||||
|
sl_relay_3_light_mode_eu->set_internal(is_model_us or num_gangs < 3);
|
||||||
|
sl_relay_3_light_mode_us->set_internal(!is_model_us or num_gangs < 3);
|
||||||
|
sl_relay_4_mode->set_internal(num_gangs < 4);
|
||||||
|
sl_relay_4_light_mode_eu->set_internal(is_model_us or num_gangs < 4);
|
||||||
|
sl_relay_4_light_mode_us->set_internal(!is_model_us or num_gangs < 4);
|
||||||
|
auto relay_mode_index = sl_relay_1_mode->active_index();
|
||||||
|
if (relay_mode_index.has_value()) {
|
||||||
|
light_output_1->set_internal(false or relay_mode_index.value() != 1);
|
||||||
|
sw_relay_1->set_internal(false or relay_mode_index.value() != 0);
|
||||||
|
}
|
||||||
|
relay_mode_index = sl_relay_2_mode->active_index();
|
||||||
|
if (relay_mode_index.has_value()) {
|
||||||
|
light_output_2->set_internal(num_gangs < 2 or relay_mode_index.value() != 1);
|
||||||
|
sw_relay_2->set_internal(num_gangs < 2 or relay_mode_index.value() != 0);
|
||||||
|
}
|
||||||
|
relay_mode_index = sl_relay_3_mode->active_index();
|
||||||
|
if (relay_mode_index.has_value()) {
|
||||||
|
light_output_3->set_internal(num_gangs < 3 or relay_mode_index.value() != 1);
|
||||||
|
sw_relay_3->set_internal(num_gangs < 3 or relay_mode_index.value() != 0);
|
||||||
|
}
|
||||||
|
relay_mode_index = sl_relay_4_mode->active_index();
|
||||||
|
if (relay_mode_index.has_value()) {
|
||||||
|
light_output_4->set_internal(num_gangs < 4 or relay_mode_index.value() != 1);
|
||||||
|
sw_relay_4->set_internal(num_gangs < 4 or relay_mode_index.value() != 0);
|
||||||
|
}
|
||||||
|
|
||||||
- id: show_relay_status
|
- id: show_relay_status
|
||||||
mode: restart
|
mode: restart
|
||||||
then:
|
then:
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ binary_sensor:
|
|||||||
- lambda: send_event_to_ha->execute("swipe", "down");
|
- lambda: send_event_to_ha->execute("swipe", "down");
|
||||||
|
|
||||||
external_components:
|
external_components:
|
||||||
- source: github://edwardtfn/TX-Ultimate-Easy@dev # Change this before releasing
|
- source: github://edwardtfn/TX-Ultimate-Easy@main
|
||||||
components:
|
components:
|
||||||
- tx_ultimate_easy
|
- tx_ultimate_easy
|
||||||
|
|
||||||
@@ -79,6 +79,29 @@ number:
|
|||||||
restore_value: true
|
restore_value: true
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- id: !extend boot_initialize
|
||||||
|
then:
|
||||||
|
- script.execute: boot_initialize_touch
|
||||||
|
|
||||||
|
- id: boot_initialize_touch
|
||||||
|
mode: restart
|
||||||
|
then:
|
||||||
|
- wait_until:
|
||||||
|
condition:
|
||||||
|
- lambda: return sl_tx_model_format->active_index().has_value();
|
||||||
|
- lambda: |-
|
||||||
|
const bool is_model_us = sl_tx_model_format->active_index().has_value() and
|
||||||
|
sl_tx_model_format->active_index().value() == 1;
|
||||||
|
bs_multi_touch->publish_state(false);
|
||||||
|
bs_swipe_down->publish_state(false);
|
||||||
|
bs_swipe_down->set_internal(!is_model_us);
|
||||||
|
bs_swipe_left->publish_state(false);
|
||||||
|
bs_swipe_left->set_internal(is_model_us);
|
||||||
|
bs_swipe_right->publish_state(false);
|
||||||
|
bs_swipe_right->set_internal(is_model_us);
|
||||||
|
bs_swipe_up->publish_state(false);
|
||||||
|
bs_swipe_up->set_internal(!is_model_us);
|
||||||
|
|
||||||
- id: touch_on_multi_touch_release
|
- id: touch_on_multi_touch_release
|
||||||
mode: restart
|
mode: restart
|
||||||
then:
|
then:
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
##### - For normal system use, modifications to this file are NOT required. #####
|
##### - For normal system use, modifications to this file are NOT required. #####
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
---
|
---
|
||||||
|
substitutions:
|
||||||
|
vibration_max_duration: 5s
|
||||||
|
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
- id: bs_vibrating
|
- id: bs_vibrating
|
||||||
name: Vibrating
|
name: Vibrating
|
||||||
@@ -45,6 +48,11 @@ number:
|
|||||||
optimistic: true
|
optimistic: true
|
||||||
restore_value: true
|
restore_value: true
|
||||||
|
|
||||||
|
ota:
|
||||||
|
on_state_change:
|
||||||
|
then:
|
||||||
|
- switch.turn_off: sw_vibration_motor
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- id: !extend touch_on_multi_touch_release
|
- id: !extend touch_on_multi_touch_release
|
||||||
then:
|
then:
|
||||||
@@ -112,9 +120,19 @@ switch:
|
|||||||
internal: true
|
internal: true
|
||||||
on_turn_on:
|
on_turn_on:
|
||||||
then:
|
then:
|
||||||
- lambda: bs_vibrating->publish_state(true);
|
- binary_sensor.template.publish:
|
||||||
|
id: bs_vibrating
|
||||||
|
state: ON # yamllint disable-line rule:truthy
|
||||||
|
- delay: ${vibration_max_duration}
|
||||||
|
- if:
|
||||||
|
condition:
|
||||||
|
switch.is_on: sw_vibration_motor
|
||||||
|
then:
|
||||||
|
- switch.turn_off: sw_vibration_motor
|
||||||
on_turn_off:
|
on_turn_off:
|
||||||
then:
|
then:
|
||||||
- lambda: bs_vibrating->publish_state(false);
|
- binary_sensor.template.publish:
|
||||||
|
id: bs_vibrating
|
||||||
|
state: OFF # yamllint disable-line rule:truthy
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|||||||
Reference in New Issue
Block a user