working serial stream
This commit is contained in:
parent
ad7c3bb80c
commit
848f1a3c54
21
.reuse/dep5
21
.reuse/dep5
|
@ -1,21 +0,0 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: mushlab-iot
|
||||
Upstream-Contact: Sebastian Wendel <mushlab@curious.bio>
|
||||
Source: https://code.curious.bio/curious.bio/mushlab-iot
|
||||
|
||||
Files: hardware/*
|
||||
Copyright: (C) 2023 Sebastian Wendel
|
||||
License: CERN-OHL-S-2.0
|
||||
|
||||
Files:
|
||||
.gitea
|
||||
.vscode
|
||||
.editorconfig
|
||||
.envrc
|
||||
.gitignore
|
||||
flake.*
|
||||
nix/*
|
||||
software/*
|
||||
Copyright: (C) 2023 Sebastian Wendel
|
||||
License: GPL-3.0-or-later
|
||||
|
|
@ -5,3 +5,4 @@
|
|||
- https://github.com/jeelabs/esp-link
|
||||
- https://github.com/esphome/aioesphomeapi
|
||||
- https://openwrt.org/docs/guide-user/hardware/esp8266-serial-bridge
|
||||
- https://github.com/tube0013/tube_gateways/tree/main
|
16
REUSE.toml
Normal file
16
REUSE.toml
Normal file
|
@ -0,0 +1,16 @@
|
|||
version = 1
|
||||
SPDX-PackageName = "esp-bmc"
|
||||
SPDX-PackageSupplier = "Sebastian Wendel <esp-bmc@srx.digital>"
|
||||
SPDX-PackageDownloadLocation = "https://code.srx.digital/srx/esp-bmc"
|
||||
|
||||
[[annotations]]
|
||||
path = "hardware/**"
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "(C) 2024 Sebastian Wendel"
|
||||
SPDX-License-Identifier = "CERN-OHL-S-2.0"
|
||||
|
||||
[[annotations]]
|
||||
path = [".gitea", ".vscode", ".envrc", ".gitignore", "flake.**", "nix/**", "software/**"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "(C) 2024 Sebastian Wendel"
|
||||
SPDX-License-Identifier = "MIT"
|
56
esphome.yaml
56
esphome.yaml
|
@ -18,6 +18,11 @@ web_server:
|
|||
|
||||
api:
|
||||
password: !secret api_password
|
||||
on_client_connected:
|
||||
- uart.write: "reboot\r\n"
|
||||
- logger.log:
|
||||
format: "Client %s connected to API with IP %s"
|
||||
args: ["client_info.c_str()", "client_address.c_str()"]
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
|
@ -43,22 +48,37 @@ wifi:
|
|||
# gateway: 10.0.0.1
|
||||
# subnet: 255.255.255.0
|
||||
|
||||
external_components:
|
||||
- source: github://oxan/esphome-stream-server
|
||||
|
||||
stream_server:
|
||||
uart_id: node0_uart
|
||||
port: 8000
|
||||
|
||||
uart:
|
||||
- id: uart_1
|
||||
tx_pin: 1
|
||||
rx_pin: 2
|
||||
baud_rate: 115200
|
||||
debug:
|
||||
direction: BOTH
|
||||
after:
|
||||
delimiter: "\n"
|
||||
# dummy_receiver: false
|
||||
# sequence:
|
||||
# - lambda: UARTDebug::log_string(direction, bytes);
|
||||
- id: node0_uart
|
||||
rx_pin: GPIO16
|
||||
tx_pin: GPIO17
|
||||
baud_rate: 57600
|
||||
# debug:
|
||||
# direction: BOTH
|
||||
# after:
|
||||
# delimiter: "\n"
|
||||
# sequence:
|
||||
# - lambda: UARTDebug::log_string(direction, bytes);
|
||||
|
||||
button:
|
||||
- name: node0_reboot
|
||||
platform: uart
|
||||
data: "\r\n\r\nreboot -f\r\n"
|
||||
|
||||
- name: node0_shutdown
|
||||
platform: uart
|
||||
data: "\r\n\r\nshutdown -h\r\n"
|
||||
|
||||
select:
|
||||
- id: change_baud_rate
|
||||
name: Baud rate
|
||||
- id: change_baudrate
|
||||
name: node0_baudrate
|
||||
platform: template
|
||||
options:
|
||||
- "2400"
|
||||
|
@ -77,10 +97,10 @@ select:
|
|||
icon: mdi:swap-horizontal
|
||||
set_action:
|
||||
- lambda: |-
|
||||
id(uart_1).flush();
|
||||
id(node0_uart).flush();
|
||||
uint32_t new_baud_rate = stoi(x);
|
||||
ESP_LOGD("change_baud_rate", "Changing baud rate from %i to %i",id(uart_1).get_baud_rate(), new_baud_rate);
|
||||
if (id(uart_1).get_baud_rate() != new_baud_rate) {
|
||||
id(uart_1).set_baud_rate(new_baud_rate);
|
||||
id(uart_1).load_settings();
|
||||
ESP_LOGD("change_baud_rate", "Changing baud rate from %i to %i",id(node0_uart).get_baud_rate(), new_baud_rate);
|
||||
if (id(node0_uart).get_baud_rate() != new_baud_rate) {
|
||||
id(node0_uart).set_baud_rate(new_baud_rate);
|
||||
id(node0_uart).load_settings();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue