Compare commits

...

9 Commits

Author SHA1 Message Date
GitHub Actions
bd4f6836c9 Bump version to 2024.12.8 [skip-versioning] 2024-12-23 00:14:23 +00:00
Edward Firmo
98ea8810f8 Merge pull request #55 from edwardtfn/relay-on-light-mode
Fix relay on display as light mode
2024-12-23 01:14:09 +01:00
Edward Firmo
552b83f065 Re-add button ids on substitutions 2024-12-23 01:03:51 +01:00
Edward Firmo
ee6f565447 Change refresh to 5min 2024-12-23 00:59:17 +01:00
Edward Firmo
aa4e27ec35 Merge branch 'relay-on-light-mode' of https://github.com/edwardtfn/TX-Ultimate-Easy into relay-on-light-mode 2024-12-23 00:53:37 +01:00
Edward Firmo
8a509cedc8 Point to latest 2024-12-23 00:52:59 +01:00
Edward Firmo
ddea93af6a Merge branch 'main' into relay-on-light-mode 2024-12-23 00:50:29 +01:00
Edward Firmo
dc99319397 Fix relay id on log 2024-12-23 00:46:06 +01:00
Edward Firmo
5ae45fff63 Fix relay on display as light mode
Solves #28
2024-12-23 00:41:51 +01:00
6 changed files with 169 additions and 40 deletions

View File

@@ -26,6 +26,12 @@ substitutions:
BUTTON_PRESS_TIMEOUT: '10000' # Ignore if button is pressed for longer than this time, in msec BUTTON_PRESS_TIMEOUT: '10000' # Ignore if button is pressed for longer than this time, in msec
BUTTON_LONG_PRESS_DELAY: '800' # The time to wait to consider a long press, in msec BUTTON_LONG_PRESS_DELAY: '800' # The time to wait to consider a long press, in msec
# Button numbers constants
BUTTON_1_ID: '1'
BUTTON_2_ID: '2'
BUTTON_3_ID: '3'
BUTTON_4_ID: '4'
binary_sensor: binary_sensor:
- &binary_sensor_button_base - &binary_sensor_button_base
id: bs_button_2 id: bs_button_2

View File

