diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml index ad0ac37..331bda3 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_addon_ble_proxy.yaml @@ -1,3 +1,15 @@ +#################################################################################################### +##### TX Ultimate Easy for ESPHome ##### +##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy ##### +#################################################################################################### +##### Purpose: ESPHome Core - Add-on - BLE Proxy ##### +#################################################################################################### +##### Author: edwardtfn - https://github.com/edwardtfn - https://buymeacoffee.com/edwardfirmo ##### +#################################################################################################### +##### NOTE: ##### +##### - Make changes ONLY if absolutely necessary and you have the required knowledge. ##### +##### - For normal system use, modifications to this file are NOT required. ##### +#################################################################################################### --- bluetooth_proxy: diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml index 9105750..843dbe8 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml @@ -1,3 +1,15 @@ +#################################################################################################### +##### TX Ultimate Easy for ESPHome ##### +##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy ##### +#################################################################################################### +##### Purpose: ESPHome Core ##### +#################################################################################################### +##### Author: edwardtfn - https://github.com/edwardtfn - https://buymeacoffee.com/edwardfirmo ##### +#################################################################################################### +##### NOTE: ##### +##### - Make changes ONLY if absolutely necessary and you have the required knowledge. ##### +##### - For normal system use, modifications to this file are NOT required. ##### +#################################################################################################### --- substitutions: name: tx-ultimate-easy @@ -6,178 +18,19 @@ substitutions: latitude: '0' longitude: '0' zone_home: 'zone.home' - default_transition_length: 500ms - invalid_cooldown: 100ms version: '0.0.3' -api: - id: api_server - services: - - service: set_float - variables: - component: string - val: float - then: - - lambda: |- - if (!isnan(val)) { - if (component == "latitude") sun_entity->set_latitude(val); - else if (component == "longitude") sun_entity->set_longitude(val); - } - -binary_sensor: - - id: bs_vibrating - name: Vibrating - icon: mdi:vibrate - internal: false - platform: template - lambda: return sw_vibration_motor->state; - - - id: bs_button_1 - name: Button 1 - icon: mdi:gesture-tap-box - internal: false - platform: template - on_click: - then: - - lambda: |- - if (sl_button_1_action->active_index().has_value() and - sl_button_1_action->active_index().value() == 1 and - !bs_multi_touch->state and - !bs_swipe_left->state and - !bs_swipe_down->state and - !bs_swipe_right->state) - sw_relay_1->toggle(); - send_event_to_ha->execute("bs_button_1", "click"); - on_double_click: - then: - - lambda: send_event_to_ha->execute("bs_button_1", "double_click"); - on_multi_click: - - timing: &long_click-timing - - ON for at least 0.8s - invalid_cooldown: ${invalid_cooldown} - then: - - lambda: send_event_to_ha->execute("bs_button_1", "long_click"); - - - id: bs_button_2 - name: Button 2 - icon: mdi:gesture-tap-box - internal: true - platform: template - on_click: - then: - - lambda: |- - if (sl_button_2_action->active_index().has_value() and - sl_button_2_action->active_index().value() == 1 and - !bs_multi_touch->state and - !bs_swipe_left->state and - !bs_swipe_down->state and - !bs_swipe_right->state) - sw_relay_2->toggle(); - send_event_to_ha->execute("bs_button_2", "click"); - on_double_click: - then: - - lambda: send_event_to_ha->execute("bs_button_2", "double_click"); - on_multi_click: - - timing: *long_click-timing - invalid_cooldown: ${invalid_cooldown} - then: - - lambda: send_event_to_ha->execute("bs_button_2", "long_click"); - - - id: bs_button_3 - name: Button 3 - icon: mdi:gesture-tap-box - internal: true - platform: template - on_click: - then: - - lambda: |- - if (sl_button_3_action->active_index().has_value() and - sl_button_3_action->active_index().value() == 1 and - !bs_multi_touch->state and - !bs_swipe_left->state and - !bs_swipe_down->state and - !bs_swipe_right->state) - sw_relay_3->toggle(); - send_event_to_ha->execute("bs_button_3", "click"); - on_double_click: - then: - - lambda: send_event_to_ha->execute("bs_button_3", "double_click"); - on_multi_click: - - timing: *long_click-timing - invalid_cooldown: ${invalid_cooldown} - then: - - lambda: send_event_to_ha->execute("bs_button_3", "long_click"); - - - id: bs_button_4 - name: Button 4 - icon: mdi:gesture-tap-box - internal: true - platform: template - on_click: - then: - - lambda: |- - if (sl_button_4_action->active_index().has_value() and - sl_button_4_action->active_index().value() == 1 and - !bs_multi_touch->state and - !bs_swipe_left->state and - !bs_swipe_down->state and - !bs_swipe_right->state) - sw_relay_4->toggle(); - send_event_to_ha->execute("bs_button_4", "click"); - on_double_click: - then: - - lambda: send_event_to_ha->execute("bs_button_4", "double_click"); - on_multi_click: - - timing: *long_click-timing - invalid_cooldown: ${invalid_cooldown} - then: - - lambda: send_event_to_ha->execute("bs_button_4", "long_click"); - - - id: bs_multi_touch - name: Multi-touch - icon: mdi:gesture-two-tap - internal: false - platform: template - on_click: - then: - - lambda: send_event_to_ha->execute("multi_touch", "multi_touch"); - - - id: bs_swipe_left - name: Swipe left - icon: mdi:gesture-swipe-left - internal: true - platform: template - on_click: - then: - - lambda: send_event_to_ha->execute("swipe", "left"); - - - id: bs_swipe_right - name: Swipe right - icon: mdi:gesture-swipe-right - internal: true - platform: template - on_click: - then: - - lambda: send_event_to_ha->execute("swipe", "right"); - - - id: bs_swipe_up - name: Swipe up - icon: mdi:gesture-swipe-up - internal: true - platform: template - on_click: - then: - - lambda: send_event_to_ha->execute("swipe", "up"); - - - id: bs_swipe_down - name: Swipe down - icon: mdi:gesture-swipe-down - internal: true - platform: template - on_click: - then: - - lambda: send_event_to_ha->execute("swipe", "down"); +packages: + # yamllint disable rule:colons + core_api: !include TX-Ultimate-Easy-ESPHome_core_api.yaml + core_hw_buttons: !include TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml + core_hw_led: !include TX-Ultimate-Easy-ESPHome_core_hw_led.yaml + core_hw_relays: !include TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml + core_hw_speaker: !include TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml + core_hw_touch: !include TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml + core_hw_vibration: !include TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml + # yamllint enable rule:colons button: - id: bt_restart @@ -185,15 +38,6 @@ button: internal: false platform: restart - - id: bt_vibrate - name: Vibrate - icon: mdi:vibrate - internal: false - platform: template - on_press: - then: - - script.execute: vibrate - captive_portal: id: ap_captive_portal @@ -208,6 +52,7 @@ esphome: platformio_options: build_flags: - -D TX_ULTIMATE_EASY_CORE + on_boot: - priority: 700 then: @@ -335,1272 +180,22 @@ esphome: then: - lambda: send_event_to_ha->execute("boot", "done"); -external_components: - - source: github://edwardtfn/TX-Ultimate-Easy@dev # Change this before releasing - components: - - tx_ultimate_easy - -globals: - - id: gb_lights_1 - type: std::vector - restore_value: false - - id: gb_lights_2 - type: std::vector - restore_value: false - -i2s_audio: - id: if_i2s_audio - i2s_bclk_pin: GPIO2 - i2s_lrclk_pin: GPIO4 - improv_serial: id: serial_improv -light: - - id: ligth_output_1 - name: Light output 1 - internal: true - platform: binary - output: output_relay_1 - - id: ligth_output_2 - name: Light output 2 - internal: true - platform: binary - output: output_relay_2 - - id: ligth_output_3 - name: Light output 3 - internal: true - platform: binary - output: output_relay_3 - - id: ligth_output_4 - name: Light output 4 - internal: true - platform: binary - output: output_relay_4 - - - id: light_full - name: Light - All - internal: true - platform: neopixelbus - type: GRB - variant: WS2811 - num_leds: 32 - pin: GPIO13 - - - id: light_eu - name: Light - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 0 - to: 27 - effects: &light_effects_full - - addressable_rainbow: - - addressable_rainbow: - name: "Rainbow - Fast" - speed: 50 - - pulse: - - pulse: - name: "Pulse - Fast" - transition_length: 0.5s - update_interval: 0.5s - - pulse: - name: "Pulse - Slow" - update_interval: 2s - - addressable_scan: - - addressable_scan: - name: Scan Effect With Custom Values - move_interval: 100ms - scan_width: 3 - - addressable_twinkle: - - addressable_twinkle: - name: Twinkle Effect With Custom Values - twinkle_probability: 5% - progress_interval: 4ms - - addressable_random_twinkle: - - addressable_random_twinkle: - name: Random Twinkle Effect With Custom Values - twinkle_probability: 20% - progress_interval: 32ms - - addressable_fireworks: - - addressable_fireworks: - name: Fireworks Effect With Custom Values - update_interval: 32ms - spark_probability: 10% - use_random_color: false - fade_out_rate: 120 - - addressable_flicker: - - addressable_flicker: - name: Flicker Effect With Custom Values - update_interval: 16ms - intensity: 5% - - random: - - id: light_us - name: Light - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 0 - to: 31 - effects: *light_effects_full - - - id: light_eu_bottom - name: Light - Bottom - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 6 - to: 12 - reversed: true - effects: *light_effects_full - - id: light_eu_left - name: Light - Left - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 13 - to: 19 - reversed: true - effects: *light_effects_full - - id: light_eu_right - name: Light - Right - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 27 - to: 27 - reversed: false - - id: light_full - from: 0 - to: 5 - reversed: false - effects: *light_effects_full - - id: light_eu_top - name: Light - Top - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 20 - to: 26 - reversed: false - effects: *light_effects_full - - id: light_us_bottom - name: Light - Bottom - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 9 - to: 14 - reversed: true - effects: *light_effects_full - - id: light_us_left - name: Light - Left - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 15 - to: 24 - reversed: true - effects: *light_effects_full - - id: light_us_right - name: Light - Right - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 31 - to: 31 - reversed: false - - id: light_full - from: 0 - to: 8 - reversed: false - effects: *light_effects_full - - id: light_us_top - name: Light - Top - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 25 - to: 30 - reversed: false - effects: *light_effects_full - - - id: light_00 - name: Light - LED 00 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 0 - to: 0 - - id: light_01 - name: Light - LED 01 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 1 - to: 1 - - id: light_02 - name: Light - LED 02 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 2 - to: 2 - - id: light_03 - name: Light - LED 03 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 3 - to: 3 - - id: light_04 - name: Light - LED 04 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 4 - to: 4 - - id: light_05 - name: Light - LED 05 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 5 - to: 5 - - id: light_06 - name: Light - LED 06 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 6 - to: 6 - - id: light_07 - name: Light - LED 07 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 7 - to: 7 - - id: light_08 - name: Light - LED 08 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 8 - to: 8 - - id: light_09 - name: Light - LED 09 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 9 - to: 9 - - id: light_10 - name: Light - LED 10 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 10 - to: 10 - - id: light_11 - name: Light - LED 11 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 11 - to: 11 - - id: light_12 - name: Light - LED 12 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 12 - to: 12 - - id: light_13 - name: Light - LED 13 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 13 - to: 13 - - id: light_14 - name: Light - LED 14 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 14 - to: 14 - - id: light_15 - name: Light - LED 15 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 15 - to: 15 - - id: light_16 - name: Light - LED 16 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 16 - to: 16 - - id: light_17 - name: Light - LED 17 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 17 - to: 17 - - id: light_18 - name: Light - LED 18 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 18 - to: 18 - - id: light_19 - name: Light - LED 19 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 19 - to: 19 - - id: light_20 - name: Light - LED 20 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 20 - to: 20 - - id: light_21 - name: Light - LED 21 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 21 - to: 21 - - id: light_22 - name: Light - LED 22 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 22 - to: 22 - - id: light_23 - name: Light - LED 23 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 23 - to: 23 - - id: light_24 - name: Light - LED 24 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 24 - to: 24 - - id: light_25 - name: Light - LED 25 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 25 - to: 25 - - id: light_26 - name: Light - LED 26 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 26 - to: 26 - - id: light_27 - name: Light - LED 27 - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 27 - to: 27 - - id: light_28 - name: Light - LED 28 - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 28 - to: 28 - - id: light_29 - name: Light - LED 29 - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 29 - to: 29 - - id: light_30 - name: Light - LED 30 - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 30 - to: 30 - - id: light_31 - name: Light - LED 31 - internal: true - disabled_by_default: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 31 - to: 31 - - - id: light_eu_rl_1_1_bottom - name: Light - Relay 1 of 1 (bottom) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 9 - to: 9 - - id: light_eu_rl_1_1_top - name: Light - Relay 1 of 1 (top) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 23 - to: 23 - - id: light_eu_rl_1_2_bottom - name: Light - Relay 1 of 2 (bottom) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 11 - to: 11 - - id: light_eu_rl_1_2_top - name: Light - Relay 1 of 2 (top) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 21 - to: 21 - - id: light_eu_rl_2_2_bottom - name: Light - Relay 2 of 2 (bottom) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 7 - to: 7 - - id: light_eu_rl_2_2_top - name: Light - Relay 2 of 2 (top) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 25 - to: 25 - - id: light_eu_rl_1_3_bottom - name: Light - Relay 1 of 3 (bottom) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 12 - to: 12 - - id: light_eu_rl_1_3_top - name: Light - Relay 1 of 3 (top) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 20 - to: 20 - - id: light_eu_rl_2_3_bottom - name: Light - Relay 2 of 3 (bottom) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 9 - to: 9 - - id: light_eu_rl_2_3_top - name: Light - Relay 2 of 3 (top) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 23 - to: 23 - - id: light_eu_rl_3_3_bottom - name: Light - Relay 3 of 3 (bottom) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 6 - to: 6 - - id: light_eu_rl_3_3_top - name: Light - Relay 3 of 3 (top) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 26 - to: 26 - - id: light_eu_rl_1_4_bottom - name: Light - Relay 1 of 4 (bottom) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 12 - to: 12 - - id: light_eu_rl_1_4_top - name: Light - Relay 1 of 4 (top) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 20 - to: 20 - - id: light_eu_rl_2_4_bottom - name: Light - Relay 2 of 4 (bottom) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 10 - to: 10 - - id: light_eu_rl_2_4_top - name: Light - Relay 2 of 4 (top) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 22 - to: 22 - - id: light_eu_rl_3_4_bottom - name: Light - Relay 3 of 4 (bottom) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 8 - to: 8 - - id: light_eu_rl_3_4_top - name: Light - Relay 3 of 4 (top) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 24 - to: 24 - - id: light_eu_rl_4_4_bottom - name: Light - Relay 4 of 4 (bottom) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 6 - to: 6 - - id: light_eu_rl_4_4_top - name: Light - Relay 4 of 4 (top) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 26 - to: 26 - - id: light_us_rl_1_1_left - name: Light - Relay 1 of 1 (left) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 15 - to: 24 - - id: light_us_rl_1_1_right - name: Light - Relay 1 of 1 (right) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 31 - to: 31 - - id: light_full - from: 0 - to: 8 - - id: light_us_rl_1_2_left - name: Light - Relay 1 of 2 (left) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 20 - to: 24 - - id: light_us_rl_1_2_right - name: Light - Relay 1 of 2 (right) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 31 - to: 31 - - id: light_full - from: 0 - to: 3 - - id: light_us_rl_2_2_left - name: Light - Relay 2 of 2 (left) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 15 - to: 19 - - id: light_us_rl_2_2_right - name: Light - Relay 2 of 2 (right) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 4 - to: 8 - - id: light_us_rl_1_3_left - name: Light - Relay 1 of 3 (left) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 22 - to: 23 - - id: light_us_rl_1_3_right - name: Light - Relay 1 of 3 (right) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 0 - to: 1 - - id: light_us_rl_2_3_left - name: Light - Relay 2 of 3 (left) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 19 - to: 20 - - id: light_us_rl_2_3_right - name: Light - Relay 2 of 3 (right) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 3 - to: 4 - - id: light_us_rl_3_3_left - name: Light - Relay 3 of 3 (left) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 17 - to: 18 - - id: light_us_rl_3_3_right - name: Light - Relay 3 of 3 (right) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 6 - to: 7 - - id: light_us_rl_1_4_left - name: Light - Relay 1 of 4 (left) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 12 - to: 12 - - id: light_us_rl_1_4_right - name: Light - Relay 1 of 4 (right) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 31 - to: 31 - - id: light_us_rl_2_4_left - name: Light - Relay 2 of 4 (left) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 24 - to: 24 - - id: light_us_rl_2_4_right - name: Light - Relay 2 of 4 (right) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 2 - to: 2 - - id: light_us_rl_3_4_left - name: Light - Relay 3 of 4 (left) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 21 - to: 21 - - id: light_us_rl_3_4_right - name: Light - Relay 3 of 4 (right) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 4 - to: 4 - - id: light_us_rl_4_4_left - name: Light - Relay 4 of 4 (left) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 19 - to: 19 - - id: light_us_rl_4_4_right - name: Light - Relay 4 of 4 (right) - internal: true - platform: partition - default_transition_length: ${default_transition_length} - segments: - - id: light_full - from: 7 - to: 7 - logger: -media_player: - - id: mp_speaker - name: Speaker - platform: i2s_audio - i2s_dout_pin: GPIO15 - i2s_audio_id: if_i2s_audio - i2s_comm_fmt: lsb - dac_type: external - mode: mono - internal: false - -number: - - id: nr_vibrating_duration - name: Vibrate duration - icon: mdi:vibrate - unit_of_measurement: ms - # mode: box - internal: false - entity_category: config - platform: template - min_value: 1 - max_value: 500 - step: 1 - initial_value: 15 - optimistic: true - restore_value: true - - - id: nr_touch_duration - name: Touch duration - icon: mdi:timer-cog-outline - unit_of_measurement: ms - # mode: box - internal: false - entity_category: config - platform: template - min_value: 10 - max_value: 1500 - step: 1 - initial_value: 250 - optimistic: true - restore_value: true - ota: platform: esphome -output: - - id: output_relay_1 - platform: gpio - pin: GPIO18 - - - id: output_relay_2 - platform: gpio - pin: GPIO17 - - - id: output_relay_3 - platform: gpio - pin: GPIO27 - - - id: output_relay_4 - platform: gpio - pin: GPIO23 - psram: script: - - id: release_buttons + - id: boot_initialize mode: restart - then: - - lambda: |- - if (bs_button_1->state) bs_button_1->publish_state(false); - if (bs_button_2->state) bs_button_2->publish_state(false); - if (bs_button_3->state) bs_button_3->publish_state(false); - if (bs_button_4->state) bs_button_4->publish_state(false); - - - id: send_event_to_ha - mode: queued - parameters: - component: string - event: string - then: - - lambda: |- - esphome::api::CustomAPIDevice ha_event; - ha_event.fire_homeassistant_event("esphome.tx_ultimate_easy", - { - {"device_name", tx_device_name->state.c_str()}, - {"firmware", "${version}"}, - {"component", component}, - {"event", event}, - }); - - - id: show_relay_status - mode: restart - then: - - lambda: |- - return; - show_relay_status->stop(); - auto model_format = sl_tx_model_format->active_index(); - std::vector relay_modes; - - if (model_format.has_value() and model_format.value() == 0) { - relay_modes = {sl_relay_1_light_mode_eu, sl_relay_2_light_mode_eu, sl_relay_3_light_mode_eu, sl_relay_4_light_mode_eu}; - } else { - relay_modes = {sl_relay_1_light_mode_us, sl_relay_2_light_mode_us, sl_relay_3_light_mode_us, sl_relay_4_light_mode_us}; - } - - std::vector switches = {sw_relay_1, sw_relay_2, sw_relay_3, sw_relay_4}; - for (int i = 0; i < relay_modes.size(); ++i) { - auto light_index = relay_modes[i]->active_index(); - if (light_index.has_value()) { - uint8_t light_idx = light_index.value(); - bool switch_state = switches[i]->state; - if (light_idx == 1 || light_idx == 3) { - if (switch_state) - id(gb_lights_1)[i]->turn_on().perform(); - else - id(gb_lights_1)[i]->turn_off().perform(); - } - if (light_idx == 2 || light_idx == 3) { - if (switch_state) - id(gb_lights_2)[i]->turn_on().perform(); - else - id(gb_lights_2)[i]->turn_off().perform(); - } - } - } - - - id: vibrate - mode: restart - then: - - switch.turn_on: sw_vibration_motor - - delay: !lambda return nr_vibrating_duration->state; - - switch.turn_off: sw_vibration_motor + then: # There's nothing here so far select: - - id: sl_button_1_action - name: Button 1 action - platform: template - options: - - "None" - - "Relay 1 (toggle)" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dip-switch - - - id: sl_button_2_action - name: Button 2 action - platform: template - options: - - "None" - - "Relay 2 (toggle)" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dip-switch - - - id: sl_button_3_action - name: Button 3 action - platform: template - options: - - "None" - - "Relay 3 (toggle)" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dip-switch - - - id: sl_button_4_action - name: Button 4 action - platform: template - options: - - "None" - - "Relay 4 (toggle)" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dip-switch - - - id: sl_relay_1_mode - name: Relay 1 mode - platform: template - options: - - "Relay" - - "Light" - - "Not in use" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dip-switch - - - id: sl_relay_2_mode - name: Relay 2 mode - platform: template - options: - - "Relay" - - "Light" - - "Not in use" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dip-switch - - - id: sl_relay_3_mode - name: Relay 3 mode - platform: template - options: - - "Relay" - - "Light" - - "Not in use" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dip-switch - - - id: sl_relay_4_mode - name: Relay 4 mode - platform: template - options: - - "Relay" - - "Light" - - "Not in use" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dip-switch - - - id: sl_relay_1_light_mode_eu - name: Relay 1 light mode - platform: template - options: - - "Disabled" - - "Bottom" - - "Top" - - "Both" - initial_option: "Bottom" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dots-square - - - id: sl_relay_2_light_mode_eu - name: Relay 2 light mode - platform: template - options: - - "Disabled" - - "Bottom" - - "Top" - - "Both" - initial_option: "Bottom" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dots-square - - - id: sl_relay_3_light_mode_eu - name: Relay 3 light mode - platform: template - options: - - "Disabled" - - "Bottom" - - "Top" - - "Both" - initial_option: "Bottom" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dots-square - - - id: sl_relay_4_light_mode_eu - name: Relay 4 light mode - platform: template - options: - - "Disabled" - - "Bottom" - - "Top" - - "Both" - initial_option: "Bottom" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dots-square - - - id: sl_relay_1_light_mode_us - name: Relay 1 light mode - platform: template - options: - - "Disabled" - - "Left" - - "Right" - - "Both" - initial_option: "Right" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dots-square - - - id: sl_relay_2_light_mode_us - name: Relay 2 light mode - platform: template - options: - - "Disabled" - - "Left" - - "Right" - - "Both" - initial_option: "Right" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dots-square - - - id: sl_relay_3_light_mode_us - name: Relay 3 light mode - platform: template - options: - - "Disabled" - - "Left" - - "Right" - - "Both" - initial_option: "Right" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dots-square - - - id: sl_relay_4_light_mode_us - name: Relay 4 light mode - platform: template - options: - - "Disabled" - - "Left" - - "Right" - - "Both" - initial_option: "Right" - optimistic: true - restore_value: true - internal: true - entity_category: config - disabled_by_default: false - icon: mdi:dots-square - - - id: sl_touch_vibration_feedback - name: Touch - Vibration feedback - platform: template - options: - - "Disabled" - - "On press" - - "On release" - - "Always" - initial_option: "Disabled" - optimistic: true - restore_value: true - internal: false - entity_category: config - disabled_by_default: false - icon: mdi:vibrate - - id: sl_tx_model_format name: Model (Format) platform: template @@ -1631,6 +226,7 @@ select: disabled_by_default: false icon: mdi:dip-switch + sensor: - id: sun_elevation name: Sun Elevation @@ -1659,82 +255,6 @@ sun: latitude: ${latitude} longitude: ${longitude} -switch: - - id: sw_relay_1 - name: Relay 1 - platform: output - output: output_relay_1 - restore_mode: RESTORE_DEFAULT_OFF - internal: true - on_turn_on: - then: - - script.execute: show_relay_status - on_turn_off: - then: - - script.execute: show_relay_status - - - id: sw_relay_2 - name: Relay 2 - platform: output - output: output_relay_2 - restore_mode: RESTORE_DEFAULT_OFF - internal: true - on_turn_on: - then: - - script.execute: show_relay_status - on_turn_off: - then: - - script.execute: show_relay_status - - - id: sw_relay_3 - name: Relay 3 - platform: output - output: output_relay_3 - restore_mode: RESTORE_DEFAULT_OFF - internal: true - on_turn_on: - then: - - script.execute: show_relay_status - on_turn_off: - then: - - script.execute: show_relay_status - - - id: sw_relay_4 - name: Relay 4 - platform: output - output: output_relay_4 - restore_mode: RESTORE_DEFAULT_OFF - internal: true - on_turn_on: - then: - - script.execute: show_relay_status - on_turn_off: - then: - - script.execute: show_relay_status - - - id: sw_touch_panel_power - name: Touch panel - Power - platform: gpio - pin: - number: GPIO5 - inverted: true - restore_mode: ALWAYS_ON - internal: false - entity_category: config - - - id: sw_vibration_motor - name: Vibration motor - platform: gpio - pin: GPIO21 - restore_mode: ALWAYS_OFF - internal: true - on_turn_on: - then: - - lambda: bs_vibrating->publish_state(true); - on_turn_off: - then: - - lambda: bs_vibrating->publish_state(false); - text_sensor: - id: tx_fw_version name: Firmware version @@ -1775,82 +295,6 @@ time: - id: time_source platform: homeassistant -tx_ultimate_easy: - id: tx_ultimate - uart: uart_touch - - on_multi_touch_release: - - lambda: |- - if (sl_touch_vibration_feedback->state == "On press" or sl_touch_vibration_feedback->state == "Always") - vibrate->execute(); - bs_multi_touch->publish_state(true); - release_buttons->execute(); - - delay: !lambda return nr_touch_duration->state; - - lambda: bs_multi_touch->publish_state(false); - - on_press: - - lambda: |- - if (sl_touch_vibration_feedback->state == "On press" or sl_touch_vibration_feedback->state == "Always") - vibrate->execute(); - auto model_index = sl_tx_model_gang->active_index(); - if (model_index.has_value()) { - uint8_t model_idx = model_index.value() + 1; - switch (model_idx) { - case 1: // 1 Gang - bs_button_1->publish_state(true); - break; - case 2: // 2 Gang - if (touch.x <= 5) bs_button_1->publish_state(true); - else bs_button_2->publish_state(true); - break; - case 3: // 3 Gang - if (touch.x <= 3) bs_button_1->publish_state(true); - else if (touch.x <= 7) bs_button_2->publish_state(true); - else bs_button_3->publish_state(true); - break; - case 4: // 4 Gang - if (touch.x <= 2) bs_button_1->publish_state(true); - else if (touch.x <= 5) bs_button_2->publish_state(true); - else if (touch.x <= 8) bs_button_3->publish_state(true); - else bs_button_4->publish_state(true); - break; - } - } - - on_release: - - lambda: |- - if (sl_touch_vibration_feedback->state == "On release" or sl_touch_vibration_feedback->state == "Always") - vibrate->execute(); - release_buttons->execute(); - if (bs_swipe_left->state) bs_swipe_left->publish_state(false); - if (bs_swipe_right->state) bs_swipe_right->publish_state(false); - - on_swipe_left: - - lambda: |- - bs_swipe_left->publish_state(true); - release_buttons->execute(); - - delay: !lambda return nr_touch_duration->state; - - lambda: bs_swipe_left->publish_state(false); - - on_swipe_right: - - lambda: |- - bs_swipe_right->publish_state(true); - release_buttons->execute(); - - delay: !lambda return nr_touch_duration->state; - - lambda: bs_swipe_right->publish_state(false); - - on_touch_event: - - lambda: |- - ESP_LOGD("tx_ultimate_easy.on_touch_event", "Touch event:"); - ESP_LOGD("tx_ultimate_easy.on_touch_event", " State: %i (%s)", touch.state, touch.state_str.c_str()); - ESP_LOGD("tx_ultimate_easy.on_touch_event", " Position: %i", touch.x); - -uart: - id: uart_touch - tx_pin: GPIO19 - rx_pin: GPIO22 - baud_rate: 115200 - web_server: wifi: diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_api.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_api.yaml new file mode 100644 index 0000000..c326718 --- /dev/null +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_api.yaml @@ -0,0 +1,52 @@ +#################################################################################################### +##### TX Ultimate Easy for ESPHome ##### +##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy ##### +#################################################################################################### +##### Purpose: ESPHome Core - API ##### +#################################################################################################### +##### Author: edwardtfn - https://github.com/edwardtfn - https://buymeacoffee.com/edwardfirmo ##### +#################################################################################################### +##### NOTE: ##### +##### - Make changes ONLY if absolutely necessary and you have the required knowledge. ##### +##### - For normal system use, modifications to this file are NOT required. ##### +#################################################################################################### +--- +api: + id: api_server + actions: + - action: set_float + variables: + component: string + val: float + then: + - lambda: |- + if (!isnan(val)) { + if (component == "latitude") sun_entity->set_latitude(val); + else if (component == "longitude") sun_entity->set_longitude(val); + } + +script: + - id: !extend button_action + then: + - script.execute: + id: send_event_to_ha + component: !lambda return component.c_str(); + event: !lambda return event.c_str(); + + - id: send_event_to_ha + mode: queued + parameters: + component: string + event: string + then: + - lambda: |- + esphome::api::CustomAPIDevice ha_event; + ha_event.fire_homeassistant_event("esphome.tx_ultimate_easy", + { + {"device_name", tx_device_name->state.c_str()}, + {"firmware", "${version}"}, + {"component", component}, + {"event", event}, + }); + +... diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml new file mode 100644 index 0000000..ffd32d8 --- /dev/null +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_buttons.yaml @@ -0,0 +1,248 @@ +#################################################################################################### +##### TX Ultimate Easy for ESPHome ##### +##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy ##### +#################################################################################################### +##### Purpose: ESPHome Core - Hardware - Buttons ##### +#################################################################################################### +##### Author: edwardtfn - https://github.com/edwardtfn - https://buymeacoffee.com/edwardfirmo ##### +#################################################################################################### +##### NOTE: ##### +##### - Make changes ONLY if absolutely necessary and you have the required knowledge. ##### +##### - For normal system use, modifications to this file are NOT required. ##### +#################################################################################################### +--- +substitutions: + invalid_cooldown: 100ms + +binary_sensor: + - id: bs_button_1 + name: Button 1 + icon: mdi:gesture-tap-box + internal: false + platform: template + on_click: + then: + - script.execute: + id: button_action + component: bs_button_1 + event: click + on_double_click: + then: + - script.execute: + id: button_action + component: bs_button_1 + event: double_click + on_multi_click: + - timing: &long_click-timing + - ON for at least 0.8s + invalid_cooldown: ${invalid_cooldown} + then: + - script.execute: + id: button_action + component: bs_button_1 + event: long_click + + - id: bs_button_2 + name: Button 2 + icon: mdi:gesture-tap-box + internal: true + platform: template + on_click: + then: + - script.execute: + id: button_action + component: bs_button_2 + event: click + on_double_click: + then: + - script.execute: + id: button_action + component: bs_button_2 + event: double_click + on_multi_click: + - timing: *long_click-timing + invalid_cooldown: ${invalid_cooldown} + then: + - script.execute: + id: button_action + component: bs_button_2 + event: long_click + + - id: bs_button_3 + name: Button 3 + icon: mdi:gesture-tap-box + internal: true + platform: template + on_click: + then: + - script.execute: + id: button_action + component: bs_button_3 + event: click + on_double_click: + then: + - script.execute: + id: button_action + component: bs_button_3 + event: double_click + on_multi_click: + - timing: *long_click-timing + invalid_cooldown: ${invalid_cooldown} + then: + - script.execute: + id: button_action + component: bs_button_3 + event: long_click + + - id: bs_button_4 + name: Button 4 + icon: mdi:gesture-tap-box + internal: true + platform: template + on_click: + then: + - script.execute: + id: button_action + component: bs_button_4 + event: click + on_double_click: + then: + - script.execute: + id: button_action + component: bs_button_4 + event: double_click + on_multi_click: + - timing: *long_click-timing + invalid_cooldown: ${invalid_cooldown} + then: + - script.execute: + id: button_action + component: bs_button_4 + event: long_click + +script: + - id: button_action + mode: parallel + parameters: + component: string + event: string + then: # There's nothing here so far + # Extended by: + # - core_api + + - id: buttons_release + mode: restart + then: + - lambda: |- + if (bs_button_1->state) bs_button_1->publish_state(false); + if (bs_button_2->state) bs_button_2->publish_state(false); + if (bs_button_3->state) bs_button_3->publish_state(false); + if (bs_button_4->state) bs_button_4->publish_state(false); + + - id: !extend touch_on_multi_touch_release + then: + - script.execute: buttons_release + + - id: !extend touch_on_press + then: + - script.execute: + id: touch_on_press_buttons + touch_x: !lambda return touch_x; + + - id: touch_on_press_buttons + mode: restart + parameters: + touch_x: uint8_t + then: + - lambda: |- + auto model_index = sl_tx_model_gang->active_index(); + if (model_index.has_value()) { + uint8_t model_idx = model_index.value() + 1; + switch (model_idx) { + case 1: // 1 Gang + bs_button_1->publish_state(true); + break; + case 2: // 2 Gang + if (touch_x <= 5) bs_button_1->publish_state(true); + else bs_button_2->publish_state(true); + break; + case 3: // 3 Gang + if (touch_x <= 3) bs_button_1->publish_state(true); + else if (touch_x <= 7) bs_button_2->publish_state(true); + else bs_button_3->publish_state(true); + break; + case 4: // 4 Gang + if (touch_x <= 2) bs_button_1->publish_state(true); + else if (touch_x <= 5) bs_button_2->publish_state(true); + else if (touch_x <= 8) bs_button_3->publish_state(true); + else bs_button_4->publish_state(true); + break; + } + } + + - id: !extend touch_on_release + then: + - script.execute: buttons_release + + - id: !extend touch_swipe_left + then: + - script.execute: buttons_release + + - id: !extend touch_swipe_right + then: + - script.execute: buttons_release + +select: + - id: sl_button_1_action + name: Button 1 action + platform: template + options: + - "None" + - "Relay 1 (toggle)" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dip-switch + + - id: sl_button_2_action + name: Button 2 action + platform: template + options: + - "None" + - "Relay 2 (toggle)" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dip-switch + + - id: sl_button_3_action + name: Button 3 action + platform: template + options: + - "None" + - "Relay 3 (toggle)" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dip-switch + + - id: sl_button_4_action + name: Button 4 action + platform: template + options: + - "None" + - "Relay 4 (toggle)" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dip-switch + +... diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_led.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_led.yaml new file mode 100644 index 0000000..2f45d71 --- /dev/null +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_led.yaml @@ -0,0 +1,1012 @@ +#################################################################################################### +##### TX Ultimate Easy for ESPHome ##### +##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy ##### +#################################################################################################### +##### Purpose: ESPHome Core - Hardware - LED ##### +#################################################################################################### +##### Author: edwardtfn - https://github.com/edwardtfn - https://buymeacoffee.com/edwardfirmo ##### +#################################################################################################### +##### NOTE: ##### +##### - Make changes ONLY if absolutely necessary and you have the required knowledge. ##### +##### - For normal system use, modifications to this file are NOT required. ##### +#################################################################################################### +--- +substitutions: + default_transition_length: 500ms + +globals: + - id: gb_lights_1 + type: std::vector + restore_value: false + - id: gb_lights_2 + type: std::vector + restore_value: false + +light: + - id: ligth_output_1 + name: Light output 1 + internal: true + platform: binary + output: output_relay_1 + - id: ligth_output_2 + name: Light output 2 + internal: true + platform: binary + output: output_relay_2 + - id: ligth_output_3 + name: Light output 3 + internal: true + platform: binary + output: output_relay_3 + - id: ligth_output_4 + name: Light output 4 + internal: true + platform: binary + output: output_relay_4 + + - id: light_full + name: Light - All + internal: true + platform: neopixelbus + type: GRB + variant: WS2811 + # method: esp32_rmt + num_leds: 32 + pin: GPIO13 + + - id: light_eu + name: Light + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 0 + to: 27 + effects: &light_effects_full + - addressable_rainbow: + - addressable_rainbow: + name: "Rainbow - Fast" + speed: 50 + - pulse: + - pulse: + name: "Pulse - Fast" + transition_length: 0.5s + update_interval: 0.5s + - pulse: + name: "Pulse - Slow" + update_interval: 2s + - addressable_scan: + - addressable_scan: + name: Scan Effect With Custom Values + move_interval: 100ms + scan_width: 3 + - addressable_twinkle: + - addressable_twinkle: + name: Twinkle Effect With Custom Values + twinkle_probability: 5% + progress_interval: 4ms + - addressable_random_twinkle: + - addressable_random_twinkle: + name: Random Twinkle Effect With Custom Values + twinkle_probability: 20% + progress_interval: 32ms + - addressable_fireworks: + - addressable_fireworks: + name: Fireworks Effect With Custom Values + update_interval: 32ms + spark_probability: 10% + use_random_color: false + fade_out_rate: 120 + - addressable_flicker: + - addressable_flicker: + name: Flicker Effect With Custom Values + update_interval: 16ms + intensity: 5% + - random: + - id: light_us + name: Light + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 0 + to: 31 + effects: *light_effects_full + + - id: light_eu_bottom + name: Light - Bottom + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 6 + to: 12 + reversed: true + effects: *light_effects_full + - id: light_eu_left + name: Light - Left + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 13 + to: 19 + reversed: true + effects: *light_effects_full + - id: light_eu_right + name: Light - Right + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 27 + to: 27 + reversed: false + - id: light_full + from: 0 + to: 5 + reversed: false + effects: *light_effects_full + - id: light_eu_top + name: Light - Top + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 20 + to: 26 + reversed: false + effects: *light_effects_full + - id: light_us_bottom + name: Light - Bottom + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 9 + to: 14 + reversed: true + effects: *light_effects_full + - id: light_us_left + name: Light - Left + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 15 + to: 24 + reversed: true + effects: *light_effects_full + - id: light_us_right + name: Light - Right + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 31 + to: 31 + reversed: false + - id: light_full + from: 0 + to: 8 + reversed: false + effects: *light_effects_full + - id: light_us_top + name: Light - Top + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 25 + to: 30 + reversed: false + effects: *light_effects_full + + - id: light_00 + name: Light - LED 00 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 0 + to: 0 + - id: light_01 + name: Light - LED 01 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 1 + to: 1 + - id: light_02 + name: Light - LED 02 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 2 + to: 2 + - id: light_03 + name: Light - LED 03 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 3 + to: 3 + - id: light_04 + name: Light - LED 04 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 4 + to: 4 + - id: light_05 + name: Light - LED 05 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 5 + to: 5 + - id: light_06 + name: Light - LED 06 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 6 + to: 6 + - id: light_07 + name: Light - LED 07 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 7 + to: 7 + - id: light_08 + name: Light - LED 08 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 8 + to: 8 + - id: light_09 + name: Light - LED 09 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 9 + to: 9 + - id: light_10 + name: Light - LED 10 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 10 + to: 10 + - id: light_11 + name: Light - LED 11 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 11 + to: 11 + - id: light_12 + name: Light - LED 12 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 12 + to: 12 + - id: light_13 + name: Light - LED 13 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 13 + to: 13 + - id: light_14 + name: Light - LED 14 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 14 + to: 14 + - id: light_15 + name: Light - LED 15 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 15 + to: 15 + - id: light_16 + name: Light - LED 16 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 16 + to: 16 + - id: light_17 + name: Light - LED 17 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 17 + to: 17 + - id: light_18 + name: Light - LED 18 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 18 + to: 18 + - id: light_19 + name: Light - LED 19 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 19 + to: 19 + - id: light_20 + name: Light - LED 20 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 20 + to: 20 + - id: light_21 + name: Light - LED 21 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 21 + to: 21 + - id: light_22 + name: Light - LED 22 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 22 + to: 22 + - id: light_23 + name: Light - LED 23 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 23 + to: 23 + - id: light_24 + name: Light - LED 24 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 24 + to: 24 + - id: light_25 + name: Light - LED 25 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 25 + to: 25 + - id: light_26 + name: Light - LED 26 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 26 + to: 26 + - id: light_27 + name: Light - LED 27 + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 27 + to: 27 + - id: light_28 + name: Light - LED 28 + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 28 + to: 28 + - id: light_29 + name: Light - LED 29 + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 29 + to: 29 + - id: light_30 + name: Light - LED 30 + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 30 + to: 30 + - id: light_31 + name: Light - LED 31 + internal: true + disabled_by_default: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 31 + to: 31 + + - id: light_eu_rl_1_1_bottom + name: Light - Relay 1 of 1 (bottom) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 9 + to: 9 + - id: light_eu_rl_1_1_top + name: Light - Relay 1 of 1 (top) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 23 + to: 23 + - id: light_eu_rl_1_2_bottom + name: Light - Relay 1 of 2 (bottom) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 11 + to: 11 + - id: light_eu_rl_1_2_top + name: Light - Relay 1 of 2 (top) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 21 + to: 21 + - id: light_eu_rl_2_2_bottom + name: Light - Relay 2 of 2 (bottom) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 7 + to: 7 + - id: light_eu_rl_2_2_top + name: Light - Relay 2 of 2 (top) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 25 + to: 25 + - id: light_eu_rl_1_3_bottom + name: Light - Relay 1 of 3 (bottom) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 12 + to: 12 + - id: light_eu_rl_1_3_top + name: Light - Relay 1 of 3 (top) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 20 + to: 20 + - id: light_eu_rl_2_3_bottom + name: Light - Relay 2 of 3 (bottom) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 9 + to: 9 + - id: light_eu_rl_2_3_top + name: Light - Relay 2 of 3 (top) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 23 + to: 23 + - id: light_eu_rl_3_3_bottom + name: Light - Relay 3 of 3 (bottom) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 6 + to: 6 + - id: light_eu_rl_3_3_top + name: Light - Relay 3 of 3 (top) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 26 + to: 26 + - id: light_eu_rl_1_4_bottom + name: Light - Relay 1 of 4 (bottom) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 12 + to: 12 + - id: light_eu_rl_1_4_top + name: Light - Relay 1 of 4 (top) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 20 + to: 20 + - id: light_eu_rl_2_4_bottom + name: Light - Relay 2 of 4 (bottom) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 10 + to: 10 + - id: light_eu_rl_2_4_top + name: Light - Relay 2 of 4 (top) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 22 + to: 22 + - id: light_eu_rl_3_4_bottom + name: Light - Relay 3 of 4 (bottom) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 8 + to: 8 + - id: light_eu_rl_3_4_top + name: Light - Relay 3 of 4 (top) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 24 + to: 24 + - id: light_eu_rl_4_4_bottom + name: Light - Relay 4 of 4 (bottom) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 6 + to: 6 + - id: light_eu_rl_4_4_top + name: Light - Relay 4 of 4 (top) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 26 + to: 26 + - id: light_us_rl_1_1_left + name: Light - Relay 1 of 1 (left) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 15 + to: 24 + - id: light_us_rl_1_1_right + name: Light - Relay 1 of 1 (right) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 31 + to: 31 + - id: light_full + from: 0 + to: 8 + - id: light_us_rl_1_2_left + name: Light - Relay 1 of 2 (left) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 20 + to: 24 + - id: light_us_rl_1_2_right + name: Light - Relay 1 of 2 (right) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 31 + to: 31 + - id: light_full + from: 0 + to: 3 + - id: light_us_rl_2_2_left + name: Light - Relay 2 of 2 (left) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 15 + to: 19 + - id: light_us_rl_2_2_right + name: Light - Relay 2 of 2 (right) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 4 + to: 8 + - id: light_us_rl_1_3_left + name: Light - Relay 1 of 3 (left) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 22 + to: 23 + - id: light_us_rl_1_3_right + name: Light - Relay 1 of 3 (right) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 0 + to: 1 + - id: light_us_rl_2_3_left + name: Light - Relay 2 of 3 (left) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 19 + to: 20 + - id: light_us_rl_2_3_right + name: Light - Relay 2 of 3 (right) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 3 + to: 4 + - id: light_us_rl_3_3_left + name: Light - Relay 3 of 3 (left) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 17 + to: 18 + - id: light_us_rl_3_3_right + name: Light - Relay 3 of 3 (right) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 6 + to: 7 + - id: light_us_rl_1_4_left + name: Light - Relay 1 of 4 (left) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 12 + to: 12 + - id: light_us_rl_1_4_right + name: Light - Relay 1 of 4 (right) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 31 + to: 31 + - id: light_us_rl_2_4_left + name: Light - Relay 2 of 4 (left) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 24 + to: 24 + - id: light_us_rl_2_4_right + name: Light - Relay 2 of 4 (right) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 2 + to: 2 + - id: light_us_rl_3_4_left + name: Light - Relay 3 of 4 (left) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 21 + to: 21 + - id: light_us_rl_3_4_right + name: Light - Relay 3 of 4 (right) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 4 + to: 4 + - id: light_us_rl_4_4_left + name: Light - Relay 4 of 4 (left) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 19 + to: 19 + - id: light_us_rl_4_4_right + name: Light - Relay 4 of 4 (right) + internal: true + platform: partition + default_transition_length: ${default_transition_length} + segments: + - id: light_full + from: 7 + to: 7 + +select: + - id: sl_relay_1_light_mode_eu + name: Relay 1 light mode + platform: template + options: + - "Disabled" + - "Bottom" + - "Top" + - "Both" + initial_option: "Bottom" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dots-square + + - id: sl_relay_2_light_mode_eu + name: Relay 2 light mode + platform: template + options: + - "Disabled" + - "Bottom" + - "Top" + - "Both" + initial_option: "Bottom" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dots-square + + - id: sl_relay_3_light_mode_eu + name: Relay 3 light mode + platform: template + options: + - "Disabled" + - "Bottom" + - "Top" + - "Both" + initial_option: "Bottom" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dots-square + + - id: sl_relay_4_light_mode_eu + name: Relay 4 light mode + platform: template + options: + - "Disabled" + - "Bottom" + - "Top" + - "Both" + initial_option: "Bottom" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dots-square + + - id: sl_relay_1_light_mode_us + name: Relay 1 light mode + platform: template + options: + - "Disabled" + - "Left" + - "Right" + - "Both" + initial_option: "Right" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dots-square + + - id: sl_relay_2_light_mode_us + name: Relay 2 light mode + platform: template + options: + - "Disabled" + - "Left" + - "Right" + - "Both" + initial_option: "Right" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dots-square + + - id: sl_relay_3_light_mode_us + name: Relay 3 light mode + platform: template + options: + - "Disabled" + - "Left" + - "Right" + - "Both" + initial_option: "Right" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dots-square + + - id: sl_relay_4_light_mode_us + name: Relay 4 light mode + platform: template + options: + - "Disabled" + - "Left" + - "Right" + - "Both" + initial_option: "Right" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dots-square + +... diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml new file mode 100644 index 0000000..04008e9 --- /dev/null +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml @@ -0,0 +1,226 @@ +#################################################################################################### +##### TX Ultimate Easy for ESPHome ##### +##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy ##### +#################################################################################################### +##### Purpose: ESPHome Core - Hardware - Relays ##### +#################################################################################################### +##### Author: edwardtfn - https://github.com/edwardtfn - https://buymeacoffee.com/edwardfirmo ##### +#################################################################################################### +##### NOTE: ##### +##### - Make changes ONLY if absolutely necessary and you have the required knowledge. ##### +##### - For normal system use, modifications to this file are NOT required. ##### +#################################################################################################### +--- +binary_sensor: + - id: !extend bs_button_1 + on_click: + then: + - lambda: |- + if (sl_button_1_action->active_index().has_value() and + sl_button_1_action->active_index().value() == 1 and + !bs_multi_touch->state and + !bs_swipe_left->state and + !bs_swipe_down->state and + !bs_swipe_right->state) + sw_relay_1->toggle(); + + - id: !extend bs_button_2 + on_click: + then: + - lambda: |- + if (sl_button_2_action->active_index().has_value() and + sl_button_2_action->active_index().value() == 1 and + !bs_multi_touch->state and + !bs_swipe_left->state and + !bs_swipe_down->state and + !bs_swipe_right->state) + sw_relay_2->toggle(); + + - id: !extend bs_button_3 + on_click: + then: + - lambda: |- + if (sl_button_3_action->active_index().has_value() and + sl_button_3_action->active_index().value() == 1 and + !bs_multi_touch->state and + !bs_swipe_left->state and + !bs_swipe_down->state and + !bs_swipe_right->state) + sw_relay_3->toggle(); + + - id: !extend bs_button_4 + on_click: + then: + - lambda: |- + if (sl_button_4_action->active_index().has_value() and + sl_button_4_action->active_index().value() == 1 and + !bs_multi_touch->state and + !bs_swipe_left->state and + !bs_swipe_down->state and + !bs_swipe_right->state) + sw_relay_4->toggle(); + +output: + - id: output_relay_1 + platform: gpio + pin: GPIO18 + + - id: output_relay_2 + platform: gpio + pin: GPIO17 + + - id: output_relay_3 + platform: gpio + pin: GPIO27 + + - id: output_relay_4 + platform: gpio + pin: GPIO23 + +script: + - id: show_relay_status + mode: restart + then: + - lambda: |- + return; + show_relay_status->stop(); + auto model_format = sl_tx_model_format->active_index(); + std::vector relay_modes; + + if (model_format.has_value() and model_format.value() == 0) { + relay_modes = {sl_relay_1_light_mode_eu, sl_relay_2_light_mode_eu, sl_relay_3_light_mode_eu, sl_relay_4_light_mode_eu}; + } else { + relay_modes = {sl_relay_1_light_mode_us, sl_relay_2_light_mode_us, sl_relay_3_light_mode_us, sl_relay_4_light_mode_us}; + } + + std::vector switches = {sw_relay_1, sw_relay_2, sw_relay_3, sw_relay_4}; + for (int i = 0; i < relay_modes.size(); ++i) { + auto light_index = relay_modes[i]->active_index(); + if (light_index.has_value()) { + uint8_t light_idx = light_index.value(); + bool switch_state = switches[i]->state; + if (light_idx == 1 || light_idx == 3) { + if (switch_state) + id(gb_lights_1)[i]->turn_on().perform(); + else + id(gb_lights_1)[i]->turn_off().perform(); + } + if (light_idx == 2 || light_idx == 3) { + if (switch_state) + id(gb_lights_2)[i]->turn_on().perform(); + else + id(gb_lights_2)[i]->turn_off().perform(); + } + } + } + +select: + - id: sl_relay_1_mode + name: Relay 1 mode + platform: template + options: + - "Relay" + - "Light" + - "Not in use" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dip-switch + + - id: sl_relay_2_mode + name: Relay 2 mode + platform: template + options: + - "Relay" + - "Light" + - "Not in use" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dip-switch + + - id: sl_relay_3_mode + name: Relay 3 mode + platform: template + options: + - "Relay" + - "Light" + - "Not in use" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dip-switch + + - id: sl_relay_4_mode + name: Relay 4 mode + platform: template + options: + - "Relay" + - "Light" + - "Not in use" + optimistic: true + restore_value: true + internal: true + entity_category: config + disabled_by_default: false + icon: mdi:dip-switch + +switch: + - id: sw_relay_1 + name: Relay 1 + platform: output + output: output_relay_1 + restore_mode: RESTORE_DEFAULT_OFF + internal: true + on_turn_on: + then: + - script.execute: show_relay_status + on_turn_off: + then: + - script.execute: show_relay_status + + - id: sw_relay_2 + name: Relay 2 + platform: output + output: output_relay_2 + restore_mode: RESTORE_DEFAULT_OFF + internal: true + on_turn_on: + then: + - script.execute: show_relay_status + on_turn_off: + then: + - script.execute: show_relay_status + + - id: sw_relay_3 + name: Relay 3 + platform: output + output: output_relay_3 + restore_mode: RESTORE_DEFAULT_OFF + internal: true + on_turn_on: + then: + - script.execute: show_relay_status + on_turn_off: + then: + - script.execute: show_relay_status + + - id: sw_relay_4 + name: Relay 4 + platform: output + output: output_relay_4 + restore_mode: RESTORE_DEFAULT_OFF + internal: true + on_turn_on: + then: + - script.execute: show_relay_status + on_turn_off: + then: + - script.execute: show_relay_status +... diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml new file mode 100644 index 0000000..11178ec --- /dev/null +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_speaker.yaml @@ -0,0 +1,29 @@ +#################################################################################################### +##### TX Ultimate Easy for ESPHome ##### +##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy ##### +#################################################################################################### +##### Purpose: ESPHome Core - Hardware - Speaker ##### +#################################################################################################### +##### Author: edwardtfn - https://github.com/edwardtfn - https://buymeacoffee.com/edwardfirmo ##### +#################################################################################################### +##### NOTE: ##### +##### - Make changes ONLY if absolutely necessary and you have the required knowledge. ##### +##### - For normal system use, modifications to this file are NOT required. ##### +#################################################################################################### +--- +i2s_audio: + id: if_i2s_audio + i2s_bclk_pin: GPIO2 + i2s_lrclk_pin: GPIO4 + +media_player: + - id: mp_speaker + name: Speaker + platform: i2s_audio + i2s_dout_pin: GPIO15 + i2s_audio_id: if_i2s_audio + i2s_comm_fmt: lsb + dac_type: external + mode: mono + internal: false +... diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml new file mode 100644 index 0000000..e9de90b --- /dev/null +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_touch.yaml @@ -0,0 +1,212 @@ +#################################################################################################### +##### TX Ultimate Easy for ESPHome ##### +##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy ##### +#################################################################################################### +##### Purpose: ESPHome Core - Hardware - Touch panel ##### +#################################################################################################### +##### Author: edwardtfn - https://github.com/edwardtfn - https://buymeacoffee.com/edwardfirmo ##### +#################################################################################################### +##### NOTE: ##### +##### - Make changes ONLY if absolutely necessary and you have the required knowledge. ##### +##### - For normal system use, modifications to this file are NOT required. ##### +#################################################################################################### +--- +binary_sensor: + - id: bs_multi_touch + name: Multi-touch + icon: mdi:gesture-two-tap + internal: false + platform: template + on_click: + then: + - lambda: send_event_to_ha->execute("multi_touch", "multi_touch"); + + - id: bs_swipe_left + name: Swipe left + icon: mdi:gesture-swipe-left + internal: true + platform: template + on_click: + then: + - lambda: send_event_to_ha->execute("swipe", "left"); + + - id: bs_swipe_right + name: Swipe right + icon: mdi:gesture-swipe-right + internal: true + platform: template + on_click: + then: + - lambda: send_event_to_ha->execute("swipe", "right"); + + - id: bs_swipe_up + name: Swipe up + icon: mdi:gesture-swipe-up + internal: true + platform: template + on_click: + then: + - lambda: send_event_to_ha->execute("swipe", "up"); + + - id: bs_swipe_down + name: Swipe down + icon: mdi:gesture-swipe-down + internal: true + platform: template + on_click: + then: + - lambda: send_event_to_ha->execute("swipe", "down"); + +external_components: + - source: github://edwardtfn/TX-Ultimate-Easy@dev # Change this before releasing + components: + - tx_ultimate_easy + +number: + - id: nr_touch_duration + name: Touch duration + icon: mdi:timer-cog-outline + unit_of_measurement: ms + # mode: box + internal: false + entity_category: config + platform: template + min_value: 10 + max_value: 1500 + step: 1 + initial_value: 250 + optimistic: true + restore_value: true + +script: + - id: touch_on_multi_touch_release + mode: restart + then: + # Extended by: + # - HW Buttons + # - HW Vibration + - script.execute: touch_on_multi_touch_release_touch + + - id: touch_on_multi_touch_release_touch + mode: restart + then: + - lambda: bs_multi_touch->publish_state(true); + - delay: !lambda return nr_touch_duration->state; + - lambda: bs_multi_touch->publish_state(false); + + - id: touch_on_press + mode: restart + parameters: + touch_x: uint8_t + then: + # Extended by: + # - HW Buttons + # - HW Vibration + + - id: touch_on_release + mode: restart + then: + # Extended by: + # - HW Buttons + # - HW Vibration + - script.execute: touch_swipe_turn_off_binary_sensor + + - id: touch_swipe_left + mode: restart + then: + # Extended by: + # - HW Buttons + - script.execute: touch_swipe_left_touch + + - id: touch_swipe_left_touch + mode: restart + then: + - binary_sensor.template.publish: + id: bs_swipe_left + state: ON + - delay: !lambda return nr_touch_duration->state; + - script.execute: touch_swipe_turn_off_binary_sensor + + - id: touch_swipe_right + mode: restart + then: + # Extended by: + # - HW Buttons + - script.execute: touch_swipe_right_touch + + - id: touch_swipe_right_touch + mode: restart + then: + - binary_sensor.template.publish: + id: bs_swipe_right + state: ON + - delay: !lambda return nr_touch_duration->state; + - script.execute: touch_swipe_turn_off_binary_sensor + + - id: touch_swipe_turn_off_binary_sensor + mode: restart + then: + - if: + condition: + binary_sensor.is_on: bs_swipe_left + then: + - binary_sensor.template.publish: + id: bs_swipe_left + state: OFF + - if: + condition: + binary_sensor.is_on: bs_swipe_right + then: + - binary_sensor.template.publish: + id: bs_swipe_right + state: OFF + +switch: + - id: sw_touch_panel_power + name: Touch panel - Power + platform: gpio + pin: + number: GPIO5 + inverted: true + restore_mode: ALWAYS_ON + internal: false + entity_category: config + +tx_ultimate_easy: + id: tx_ultimate + uart: uart_touch + + on_multi_touch_release: + - lambda: ESP_LOGI("tx_ultimate_easy", "Multi-touch released"); + - script.execute: touch_on_multi_touch_release + + on_press: + - lambda: ESP_LOGI("tx_ultimate_easy", "Pressed"); + - script.execute: + id: touch_on_multi_touch_press + touch_x: !lambda return static_cast(touch.x); + + on_release: + - lambda: ESP_LOGI("tx_ultimate_easy", "Released"); + - script.execute: touch_on_release + + on_swipe_left: + - lambda: ESP_LOGI("tx_ultimate_easy", "Swipe left"); + - script.execute: touch_swipe_left + + on_swipe_right: + - lambda: ESP_LOGI("tx_ultimate_easy", "Swipe right"); + - script.execute: touch_swipe_right + + on_touch_event: + - lambda: |- + ESP_LOGD("tx_ultimate_easy", "Touch event:"); + ESP_LOGD("tx_ultimate_easy", " State: %i (%s)", touch.state, touch.state_str.c_str()); + ESP_LOGD("tx_ultimate_easy", " Position: %i", touch.x); + +uart: + id: uart_touch + tx_pin: GPIO19 + rx_pin: GPIO22 + baud_rate: 115200 +... diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml new file mode 100644 index 0000000..366d77f --- /dev/null +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_vibration.yaml @@ -0,0 +1,120 @@ +#################################################################################################### +##### TX Ultimate Easy for ESPHome ##### +##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy ##### +#################################################################################################### +##### Purpose: ESPHome Core - Hardware - Vibration system ##### +#################################################################################################### +##### Author: edwardtfn - https://github.com/edwardtfn - https://buymeacoffee.com/edwardfirmo ##### +#################################################################################################### +##### NOTE: ##### +##### - Make changes ONLY if absolutely necessary and you have the required knowledge. ##### +##### - For normal system use, modifications to this file are NOT required. ##### +#################################################################################################### +--- +binary_sensor: + - id: bs_vibrating + name: Vibrating + icon: mdi:vibrate + internal: false + platform: template + lambda: return sw_vibration_motor->state; + +button: + - id: bt_vibrate + name: Vibrate + icon: mdi:vibrate + internal: false + platform: template + on_press: + then: + - script.execute: vibrate + +number: + - id: nr_vibrating_duration + name: Vibrate duration + icon: mdi:vibrate + unit_of_measurement: ms + # mode: box + internal: false + entity_category: config + platform: template + min_value: 1 + max_value: 500 + step: 1 + initial_value: 15 + optimistic: true + restore_value: true + +script: + - id: !extend touch_on_multi_touch_release + then: + - script.execute: touch_on_multi_touch_release_vibration + + - id: touch_on_multi_touch_release_vibration + mode: restart + then: + - lambda: |- + if (sl_touch_vibration_feedback->state != "Disabled") + vibrate->execute(); + + - id: !extend touch_on_press + then: + - script.execute: touch_on_press_vibration + + - id: touch_on_press_vibration + mode: restart + then: + - lambda: |- + if (sl_touch_vibration_feedback->state == "On press" or sl_touch_vibration_feedback->state == "Always") + vibrate->execute(); + + - id: !extend touch_on_release + then: + - script.execute: touch_on_release_vibration + + - id: touch_on_release_vibration + mode: restart + then: + - lambda: |- + if (sl_touch_vibration_feedback->state == "On release" or sl_touch_vibration_feedback->state == "Always") + vibrate->execute(); + + - id: vibrate + mode: restart + then: + - switch.turn_on: sw_vibration_motor + - delay: !lambda return nr_vibrating_duration->state; + - switch.turn_off: sw_vibration_motor + +select: + - id: sl_touch_vibration_feedback + name: Touch - Vibration feedback + platform: template + options: + - "Disabled" + - "On press" + - "On release" + - "Always" + initial_option: "Disabled" + optimistic: true + restore_value: true + internal: false + entity_category: config + disabled_by_default: false + icon: mdi:vibrate + +switch: + - id: sw_vibration_motor + name: Vibration motor + platform: gpio + pin: GPIO21 + restore_mode: ALWAYS_OFF + internal: true + on_turn_on: + then: + - lambda: bs_vibrating->publish_state(true); + on_turn_off: + then: + - lambda: bs_vibrating->publish_state(false); + +... diff --git a/TX-Ultimate-Easy-ESPHome.yaml b/TX-Ultimate-Easy-ESPHome.yaml index f171b9a..3b95ea8 100644 --- a/TX-Ultimate-Easy-ESPHome.yaml +++ b/TX-Ultimate-Easy-ESPHome.yaml @@ -1,3 +1,9 @@ +#################################################################################################### +##### TX Ultimate Easy for ESPHome ##### +##### Repository: https://github.com/edwardtfn/TX-Ultimate-Easy ##### +#################################################################################################### +##### Author: edwardtfn - https://github.com/edwardtfn - https://buymeacoffee.com/edwardfirmo ##### +#################################################################################################### --- substitutions: name: tx-ultimate-easy