Skip to content

Commit

Permalink
Add UART transmitter/receiver example (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
syssi authored Sep 5, 2024
1 parent 6fb7cb6 commit 56abf44
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ jobs:
pip install esphome
pip list
esphome version
- name: Write tests/secrets.yaml
shell: bash
run: 'echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password" > tests/secrets.yaml'
- name: Validate test configurations
run: |
for YAML in tests/esp*.yaml; do
esphome -s external_components_source ../components config $YAML >/dev/null
done
- name: Write secrets.yaml
shell: bash
run: 'echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password" > secrets.yaml'
Expand Down
41 changes: 41 additions & 0 deletions tests/esp32-uart-trx1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
substitutions:
name: uart-trx1
tx_pin: GPIO16
rx_pin: GPIO17

esphome:
name: ${name}
min_version: 2024.6.0

esp32:
board: wemos_d1_mini32
framework:
type: esp-idf

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

ota:
platform: esphome

logger:
level: DEBUG

api:

uart:
- id: uart_0
baud_rate: 9600
tx_pin: ${tx_pin}
rx_pin: ${rx_pin}
debug:
direction: BOTH
dummy_receiver: true

interval:
- interval: 1s
then:
- uart.write:
id: uart_0
data: "Hello from ${name}"
41 changes: 41 additions & 0 deletions tests/esp32-uart-trx2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
substitutions:
name: uart-trx2
tx_pin: GPIO16
rx_pin: GPIO17

esphome:
name: ${name}
min_version: 2024.6.0

esp32:
board: wemos_d1_mini32
framework:
type: esp-idf

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

ota:
platform: esphome

logger:
level: DEBUG

api:

uart:
- id: uart_0
baud_rate: 9600
tx_pin: ${tx_pin}
rx_pin: ${rx_pin}
debug:
direction: BOTH
dummy_receiver: true

interval:
- interval: 1s
then:
- uart.write:
id: uart_0
data: "Hello from ${name}"

0 comments on commit 56abf44

Please sign in to comment.