From 17bf724d71507e5227c5d9317bfffe88d1654f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Libor=20Klep=C3=A1=C4=8D?= Date: Thu, 19 Sep 2024 09:18:42 +0200 Subject: [PATCH 1/7] add touchfield4 and relay4 --- tx_ultimate_local.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tx_ultimate_local.yaml b/tx_ultimate_local.yaml index 6e58653..4b0226c 100644 --- a/tx_ultimate_local.yaml +++ b/tx_ultimate_local.yaml @@ -7,6 +7,7 @@ substitutions: toggle_relay_1_on_touch: "true" toggle_relay_2_on_touch: "true" toggle_relay_3_on_touch: "true" + toggle_relay_4_on_touch: "true" vibra_time: 150ms button_on_time: 500ms @@ -81,6 +82,9 @@ esphome: - binary_sensor.template.publish: id: touchfield_3 state: OFF + - binary_sensor.template.publish: + id: touchfield_4 + state: OFF - binary_sensor.template.publish: id: multi_touch state: OFF @@ -216,6 +220,21 @@ binary_sensor: state: OFF - script.execute: refresh_led_default + - platform: template + name: "Touchfield 4" + id: touchfield_4 + on_press: + - if: + condition: + lambda: "return ${toggle_relay_4_on_touch};" + then: + - switch.toggle: relay_4 + - delay: ${button_on_time} + - binary_sensor.template.publish: + id: touchfield_4 + state: OFF + - script.execute: refresh_led_default + - platform: template name: "Swipe left" id: swipe_left @@ -293,6 +312,18 @@ switch: then: - script.execute: refresh_led_default + - platform: gpio + id: relay_4 + name: "${friendly_name} L4" + pin: ${relay_4_pin} + restore_mode: RESTORE_DEFAULT_OFF + on_turn_on: + then: + - script.execute: refresh_led_default + on_turn_off: + then: + - script.execute: refresh_led_default + - platform: gpio id: vibra pin: ${vibra_motor_pin} From ffcebc7eb41e07bba495ddcd513c8eca4600a226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Libor=20Klep=C3=A1=C4=8D?= Date: Thu, 19 Sep 2024 09:18:54 +0200 Subject: [PATCH 2/7] mv --- tx_ultimate_local.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tx_ultimate_local.yaml b/tx_ultimate_local.yaml index 4b0226c..e94d769 100644 --- a/tx_ultimate_local.yaml +++ b/tx_ultimate_local.yaml @@ -170,9 +170,7 @@ globals: - id: touch_color type: int [3] restore_value: no - initial_value: ${touch_color} - - + initial_value: ${touch_color} binary_sensor: - platform: template From b45934fbee1486cc1022c9255055ff33fb83144d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Libor=20Klep=C3=A1=C4=8D?= Date: Thu, 19 Sep 2024 09:19:31 +0200 Subject: [PATCH 3/7] add button4 on touchpad --- tx_ultimate_local.yaml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tx_ultimate_local.yaml b/tx_ultimate_local.yaml index e94d769..365bc3f 100644 --- a/tx_ultimate_local.yaml +++ b/tx_ultimate_local.yaml @@ -849,6 +849,41 @@ script: id: touchfield_3 state: ON + - if: + condition: + lambda: "return ${relay_count}==4;" + then: + - if: + condition: + lambda: "return pos <= 2;" + then: + - binary_sensor.template.publish: + id: touchfield_1 + state: ON + + else: + - if: + condition: + lambda: "return pos <= 5;" + then: + - binary_sensor.template.publish: + id: touchfield_2 + state: ON + + else: + - if: + condition: + lambda: "return pos <= 8;" + then: + - binary_sensor.template.publish: + id: touchfield_3 + state: ON + + else: + - binary_sensor.template.publish: + id: touchfield_4 + state: ON + - id: touch_led_marker mode: restart parameters: From 3db876c193ef35e5c5649abb3570027f638b1ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Libor=20Klep=C3=A1=C4=8D?= Date: Thu, 19 Sep 2024 09:20:51 +0200 Subject: [PATCH 4/7] fix the leds, they are offone, add the 4th led button --- tx_ultimate_local.yaml | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/tx_ultimate_local.yaml b/tx_ultimate_local.yaml index 365bc3f..d1da4b9 100644 --- a/tx_ultimate_local.yaml +++ b/tx_ultimate_local.yaml @@ -404,24 +404,32 @@ light: internal: true segments: - id: leds - from: 7 - to: 7 + from: 6 + to: 6 - platform: partition - name: "LEDs Button middle" - id: leds_button_middle + name: "LEDs Button middle_right" + id: leds_button_middle_right internal: true segments: - id: leds - from: 9 - to: 9 + from: 8 + to: 8 + - platform: partition + name: "LEDs Button middle left" + id: leds_button_middle_left + internal: true + segments: + - id: leds + from: 10 + to: 10 - platform: partition name: "LEDs Button left" id: leds_button_left internal: true segments: - id: leds - from: 11 - to: 11 + from: 12 + to: 12 - platform: partition name: "LEDs Nightlight" @@ -430,22 +438,25 @@ light: segments: - id: leds from: 0 - to: 6 + to: 5 - id: leds - from: 8 - to: 8 + from: 7 + to: 7 - id: leds - from: 10 - to: 10 + from: 9 + to: 9 - id: leds - from: 12 + from: 11 + to: 11 + - id: leds + from: 13 to: 19 - id: leds from: 27 to: 27 - id: leds_top from: 0 - to: 6 + to: 5 - platform: partition name: "LEDs Top" From 544e247fa0e99c23b8124c6c0f31046ae431cd69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Libor=20Klep=C3=A1=C4=8D?= Date: Thu, 19 Sep 2024 09:21:23 +0200 Subject: [PATCH 5/7] make the button press more readable --- tx_ultimate_local.yaml | 90 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 78 insertions(+), 12 deletions(-) diff --git a/tx_ultimate_local.yaml b/tx_ultimate_local.yaml index d1da4b9..8eee45f 100644 --- a/tx_ultimate_local.yaml +++ b/tx_ultimate_local.yaml @@ -615,27 +615,93 @@ script: - if: condition: - lambda: "return (${relay_count}>1 && id(relay_1).state) ;" + lambda: "return ${relay_count}==1;" then: - - script.execute: led_on_button_left - else: - - script.execute: led_off_button_left + - if: + condition: + lambda: "return id(relay_1).state;" + then: + - script.execute: led_on_button_middle_right + else: + - script.execute: led_off_button_middle_right - if: condition: - lambda: "return (${relay_count}==3 && id(relay_2).state) || (${relay_count}==1 && id(relay_1).state);" + lambda: "return ${relay_count}==2;" then: - - script.execute: led_on_button_middle - else: - - script.execute: led_off_button_middle + - if: + condition: + lambda: "return (id(relay_1).state);" + then: + - script.execute: led_on_button_left + else: + - script.execute: led_off_button_left + - if: + condition: + lambda: "return id(relay_2).state;" + then: + - script.execute: led_on_button_right + else: + - script.execute: led_off_button_right - if: condition: - lambda: "return (${relay_count}==2 && id(relay_2).state) || (${relay_count}==3 && id(relay_3).state);" + lambda: "return ${relay_count}==3;" then: - - script.execute: led_on_button_right - else: - - script.execute: led_off_button_right + - if: + condition: + lambda: "return (id(relay_1).state);" + then: + - script.execute: led_on_button_left + else: + - script.execute: led_off_button_left + - if: + condition: + lambda: "return id(relay_2).state;" + then: + - script.execute: led_on_button_middle_right + else: + - script.execute: led_off_button_middle_right + - if: + condition: + lambda: "return id(relay_3).state;" + then: + - script.execute: led_on_button_right + else: + - script.execute: led_off_button_right + + - if: + condition: + lambda: "return ${relay_count}==4;" + then: + - if: + condition: + lambda: "return (id(relay_1).state);" + then: + - script.execute: led_on_button_left + else: + - script.execute: led_off_button_left + - if: + condition: + lambda: "return id(relay_2).state;" + then: + - script.execute: led_on_button_middle_left + else: + - script.execute: led_off_button_middle_left + - if: + condition: + lambda: "return id(relay_3).state;" + then: + - script.execute: led_on_button_middle_right + else: + - script.execute: led_off_button_middle_right + - if: + condition: + lambda: "return id(relay_4).state;" + then: + - script.execute: led_on_button_right + else: + - script.execute: led_off_button_right - if: condition: From d7d0f99f76fb4ca70c19cf374ecaf0d7bbde55fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Libor=20Klep=C3=A1=C4=8D?= Date: Thu, 19 Sep 2024 09:22:35 +0200 Subject: [PATCH 6/7] add extra led button --- tx_ultimate_local.yaml | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/tx_ultimate_local.yaml b/tx_ultimate_local.yaml index 8eee45f..4084c60 100644 --- a/tx_ultimate_local.yaml +++ b/tx_ultimate_local.yaml @@ -721,16 +721,26 @@ script: green: !lambda "return id(button_color)[1]/100.0;" blue: !lambda "return id(button_color)[2]/100.0;" - - id: led_on_button_middle + - id: led_on_button_middle_left mode: restart then: - light.turn_on: - id: leds_button_middle + id: leds_button_middle_left brightness: ${button_brightness} red: !lambda "return id(button_color)[0]/100.0;" green: !lambda "return id(button_color)[1]/100.0;" blue: !lambda "return id(button_color)[2]/100.0;" + - id: led_on_button_middle_right + mode: restart + then: + - light.turn_on: + id: leds_button_middle_right + brightness: ${button_brightness} + red: !lambda "return id(button_color)[0]/100.0;" + green: !lambda "return id(button_color)[1]/100.0;" + blue: !lambda "return id(button_color)[2]/100.0;" + - id: led_on_button_right mode: restart then: @@ -759,7 +769,7 @@ script: - light.turn_off: id: leds_button_left - - id: led_off_button_middle + - id: led_off_button_middle_left mode: restart then: - if: @@ -767,7 +777,7 @@ script: lambda: "return id(nightlight).state || id(nightlight_active).state;" then: - light.turn_on: - id: leds_button_middle + id: leds_button_middle_left brightness: ${nightlight_brightness} red: !lambda "return id(nightlight_color)[0]/100.0;" green: !lambda "return id(nightlight_color)[1]/100.0;" @@ -775,7 +785,24 @@ script: else: - light.turn_off: id: leds_button_middle + id: leds_button_middle_left + - id: led_off_button_middle_right + mode: restart + then: + - if: + condition: + lambda: "return id(nightlight).state || id(nightlight_active).state;" + then: + - light.turn_on: + id: leds_button_middle_right + brightness: ${nightlight_brightness} + red: !lambda "return id(nightlight_color)[0]/100.0;" + green: !lambda "return id(nightlight_color)[1]/100.0;" + blue: !lambda "return id(nightlight_color)[2]/100.0;" + else: + - light.turn_off: + id: leds_button_middle_right - id: led_off_button_right mode: restart From 5c4f0e01784d417f32f3b52129d57ace339891a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Libor=20Klep=C3=A1=C4=8D?= Date: Thu, 19 Sep 2024 09:23:51 +0200 Subject: [PATCH 7/7] rm old button --- tx_ultimate_local.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/tx_ultimate_local.yaml b/tx_ultimate_local.yaml index 4084c60..c065f9f 100644 --- a/tx_ultimate_local.yaml +++ b/tx_ultimate_local.yaml @@ -784,7 +784,6 @@ script: blue: !lambda "return id(nightlight_color)[2]/100.0;" else: - light.turn_off: - id: leds_button_middle id: leds_button_middle_left - id: led_off_button_middle_right