@@ -795,12 +795,12 @@ script:
case 1: case 1:
if (light_index >= id(gb_lights_1).size()) { if (light_index >= id(gb_lights_1).size()) {
ESP_LOGE("core_hw_leds", "Invalid set with %s light for Relay %" PRIu8, ESP_LOGE("core_hw_leds", "Invalid set with %s light for Relay %" PRIu8,
light_mode_group_1.c_str(), light_index); light_mode_group_1.c_str(), light_index+1);
return; return;
} }
if (state and !id(gb_lights_1)[light_index]->current_values.is_on()) { if (state and !id(gb_lights_1)[light_index]->current_values.is_on()) {
ESP_LOGI("core_hw_leds", "Turn-on %s light for Relay %" PRIu8, ESP_LOGI("core_hw_leds", "Turn-on %s light for Relay %" PRIu8,
light_mode_group_1.c_str(), light_index); light_mode_group_1.c_str(), light_index+1);
auto call = id(gb_lights_1)[light_index]->turn_on(); auto call = id(gb_lights_1)[light_index]->turn_on();
if (LIGHT_TRANSITION_TURN_ON > 0) if (LIGHT_TRANSITION_TURN_ON > 0)
call.set_transition_length(LIGHT_TRANSITION_TURN_ON); // in ms call.set_transition_length(LIGHT_TRANSITION_TURN_ON); // in ms
@@ -809,7 +809,7 @@ script:
call.perform(); call.perform();
} else if (!state and id(gb_lights_1)[light_index]->current_values.is_on()) { } else if (!state and id(gb_lights_1)[light_index]->current_values.is_on()) {
ESP_LOGI("core_hw_leds", "Turn-off %s light for Relay %" PRIu8, ESP_LOGI("core_hw_leds", "Turn-off %s light for Relay %" PRIu8,
light_mode_group_1.c_str(), light_index); light_mode_group_1.c_str(), light_index+1);
auto call = id(gb_lights_1)[light_index]->turn_off(); auto call = id(gb_lights_1)[light_index]->turn_off();
if (LIGHT_TRANSITION_TURN_OFF > 0) if (LIGHT_TRANSITION_TURN_OFF > 0)
call.set_transition_length(LIGHT_TRANSITION_TURN_OFF); // in ms call.set_transition_length(LIGHT_TRANSITION_TURN_OFF); // in ms
@@ -819,12 +819,12 @@ script:
case 2: case 2:
if (light_index >= id(gb_lights_2).size()) { if (light_index >= id(gb_lights_2).size()) {
ESP_LOGE("core_hw_leds", "Invalid set with %s light for Relay %" PRIu8, ESP_LOGE("core_hw_leds", "Invalid set with %s light for Relay %" PRIu8,
light_mode_group_2.c_str(), light_index); light_mode_group_2.c_str(), light_index+1);
return; return;
} }
if (state and !id(gb_lights_2)[light_index]->current_values.is_on()) { if (state and !id(gb_lights_2)[light_index]->current_values.is_on()) {
ESP_LOGI("core_hw_leds", "Turn-on %s light for Relay %" PRIu8, ESP_LOGI("core_hw_leds", "Turn-on %s light for Relay %" PRIu8,
light_mode_group_2.c_str(), light_index); light_mode_group_2.c_str(), light_index+1);
auto call = id(gb_lights_2)[light_index]->turn_on(); auto call = id(gb_lights_2)[light_index]->turn_on();
if (LIGHT_TRANSITION_TURN_ON > 0) if (LIGHT_TRANSITION_TURN_ON > 0)
call.set_transition_length(LIGHT_TRANSITION_TURN_ON); // in ms call.set_transition_length(LIGHT_TRANSITION_TURN_ON); // in ms
@@ -833,7 +833,7 @@ script:
call.perform(); call.perform();
} else if (!state and id(gb_lights_2)[light_index]->current_values.is_on()) { } else if (!state and id(gb_lights_2)[light_index]->current_values.is_on()) {
ESP_LOGI("core_hw_leds", "Turn-off %s light for Relay %" PRIu8, ESP_LOGI("core_hw_leds", "Turn-off %s light for Relay %" PRIu8,
light_mode_group_2.c_str(), light_index); light_mode_group_2.c_str(), light_index+1);
auto call = id(gb_lights_2)[light_index]->turn_off(); auto call = id(gb_lights_2)[light_index]->turn_off();
if (LIGHT_TRANSITION_TURN_OFF > 0) if (LIGHT_TRANSITION_TURN_OFF > 0)
call.set_transition_length(LIGHT_TRANSITION_TURN_OFF); // in ms call.set_transition_length(LIGHT_TRANSITION_TURN_OFF); // in ms

View File

@@ -11,6 +11,11 @@
##### - For normal system use, modifications to this file are NOT required. ##### ##### - For normal system use, modifications to this file are NOT required. #####
#################################################################################################### ####################################################################################################
--- ---
substitutions:
RELAY_MODE_TEXT_SWITCH: "Switch"
RELAY_MODE_TEXT_LIGHT: "Light"
RELAY_MODE_TEXT_NOT_USED: "Not in use"
globals: globals:
- id: boot_initialization_relays - id: boot_initialization_relays
type: bool type: bool
@@ -19,24 +24,82 @@ globals:
light: light:
# These lights are used for the physical relays to be shown as lights # These lights are used for the physical relays to be shown as lights
- &light_binary_base - id: light_output_1
id: light_output_1
name: Light output 1 name: Light output 1
output: output_relay_1 output: output_relay_1
platform: binary platform: binary
internal: true internal: true
on_turn_on:
then:
- if:
condition:
- switch.is_off: sw_relay_1
then:
- switch.turn_on: sw_relay_1
on_turn_off:
then:
- if:
condition:
- switch.is_on: sw_relay_1
then:
- switch.turn_off: sw_relay_1
- id: light_output_2 - id: light_output_2
name: Light output 2 name: Light output 2
output: output_relay_2 output: output_relay_2
<<: *light_binary_base platform: binary
internal: true
on_turn_on:
then:
- if:
condition:
- switch.is_off: sw_relay_2
then:
- switch.turn_on: sw_relay_2
on_turn_off:
then:
- if:
condition:
- switch.is_on: sw_relay_2
then:
- switch.turn_off: sw_relay_2
- id: light_output_3 - id: light_output_3
name: Light output 3 name: Light output 3
output: output_relay_3 output: output_relay_3
<<: *light_binary_base platform: binary
internal: true
on_turn_on:
then:
- if:
condition:
- switch.is_off: sw_relay_3
then:
- switch.turn_on: sw_relay_3
on_turn_off:
then:
- if:
condition:
- switch.is_on: sw_relay_3
then:
- switch.turn_off: sw_relay_3
- id: light_output_4 - id: light_output_4
name: Light output 4 name: Light output 4
output: output_relay_4 output: output_relay_4
<<: *light_binary_base platform: binary
internal: true
on_turn_on:
then:
- if:
condition:
- switch.is_off: sw_relay_4
then:
- switch.turn_on: sw_relay_4
on_turn_off:
then:
- if:
condition:
- switch.is_on: sw_relay_4
then:
- switch.turn_off: sw_relay_4
output: output:
- id: output_relay_1 - id: output_relay_1
@@ -127,24 +190,20 @@ script:
// Toggle relay if corresponding button action is enabled // Toggle relay if corresponding button action is enabled
switch (button_id) { switch (button_id) {
case 1: case ${BUTTON_1_ID}:
if (sl_button_1_action->active_index().has_value() and if (sl_button_1_action->state != "${RELAY_MODE_TEXT_NOT_USED}")
sl_button_1_action->active_index().value() == 1)
sw_relay_1->toggle(); sw_relay_1->toggle();
break; break;
case 2: case ${BUTTON_2_ID}:
if (sl_button_2_action->active_index().has_value() and if (sl_button_2_action->state != "${RELAY_MODE_TEXT_NOT_USED}")
sl_button_2_action->active_index().value() == 1)
sw_relay_2->toggle(); sw_relay_2->toggle();
break; break;
case 3: case ${BUTTON_3_ID}:
if (sl_button_3_action->active_index().has_value() and if (sl_button_3_action->state != "${RELAY_MODE_TEXT_NOT_USED}")
sl_button_3_action->active_index().value() == 1)
sw_relay_3->toggle(); sw_relay_3->toggle();
break; break;
case 4: case ${BUTTON_4_ID}:
if (sl_button_4_action->active_index().has_value() and if (sl_button_4_action->state != "${RELAY_MODE_TEXT_NOT_USED}")
sl_button_4_action->active_index().value() == 1)
sw_relay_4->toggle(); sw_relay_4->toggle();
break; break;
} }
@@ -226,12 +285,13 @@ script:
select: select:
- &relay_select_mode_base - &relay_select_mode_base
id: sl_relay_1_mode id: sl_relay_1_mode
name: Relay 1 mode name: Relay 1 display mode
platform: template platform: template
options: options:
- "Relay" - "${RELAY_MODE_TEXT_SWITCH}"
- "Light" - "${RELAY_MODE_TEXT_LIGHT}"
- "Not in use" - "${RELAY_MODE_TEXT_NOT_USED}"
initial_option: "${RELAY_MODE_TEXT_SWITCH}"
optimistic: true optimistic: true
restore_value: true restore_value: true
internal: true internal: true
@@ -240,44 +300,107 @@ select:
icon: mdi:dip-switch icon: mdi:dip-switch
- id: sl_relay_2_mode - id: sl_relay_2_mode
name: Relay 2 mode name: Relay 2 display mode
<<: *relay_select_mode_base <<: *relay_select_mode_base
- id: sl_relay_3_mode - id: sl_relay_3_mode
name: Relay 3 mode name: Relay 3 display mode
<<: *relay_select_mode_base <<: *relay_select_mode_base
- id: sl_relay_4_mode - id: sl_relay_4_mode
name: Relay 4 mode name: Relay 4 display mode
<<: *relay_select_mode_base <<: *relay_select_mode_base
switch: switch:
- &relay_switch_base - id: sw_relay_1
id: sw_relay_1
name: Relay 1 name: Relay 1
platform: output
output: output_relay_1 output: output_relay_1
platform: output
restore_mode: RESTORE_DEFAULT_OFF restore_mode: RESTORE_DEFAULT_OFF
internal: true internal: true
on_turn_on: on_turn_on:
then: then:
- script.execute: show_relay_status - script.execute: show_relay_status
- if:
condition:
- light.is_off: light_output_1
then:
light.turn_on: light_output_1
on_turn_off: on_turn_off:
then: then:
- script.execute: show_relay_status - script.execute: show_relay_status
- if:
condition:
- light.is_on: light_output_1
then:
- light.turn_off: light_output_1
- id: sw_relay_2 - id: sw_relay_2
name: Relay 2 name: Relay 2
output: output_relay_2 output: output_relay_2
<<: *relay_switch_base platform: output
restore_mode: RESTORE_DEFAULT_OFF
internal: true
on_turn_on:
then:
- script.execute: show_relay_status
- if:
condition:
- light.is_off: light_output_2
then:
light.turn_on: light_output_2
on_turn_off:
then:
- script.execute: show_relay_status
- if:
condition:
- light.is_on: light_output_2
then:
- light.turn_off: light_output_2
- id: sw_relay_3 - id: sw_relay_3
name: Relay 3 name: Relay 3
output: output_relay_3 output: output_relay_3
<<: *relay_switch_base platform: output
restore_mode: RESTORE_DEFAULT_OFF
internal: true
on_turn_on:
then:
- script.execute: show_relay_status
- if:
condition:
- light.is_off: light_output_3
then:
- light.turn_on: light_output_3
on_turn_off:
then:
- script.execute: show_relay_status
- if:
condition:
- light.is_on: light_output_3
then:
- light.turn_off: light_output_3
- id: sw_relay_4 - id: sw_relay_4
name: Relay 4 name: Relay 4
output: output_relay_4 output: output_relay_4
<<: *relay_switch_base platform: output
restore_mode: RESTORE_DEFAULT_OFF
internal: true
on_turn_on:
then:
- script.execute: show_relay_status
- if:
condition:
- light.is_off: light_output_4
then:
- light.turn_on: light_output_4
on_turn_off:
then:
- script.execute: show_relay_status
- if:
condition:
- light.is_on: light_output_4
then:
- light.turn_off: light_output_4
... ...

View File

@@ -16,8 +16,8 @@ wifi:
packages: packages:
remote_package: remote_package:
url: https://github.com/edwardtfn/TX-Ultimate-Easy url: https://github.com/edwardtfn/TX-Ultimate-Easy
ref: main ref: latest # Or you can specify a version, like `ref: v2024.12.6`
refresh: 30s refresh: 5min
files: files:
- ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml - ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml
# - ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml # Adds experimental BLE proxy support (limited) # - ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml # Adds experimental BLE proxy support (limited)

View File

@@ -1 +1 @@
2024.12.7 2024.12.8

View File

@@ -1 +1 @@
version: 2024.12.7 version: 2024.12.8