Skip to content

Commit

Permalink
Merge pull request #26 from edwardtfn/dev
Browse files Browse the repository at this point in the history
Fix toggle with swipe
  • Loading branch information
edwardtfn authored Jul 26, 2024
2 parents 0bf52a2 + 2091fc4 commit f65f3a9
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 64 deletions.
80 changes: 23 additions & 57 deletions .github/workflows/validate_esphome.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Validate and Build ESPHome
name: Validate ESPHome

# yamllint disable-line rule:truthy
on:
Expand Down Expand Up @@ -28,32 +28,9 @@ concurrency:
cancel-in-progress: true

jobs:
setup_dependencies:
name: Setup & Cache Dependencies
runs-on: ubuntu-latest
outputs:
cache-hit-arduino: ${{ steps.cache-arduino.outputs.cache-hit }}

steps:
- name: Checkout repository
uses: actions/checkout@main

- name: Cache Arduino Dependencies
id: cache-arduino
uses: actions/cache@main
with:
path: |
~/.esphome/cache
~/.platformio/packages
~/.platformio/platforms
key: ${{ runner.os }}-arduino-${{ hashFiles('**/esphome_ard_basic.yaml') }}
restore-keys: |
${{ runner.os }}-arduino-
code_scan:
name: Code scan (YAML)
runs-on: "ubuntu-latest"
needs: setup_dependencies
steps:
- name: Checkout Code
uses: actions/checkout@main
Expand All @@ -71,46 +48,35 @@ jobs:

build_basic:
name: Basic
needs: [code_scan, setup_dependencies]
needs:
- code_scan
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- id: ard
yaml_file: ".test/esphome_ard_basic.yaml"
cache-hit: ${{ needs.setup_dependencies.outputs.cache-hit-arduino }}

steps:
- name: Checkout repository
uses: actions/checkout@main

- name: Firmware
if: steps.matrix.outputs.cache-hit != 'true'
uses: esphome/build-action@v2.0.0
- uses: actions/checkout@main
- name: Build core
uses: esphome/build-action@main
with:
yaml_file: ${{ matrix.yaml_file }}
yaml_file: ".test/esphome_ard_basic.yaml"

build_bluetooth_proxy:
name: Bluetooth Proxy
build_bluetooth_proxy_4:
name: Bluetooth Proxy (IDF v4)
needs: build_basic
runs-on: ubuntu-latest
strategy:
matrix:
include:
- id: idf_v4
base: idf_v4
yaml_file: ".test/esphome_idf_bluetooth_proxy.yaml"
- id: idf_v5
base: idf_v5
yaml_file: ".test/esphome_idf5_bluetooth_proxy.yaml"

steps:
- name: Checkout repository
uses: actions/checkout@main
- uses: actions/checkout@main
- name: Build core
uses: esphome/build-action@main
with:
yaml_file: ".test/esphome_idf_bluetooth_proxy.yaml"

- name: Build Bluetooth Proxy Firmware
uses: esphome/build-action@v2.0.0
build_bluetooth_proxy_5:
name: Bluetooth Proxy (IDF v5)
needs: build_basic
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Build core
uses: esphome/build-action@main
with:
yaml_file: ${{ matrix.yaml_file }}
yaml_file: ".test/esphome_idf5_bluetooth_proxy.yaml"
...
4 changes: 2 additions & 2 deletions .github/workflows/validate_esphome_beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:

- name: Firmware
if: steps.matrix.outputs.cache-hit != 'true'
uses: barndawgie/build-action@v1.9.0
uses: esphome/build-action@main
with:
yaml_file: ${{ matrix.yaml_file }}
version: beta
Expand All @@ -93,7 +93,7 @@ jobs:
uses: actions/checkout@main

- name: Build Bluetooth Proxy Firmware
uses: barndawgie/build-action@v1.9.0
uses: esphome/build-action@main
with:
yaml_file: ${{ matrix.yaml_file }}
version: beta
Expand Down
5 changes: 5 additions & 0 deletions .test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Gitignore settings for ESPHome
# This is an example and may include too much for your use-case.
# You can modify this file to suit your needs.
/.esphome/
# /secrets.yaml
30 changes: 25 additions & 5 deletions ESPHome/TX-Ultimate-Easy-ESPHome_core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ substitutions:
default_transition_length: 500ms
invalid_cooldown: 100ms

version: '0.0.2'
version: '0.0.3'

api:
id: api_server
Expand Down Expand Up @@ -41,7 +41,12 @@ binary_sensor:
on_click:
then:
- lambda: |-
if (sl_button_1_action->active_index().has_value() and sl_button_1_action->active_index().value() == 1)
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:
Expand All @@ -62,7 +67,12 @@ binary_sensor:
on_click:
then:
- lambda: |-
if (sl_button_2_action->active_index().has_value() and sl_button_2_action->active_index().value() == 1)
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:
Expand All @@ -82,7 +92,12 @@ binary_sensor:
on_click:
then:
- lambda: |-
if (sl_button_3_action->active_index().has_value() and sl_button_3_action->active_index().value() == 1)
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:
Expand All @@ -102,7 +117,12 @@ binary_sensor:
on_click:
then:
- lambda: |-
if (sl_button_4_action->active_index().has_value() and sl_button_4_action->active_index().value() == 1)
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:
Expand Down

0 comments on commit f65f3a9

Please sign in to comment.