latest changes
This commit is contained in:
commit
ad7c3bb80c
9
.envrc
Normal file
9
.envrc
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
# https://github.com/direnv/direnv/wiki
|
||||||
|
|
||||||
|
use flake
|
||||||
|
|
||||||
|
watch_file ./nix/shell.nix
|
||||||
|
|
||||||
|
eval "$shellHook"
|
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
.direnv
|
||||||
|
.pre-commit-config.yaml
|
||||||
|
.esphome
|
||||||
|
secrets.yaml
|
21
.reuse/dep5
Normal file
21
.reuse/dep5
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
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
|
||||||
|
|
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# ESP-BMC
|
||||||
|
|
||||||
|
## Links
|
||||||
|
|
||||||
|
- https://github.com/jeelabs/esp-link
|
||||||
|
- https://github.com/esphome/aioesphomeapi
|
||||||
|
- https://openwrt.org/docs/guide-user/hardware/esp8266-serial-bridge
|
86
esphome.yaml
Normal file
86
esphome.yaml
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
esphome:
|
||||||
|
name: esp-bmc
|
||||||
|
|
||||||
|
esp32:
|
||||||
|
board: nodemcu-32s
|
||||||
|
|
||||||
|
time:
|
||||||
|
- platform: sntp
|
||||||
|
timezone: Europe/Berlin
|
||||||
|
|
||||||
|
logger:
|
||||||
|
level: VERBOSE
|
||||||
|
|
||||||
|
web_server:
|
||||||
|
port: 80
|
||||||
|
version: 3
|
||||||
|
local: true
|
||||||
|
|
||||||
|
api:
|
||||||
|
password: !secret api_password
|
||||||
|
|
||||||
|
ota:
|
||||||
|
- platform: esphome
|
||||||
|
password: !secret ota_password
|
||||||
|
|
||||||
|
wifi:
|
||||||
|
ssid: !secret wifi_ssid
|
||||||
|
password: !secret wifi_password
|
||||||
|
ap:
|
||||||
|
ssid: !secret ap_ssid
|
||||||
|
password: !secret ap_password
|
||||||
|
|
||||||
|
# ethernet:
|
||||||
|
# type: W5500
|
||||||
|
# clk_pin: GPIOXX
|
||||||
|
# mosi_pin: GPIOXX
|
||||||
|
# miso_pin: GPIOXX
|
||||||
|
# cs_pin: GPIOXX
|
||||||
|
# interrupt_pin: GPIOXX
|
||||||
|
# reset_pin: GPIOXX
|
||||||
|
# manual_ip:
|
||||||
|
# static_ip: 10.0.0.42
|
||||||
|
# gateway: 10.0.0.1
|
||||||
|
# subnet: 255.255.255.0
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
select:
|
||||||
|
- id: change_baud_rate
|
||||||
|
name: Baud rate
|
||||||
|
platform: template
|
||||||
|
options:
|
||||||
|
- "2400"
|
||||||
|
- "9600"
|
||||||
|
- "38400"
|
||||||
|
- "57600"
|
||||||
|
- "115200"
|
||||||
|
- "256000"
|
||||||
|
- "512000"
|
||||||
|
- "921600"
|
||||||
|
initial_option: "115200"
|
||||||
|
optimistic: true
|
||||||
|
restore_value: True
|
||||||
|
internal: false
|
||||||
|
entity_category: config
|
||||||
|
icon: mdi:swap-horizontal
|
||||||
|
set_action:
|
||||||
|
- lambda: |-
|
||||||
|
id(uart_1).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();
|
||||||
|
}
|
155
flake.lock
Normal file
155
flake.lock
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-compat_2": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1710146030,
|
||||||
|
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"pre-commit-hooks",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1709087332,
|
||||||
|
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1725634671,
|
||||||
|
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1720386169,
|
||||||
|
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-24.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pre-commit-hooks": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat_2",
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1725513492,
|
||||||
|
"narHash": "sha256-tyMUA6NgJSvvQuzB7A1Sf8+0XCHyfSPRx/b00o6K0uo=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"rev": "7570de7b9b504cfe92025dd1be797bf546f66528",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "pre-commit-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"pre-commit-hooks": "pre-commit-hooks"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
35
flake.nix
Normal file
35
flake.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
description = "esp-bmc";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
flake-compat = {
|
||||||
|
url = "github:edolstra/flake-compat";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
pre-commit-hooks = {
|
||||||
|
url = "github:cachix/pre-commit-hooks.nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.flake-utils.follows = "flake-utils";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
nixpkgs,
|
||||||
|
flake-utils,
|
||||||
|
...
|
||||||
|
} @ inputs:
|
||||||
|
flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux"] (system: {
|
||||||
|
devShells.default = import ./nix/shell.nix inputs system;
|
||||||
|
checks = import ./nix/checks.nix inputs system;
|
||||||
|
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
config.allowAliases = true;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
16
nix/checks.nix
Normal file
16
nix/checks.nix
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
pre-commit-hooks,
|
||||||
|
...
|
||||||
|
}: system:
|
||||||
|
with self.pkgs.${system}; {
|
||||||
|
pre-commit-check =
|
||||||
|
pre-commit-hooks.lib.${system}.run
|
||||||
|
{
|
||||||
|
src = lib.cleanSource ../.;
|
||||||
|
hooks = {
|
||||||
|
alejandra.enable = true;
|
||||||
|
};
|
||||||
|
settings = {};
|
||||||
|
};
|
||||||
|
}
|
22
nix/shell.nix
Normal file
22
nix/shell.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{self, ...}: system:
|
||||||
|
with self.pkgs.${system};
|
||||||
|
mkShell {
|
||||||
|
name = "esp-bmc";
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
alejandra
|
||||||
|
esphome
|
||||||
|
git
|
||||||
|
mosquitto
|
||||||
|
nil
|
||||||
|
nixVersions.git
|
||||||
|
pre-commit
|
||||||
|
reuse
|
||||||
|
yaml-language-server
|
||||||
|
yamllint
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
${self.checks.${system}.pre-commit-check.shellHook}
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue