-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from fikin/dev
Adding bootstrap support. Fixing some readmes.
- Loading branch information
Showing
9 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Bootstrap | ||
|
||
To be called at boot time to execute one-time configuration actions. | ||
|
||
Typically used in sw upgrade use cases. | ||
|
||
In case there is a need to one-off configuration during next reboot, | ||
place commands in a file called `bootstrap-sw.lua` and reboot the device. | ||
|
||
It such file and if it exists: | ||
|
||
- runs it | ||
- captures all errors into `bootstrap-sw.PANIC.txt` | ||
- removes it regardless of execution status, so next reboot does not take place |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--[[ | ||
This file is template, modify it with one-time configuration steps | ||
to be executed after reboot. | ||
Following settings are relevant for initial flashing of the device, | ||
consequent sw upgrades should have its own changes if needed be. | ||
]] | ||
|
||
local fs = require("factory-settings") | ||
|
||
--fs("wifi-sta"):set("config.ssid","<SSID>"):set("config.pwd","<PWD>"):set("hostname","<HOSTNAME>"):done() | ||
|
||
-- minimal set of modules on | ||
-- fs("init-seq"):set("bootsequence",{ "bootstrap", "user-settings", "log-start", "wifi-apply-config", "wifi-mgr", "http-srv", "telnet" }):done() | ||
|
||
-- likely same credentials for admin services | ||
-- fs("telnet"):set("usr", "<ADMIN>"):set("pwd", "<APWD>"):done() | ||
-- fs("web-portal"):set("usr", "<ADMIN>"):set("pwd", "<APWD>"):done() | ||
-- fs("web-ota"):set("usr", "<ADMIN>"):set("pwd", "<APWD>"):done() | ||
|
||
-- minimal HomeAssistant modules and credentials | ||
--fs("web-ha"):set("entities", { "system-hass" }):set("credentials.usr", "<HAUSER>"):set("credentials.pwd", "<HAPWD>"):done() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
local file, log = require("file"), require("log") | ||
|
||
local fName = "bootstrap-sw.lua" | ||
local fNameErr = "bootstrap-sw.PANIC.txt" | ||
|
||
local function main() | ||
if file.exists(fName) then | ||
log.info("running %s", fName) | ||
|
||
local ok, err = pcall(require, "bootstrap-sw") | ||
|
||
file.remove(fName) | ||
|
||
if not ok then | ||
log.error("bootstrap failed : %s : %s", fName, err) | ||
file.remove(fNameErr) | ||
file.putcontents(fNameErr, err) | ||
end | ||
|
||
collectgarbage() | ||
collectgarbage() | ||
end | ||
end | ||
|
||
return main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"bootsequence": [ | ||
"bootstrap", | ||
"user-settings", | ||
"log-start", | ||
"wifi-apply-config", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# SCT014 Current sensor | ||
|
||
Expose `SCT013` connected via `ADS1115` as Home Assistant `current` sensor. | ||
|
||
## Setup | ||
|
||
TODO | ||
|
||
## References | ||
|
||
[Using the ADS1115](https://www.best-microcontroller-projects.com/ads1115.html) | ||
|
||
[ADS1115 analog-to-digital converter and ESP8266](http://www.esp8266learning.com/ads1115-analog-to-digital-converter-and-esp8266.php) | ||
|
||
[SCT013-000 CT USED WITH ARDUINO](https://www.poweruc.pl/blogs/news/non-invasive-sensor-yhdc-sct013-000-ct-used-with-arduino-sct-013) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters