Merge pull request #26 from edwardtfn/dev

Fix toggle with swipe
This commit is contained in:
Edward Firmo
2024-07-26 08:35:46 +02:00
committed by GitHub
4 changed files with 56 additions and 65 deletions

View File

@@ -1,5 +1,5 @@
---
name: Validate and Build ESPHome
name: Validate ESPHome
# yamllint disable-line rule:truthy
on:
@@ -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
@@ -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
- name: Build Bluetooth Proxy Firmware
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_idf_bluetooth_proxy.yaml"
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: ".test/esphome_idf5_bluetooth_proxy.yaml"
...

View File

@@ -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
@@ -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

5
.test/.gitignore vendored Normal file
View File

@@ -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

View File

@@ -9,7 +9,7 @@ substitutions:
default_transition_length: 500ms
invalid_cooldown: 100ms
version: '0.0.2'
version: '0.0.3'
api:
id: api_server
@@ -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:
@@ -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:
@@ -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:
@@ -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: