63 Commits

Author SHA1 Message Date
edeca4f86f Update dependency @mui/icons-material to v6.1.8
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2024-11-22 00:18:16 +00:00
0c4f352815 Update dependency @emotion/styled to v11.13.5
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-21 00:47:05 +00:00
e1abc68292 Update dependency @emotion/react to v11.13.5
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-21 00:17:10 +00:00
bb0226577d Can download a copy of storage
Some checks failed
continuous-integration/drone/push Build is failing
2024-11-19 20:40:49 +01:00
9fcd16784a Fix issue with time widget
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-19 19:05:46 +01:00
d6e0eccb00 Make dashboard titles customizable
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-19 19:02:09 +01:00
dc621984fb Replace device id with device name 2024-11-19 18:50:57 +01:00
b2878510d6 Update project dependencies
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-19 18:48:49 +01:00
a059076323 Update dependency @typescript-eslint/parser to v8.15.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-19 00:07:02 +00:00
f594802523 Update Rust crate serde_json to v1.0.133
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-18 00:07:29 +00:00
747d2d819b Update Rust crate libc to v0.2.164
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-17 00:07:19 +00:00
a52868a3fb Update dependency eslint to v9.15.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-16 00:06:36 +00:00
fce38386eb Update dependency @mui/icons-material to v6.1.7
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-14 00:33:35 +00:00
cb88a19352 Update Rust crate clap to v4.5.21
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-14 00:07:10 +00:00
c6c34efebd Update dependency @typescript-eslint/parser to v8.14.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-13 00:06:50 +00:00
eed9637f1e Update dependency vite to v5.4.11
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-12 00:06:59 +00:00
3a64b2b09c Update Rust crate thiserror to v1.0.69
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-11 00:26:36 +00:00
8d2f0cb38a Update dependency @mui/x-date-pickers to v7.22.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-10 00:27:24 +00:00
5b1cf61832 Update dependency @mui/x-charts to v7.22.2
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-09 00:32:48 +00:00
6cd5d5f93a Update Rust crate tokio to v1.41.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-09 00:15:02 +00:00
fc409b2584 Update Rust crate libc to v0.2.162
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-08 00:51:22 +00:00
5a1942cb15 Update Rust crate fs4 to v0.11.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-08 00:15:21 +00:00
4af8904294 Update dependency react-router-dom to v6.28.0
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-07 00:53:32 +00:00
0d1605169d Update Rust crate anyhow to v1.0.93
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-07 00:16:21 +00:00
346ea8db11 Update dependency @typescript-eslint/parser to v8.13.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-06 00:15:07 +00:00
f534a9c61b Update Rust crate fs4 to 0.11.0
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-05 00:52:27 +00:00
2ef056da30 Update Rust crate thiserror to v1.0.68
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-05 00:15:18 +00:00
af16091fab Update Rust crate thiserror to v1.0.67
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-04 00:14:58 +00:00
28f81248bf Update dependency eslint to v9.14.0
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-03 00:25:54 +00:00
cc43f6c78b Update dependency @mui/x-date-pickers to v7.22.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-03 00:14:50 +00:00
060ff08c1e Update dependency @mui/x-charts to v7.22.1
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-02 00:46:08 +00:00
57ce643163 Update Rust crate anyhow to v1.0.92
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-02 00:21:39 +00:00
7a536ac850 Update dependency @typescript-eslint/parser to v8.12.2
All checks were successful
continuous-integration/drone/push Build is passing
2024-11-01 01:06:00 +00:00
685eef5c5b Update Rust crate thiserror to v1.0.66
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-11-01 00:34:46 +00:00
180126d22a Update dependency @mui/icons-material to v6.1.6
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-31 00:35:20 +00:00
e29f01bc62 Update Rust crate serde to v1.0.214
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-29 01:19:38 +00:00
f2abdfe302 Update Rust crate reqwest to v0.12.9
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2024-10-29 00:29:11 +00:00
598286d1cb Update dependency eslint to v9
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-28 00:47:57 +00:00
30f196aa7a Update dependency @mui/x-date-pickers to v7.22.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-28 00:28:15 +00:00
08f1ec6d4d Update dependency @mui/x-charts to v7.22.0
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-27 00:29:50 +00:00
d31a568c00 Update Rust crate tokio to v1.41.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-27 00:09:30 +00:00
1b25c07e50 Update Rust crate asn1 to 0.18
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-26 00:35:18 +00:00
96f1640378 Update dependency vite to v5.4.10
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-26 00:09:57 +00:00
ccb4ae22f8 Update dependency eslint-plugin-react-refresh to v0.4.14
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-25 00:34:13 +00:00
d66e2b9bf7 Update dependency @types/react to v18.3.12
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-25 00:10:07 +00:00
0660066941 Update dependency @mui/icons-material to v6.1.5
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-24 00:56:09 +00:00
7476924e0e Update Rust crate thiserror to v1.0.65
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-24 00:10:25 +00:00
65c3c534f4 Update Rust crate serde to v1.0.213
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-23 01:24:18 +00:00
995e1fa07e Update Rust crate anyhow to v1.0.91
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-23 00:10:16 +00:00
1735077db3 Update dependency @typescript-eslint/parser to v8.11.0
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-22 00:57:31 +00:00
31bb956a29 Update dependency @typescript-eslint/eslint-plugin to v8.11.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-22 00:20:52 +00:00
ff0e548422 Update dependency eslint-plugin-react-refresh to v0.4.13
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2024-10-21 00:20:07 +00:00
837835da7e Update dependency @vitejs/plugin-react to v4.3.3
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-20 01:25:13 +00:00
2d262bb4c9 Update Rust crate serde_json to v1.0.132
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2024-10-20 00:20:54 +00:00
f594ebfbaa Don't block home widget if live consumption is unavailable
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-19 15:49:10 +02:00
57a9c03308 Add more flexibility when fetching production value 2024-10-19 15:39:30 +02:00
7b9db9c7c3 Merge branch 'master' of ssh://gitea.communiquons.org:52001/pierre/SolarEnergy
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-19 13:32:14 +02:00
b7720df305 Assign version to backend
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-19 15:32:38 +02:00
445c1b014e Start to work on new version 2024-10-19 15:23:21 +02:00
aa732af571 Update to version 1.0.1 2024-10-19 14:16:27 +02:00
c365f959e7 Change backend hostname 2024-10-19 13:54:25 +02:00
9a4c6d2de2 Update project dependencies 2024-10-19 13:21:10 +02:00
3c20cca915 Update prod documentation 2024-10-19 11:41:21 +02:00
28 changed files with 1810 additions and 1418 deletions

View File

@@ -492,24 +492,34 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.90" version = "1.0.93"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775"
[[package]]
name = "arbitrary"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223"
dependencies = [
"derive_arbitrary",
]
[[package]] [[package]]
name = "asn1" name = "asn1"
version = "0.17.0" version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a10032de7d9e6f21c3f1cb1c9c0f94cf30ef67f38310588fe6cfa53e0d3f0" checksum = "18d97d0d2e60ad0595a73b82264dcd46c2f96769b0f555ae71c14122f0679f65"
dependencies = [ dependencies = [
"asn1_derive", "asn1_derive",
"itoa",
] ]
[[package]] [[package]]
name = "asn1_derive" name = "asn1_derive"
version = "0.17.0" version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3df30ecdcaf8338675a1413460a1b11df89789e1fcc6a10dc52f6e38b6982aa2" checksum = "00cec5ab4e9217b82bdd194bf6a4c74890a7e6d530159546bd83684f42211b8a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -644,10 +654,31 @@ dependencies = [
] ]
[[package]] [[package]]
name = "cc" name = "bzip2"
version = "1.1.30" version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8"
dependencies = [
"bzip2-sys",
"libc",
]
[[package]]
name = "bzip2-sys"
version = "0.1.11+1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
dependencies = [
"cc",
"libc",
"pkg-config",
]
[[package]]
name = "cc"
version = "1.1.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f"
dependencies = [ dependencies = [
"jobserver", "jobserver",
"libc", "libc",
@@ -656,7 +687,7 @@ dependencies = [
[[package]] [[package]]
name = "central_backend" name = "central_backend"
version = "0.1.0" version = "1.0.2"
dependencies = [ dependencies = [
"actix", "actix",
"actix-cors", "actix-cors",
@@ -692,10 +723,12 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"serde_yml", "serde_yml",
"thiserror", "thiserror 2.0.3",
"tokio", "tokio",
"tokio_schedule", "tokio_schedule",
"uuid", "uuid",
"walkdir",
"zip",
] ]
[[package]] [[package]]
@@ -730,9 +763,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.20" version = "4.5.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@@ -740,9 +773,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.5.20" version = "4.5.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@@ -774,6 +807,12 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
[[package]]
name = "constant_time_eq"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6"
[[package]] [[package]]
name = "convert_case" name = "convert_case"
version = "0.4.0" version = "0.4.0"
@@ -823,6 +862,21 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "crc"
version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636"
dependencies = [
"crc-catalog",
]
[[package]]
name = "crc-catalog"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.4.2" version = "1.4.2"
@@ -923,6 +977,12 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "deflate64"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b"
[[package]] [[package]]
name = "deranged" name = "deranged"
version = "0.3.11" version = "0.3.11"
@@ -932,6 +992,17 @@ dependencies = [
"powerfmt", "powerfmt",
] ]
[[package]]
name = "derive_arbitrary"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "derive_more" name = "derive_more"
version = "0.99.18" version = "0.99.18"
@@ -998,6 +1069,17 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "displaydoc"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "dotenvy" name = "dotenvy"
version = "0.15.7" version = "0.15.7"
@@ -1106,9 +1188,9 @@ dependencies = [
[[package]] [[package]]
name = "fs4" name = "fs4"
version = "0.10.0" version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec6fcfb3c0c1d71612528825042261419d5dade9678c39a781e05b63677d9b32" checksum = "e871a4cfa68bb224863b53149d973df1ac8d1ed2fa1d1bfc37ac1bb65dd37207"
dependencies = [ dependencies = [
"rustix", "rustix",
"windows-sys 0.52.0", "windows-sys 0.52.0",
@@ -1387,9 +1469,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "1.4.1" version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-channel", "futures-channel",
@@ -1498,9 +1580,9 @@ dependencies = [
[[package]] [[package]]
name = "impl-more" name = "impl-more"
version = "0.1.6" version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "206ca75c9c03ba3d4ace2460e57b189f39f43de612c2f85836e65c929701bb2d" checksum = "aae21c3177a27788957044151cc2800043d127acaa460a47ebb9b84dfa2c6aa0"
[[package]] [[package]]
name = "indexmap" name = "indexmap"
@@ -1620,9 +1702,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.161" version = "0.2.164"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f"
[[package]] [[package]]
name = "libredox" name = "libredox"
@@ -1677,12 +1759,28 @@ dependencies = [
"scopeguard", "scopeguard",
] ]
[[package]]
name = "lockfree-object-pool"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e"
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.22" version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
name = "lzma-rs"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e"
dependencies = [
"byteorder",
"crc",
]
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.7.4" version = "2.7.4"
@@ -1878,6 +1976,16 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "pbkdf2"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"
dependencies = [
"digest",
"hmac",
]
[[package]] [[package]]
name = "pem" name = "pem"
version = "3.0.4" version = "3.0.4"
@@ -1955,9 +2063,9 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.87" version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9"
dependencies = [ dependencies = [
"unicode-ident", "unicode-ident",
] ]
@@ -2018,7 +2126,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43"
dependencies = [ dependencies = [
"getrandom", "getrandom",
"libredox", "libredox",
"thiserror", "thiserror 1.0.69",
] ]
[[package]] [[package]]
@@ -2058,9 +2166,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]] [[package]]
name = "reqwest" name = "reqwest"
version = "0.12.8" version = "0.12.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f"
dependencies = [ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"bytes", "bytes",
@@ -2178,9 +2286,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.23.14" version = "0.23.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993"
dependencies = [ dependencies = [
"once_cell", "once_cell",
"rustls-pki-types", "rustls-pki-types",
@@ -2200,9 +2308,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls-pki-types" name = "rustls-pki-types"
version = "1.9.0" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b"
[[package]] [[package]]
name = "rustls-webpki" name = "rustls-webpki"
@@ -2285,18 +2393,18 @@ dependencies = [
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.210" version = "1.0.215"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.210" version = "1.0.215"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2305,9 +2413,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.129" version = "1.0.133"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6dbcf9b78a125ee667ae19388837dd12294b858d101fdd393cb9d5501ef09eb2" checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377"
dependencies = [ dependencies = [
"itoa", "itoa",
"memchr", "memchr",
@@ -2388,6 +2496,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "simd-adler32"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
[[package]] [[package]]
name = "simple_asn1" name = "simple_asn1"
version = "0.6.2" version = "0.6.2"
@@ -2396,7 +2510,7 @@ checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085"
dependencies = [ dependencies = [
"num-bigint", "num-bigint",
"num-traits", "num-traits",
"thiserror", "thiserror 1.0.69",
"time", "time",
] ]
@@ -2445,9 +2559,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.79" version = "2.0.87"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2510,18 +2624,38 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.64" version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl 1.0.69",
]
[[package]]
name = "thiserror"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa"
dependencies = [
"thiserror-impl 2.0.3",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.64" version = "1.0.69"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "thiserror-impl"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2576,9 +2710,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.40.0" version = "1.41.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"bytes", "bytes",
@@ -2698,12 +2832,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]] [[package]]
name = "unicase" name = "unicase"
version = "2.7.0" version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df"
dependencies = [
"version_check",
]
[[package]] [[package]]
name = "unicode-bidi" name = "unicode-bidi"
@@ -2773,9 +2904,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.10.0" version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a"
dependencies = [ dependencies = [
"getrandom", "getrandom",
"serde", "serde",
@@ -3079,6 +3210,63 @@ name = "zeroize"
version = "1.8.1" version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
dependencies = [
"zeroize_derive",
]
[[package]]
name = "zeroize_derive"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "zip"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494"
dependencies = [
"aes",
"arbitrary",
"bzip2",
"constant_time_eq",
"crc32fast",
"crossbeam-utils",
"deflate64",
"displaydoc",
"flate2",
"hmac",
"indexmap",
"lzma-rs",
"memchr",
"pbkdf2",
"rand",
"sha1",
"thiserror 1.0.69",
"time",
"zeroize",
"zopfli",
"zstd",
]
[[package]]
name = "zopfli"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946"
dependencies = [
"bumpalo",
"crc32fast",
"lockfree-object-pool",
"log",
"once_cell",
"simd-adler32",
]
[[package]] [[package]]
name = "zstd" name = "zstd"

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "central_backend" name = "central_backend"
version = "0.1.0" version = "1.0.2"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
@@ -10,26 +10,26 @@ lazy_static = "1.5.0"
dotenvy = "0.15.7" dotenvy = "0.15.7"
clap = { version = "4.5.20", features = ["derive", "env"] } clap = { version = "4.5.20", features = ["derive", "env"] }
anyhow = "1.0.89" anyhow = "1.0.89"
thiserror = "1.0.64" thiserror = "2.0.3"
openssl = { version = "0.10.66" } openssl = { version = "0.10.66" }
openssl-sys = "0.9.102" openssl-sys = "0.9.102"
libc = "0.2.159" libc = "0.2.159"
foreign-types-shared = "0.1.1" foreign-types-shared = "0.1.1"
asn1 = "0.17" asn1 = "0.19"
actix-web = { version = "4", features = ["openssl"] } actix-web = { version = "4", features = ["openssl"] }
futures = "0.3.31" futures = "0.3.31"
serde = { version = "1.0.210", features = ["derive"] } serde = { version = "1.0.215", features = ["derive"] }
reqwest = { version = "0.12.7", features = ["json"] } reqwest = { version = "0.12.7", features = ["json"] }
serde_json = "1.0.128" serde_json = "1.0.131"
rand = "0.8.5" rand = "0.8.5"
actix = "0.13.5" actix = "0.13.5"
actix-identity = "0.8.0" actix-identity = "0.8.0"
actix-session = { version = "0.10.1", features = ["cookie-session"] } actix-session = { version = "0.10.1", features = ["cookie-session"] }
actix-cors = "0.7.0" actix-cors = "0.7.0"
actix-multipart = { version ="0.7.2", features = ["derive"] } actix-multipart = { version = "0.7.2", features = ["derive"] }
actix-remote-ip = "0.1.0" actix-remote-ip = "0.1.0"
futures-util = "0.3.31" futures-util = "0.3.31"
uuid = { version = "1.10.0", features = ["v4", "serde"] } uuid = { version = "1.11.0", features = ["v4", "serde"] }
semver = { version = "1.0.23", features = ["serde"] } semver = { version = "1.0.23", features = ["serde"] }
lazy-regex = "3.3.0" lazy-regex = "3.3.0"
tokio = { version = "1.40.0", features = ["full"] } tokio = { version = "1.40.0", features = ["full"] }
@@ -41,4 +41,6 @@ prettytable-rs = "0.10.0"
chrono = "0.4.38" chrono = "0.4.38"
serde_yml = "0.0.12" serde_yml = "0.0.12"
bincode = "=2.0.0-rc.3" bincode = "=2.0.0-rc.3"
fs4 = { version = "0.10.0", features = ["sync"] } fs4 = { version = "0.11.0", features = ["sync"] }
zip = { version = "2.2.0", features = ["bzip2"] }
walkdir = "2.5.0"

View File

@@ -10,7 +10,7 @@ pub enum ConsumptionHistoryType {
} }
/// Electrical consumption fetcher backend /// Electrical consumption fetcher backend
#[derive(Subcommand, Debug, Clone)] #[derive(Subcommand, Debug, Clone, serde::Serialize)]
pub enum ConsumptionBackend { pub enum ConsumptionBackend {
/// Constant consumption value /// Constant consumption value
Constant { Constant {
@@ -49,7 +49,7 @@ pub enum ConsumptionBackend {
} }
/// Solar system central backend /// Solar system central backend
#[derive(Parser, Debug)] #[derive(Parser, Debug, serde::Serialize)]
#[command(version, about, long_about = None)] #[command(version, about, long_about = None)]
pub struct AppConfig { pub struct AppConfig {
/// Read arguments from env file /// Read arguments from env file
@@ -110,6 +110,18 @@ pub struct AppConfig {
#[arg(short('f'), long, env, default_value_t = 5)] #[arg(short('f'), long, env, default_value_t = 5)]
pub energy_fetch_interval: u64, pub energy_fetch_interval: u64,
/// Custom current consumption title in dashboard
#[arg(long, env)]
pub dashboard_custom_current_consumption_title: Option<String>,
/// Custom relays consumption title in dashboard
#[arg(long, env)]
pub dashboard_custom_relays_consumption_title: Option<String>,
/// Custom cached consumption title in dashboard
#[arg(long, env)]
pub dashboard_custom_cached_consumption_title: Option<String>,
/// Consumption backend provider /// Consumption backend provider
#[clap(subcommand)] #[clap(subcommand)]
pub consumption_backend: Option<ConsumptionBackend>, pub consumption_backend: Option<ConsumptionBackend>,

View File

@@ -71,7 +71,11 @@ pub async fn get_curr_consumption() -> anyhow::Result<EnergyConsumption> {
let response = match curl { let response = match curl {
false => reqwest::get(url).await?.json::<FroniusResponse>().await?, false => reqwest::get(url).await?.json::<FroniusResponse>().await?,
true => { true => {
let res = std::process::Command::new("curl").arg(url).output()?; let res = std::process::Command::new("curl")
.arg("--connect-timeout")
.arg("1.5")
.arg(url)
.output()?;
if !res.status.success() { if !res.status.success() {
return Err(ConsumptionError::CurlReqFailed.into()); return Err(ConsumptionError::CurlReqFailed.into());

View File

@@ -25,7 +25,14 @@ impl EnergyActor {
pub async fn new() -> anyhow::Result<Self> { pub async fn new() -> anyhow::Result<Self> {
let consumption_cache_size = let consumption_cache_size =
AppConfig::get().refresh_interval / AppConfig::get().energy_fetch_interval; AppConfig::get().refresh_interval / AppConfig::get().energy_fetch_interval;
let curr_consumption = consumption::get_curr_consumption().await?; let curr_consumption = match consumption::get_curr_consumption().await {
Ok(v) => v,
Err(e) => {
log::warn!("Failed to fetch consumption, using default value! {e}");
constants::FALLBACK_PRODUCTION_VALUE
}
};
log::info!("Initial consumption value: {curr_consumption}");
let mut consumption_cache = ConsumptionCache::new(consumption_cache_size as usize); let mut consumption_cache = ConsumptionCache::new(consumption_cache_size as usize);
consumption_cache.add_value(curr_consumption); consumption_cache.add_value(curr_consumption);

View File

@@ -4,6 +4,7 @@ use actix_web::HttpResponse;
use std::error::Error; use std::error::Error;
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use std::io::ErrorKind; use std::io::ErrorKind;
use zip::result::ZipError;
/// Custom error to ease controller writing /// Custom error to ease controller writing
#[derive(Debug)] #[derive(Debug)]
@@ -109,6 +110,18 @@ impl From<openssl::error::ErrorStack> for HttpErr {
} }
} }
impl From<ZipError> for HttpErr {
fn from(value: ZipError) -> Self {
HttpErr::Err(std::io::Error::new(ErrorKind::Other, value.to_string()).into())
}
}
impl From<walkdir::Error> for HttpErr {
fn from(value: walkdir::Error) -> Self {
HttpErr::Err(std::io::Error::new(ErrorKind::Other, value.to_string()).into())
}
}
impl From<HttpResponse> for HttpErr { impl From<HttpResponse> for HttpErr {
fn from(value: HttpResponse) -> Self { fn from(value: HttpResponse) -> Self {
HttpErr::HTTPResponse(value) HttpErr::HTTPResponse(value)

View File

@@ -243,6 +243,11 @@ pub async fn secure_server(energy_actor: EnergyActorAddr) -> anyhow::Result<()>
"/web_api/relay/{id}/status", "/web_api/relay/{id}/status",
web::get().to(relays_controller::status_single), web::get().to(relays_controller::status_single),
) )
// Management API
.route(
"/web_api/management/download_storage",
web::get().to(management_controller::download_storage),
)
// Devices API // Devices API
.route( .route(
"/devices_api/utils/time", "/devices_api/utils/time",

View File

@@ -9,14 +9,20 @@ use actix_web::HttpResponse;
#[derive(serde::Serialize)] #[derive(serde::Serialize)]
struct Consumption { struct Consumption {
consumption: i32, consumption: Option<i32>,
} }
/// Get current energy consumption /// Get current energy consumption
pub async fn curr_consumption() -> HttpResult { pub async fn curr_consumption() -> HttpResult {
let consumption = consumption::get_curr_consumption().await?; Ok(match consumption::get_curr_consumption().await {
Ok(v) => HttpResponse::Ok().json(Consumption {
Ok(HttpResponse::Ok().json(Consumption { consumption })) consumption: Some(v),
}),
Err(e) => {
log::error!("Failed to fetch current consumption! {e}");
HttpResponse::Ok().json(Consumption { consumption: None })
}
})
} }
/// Get curr consumption history /// Get curr consumption history
@@ -34,7 +40,9 @@ pub async fn curr_consumption_history() -> HttpResult {
pub async fn cached_consumption(energy_actor: WebEnergyActor) -> HttpResult { pub async fn cached_consumption(energy_actor: WebEnergyActor) -> HttpResult {
let consumption = energy_actor.send(energy_actor::GetCurrConsumption).await?; let consumption = energy_actor.send(energy_actor::GetCurrConsumption).await?;
Ok(HttpResponse::Ok().json(Consumption { consumption })) Ok(HttpResponse::Ok().json(Consumption {
consumption: Some(consumption),
}))
} }
/// Get current relays consumption /// Get current relays consumption
@@ -42,7 +50,9 @@ pub async fn relays_consumption(energy_actor: WebEnergyActor) -> HttpResult {
let consumption = let consumption =
energy_actor.send(energy_actor::RelaysConsumption).await? as EnergyConsumption; energy_actor.send(energy_actor::RelaysConsumption).await? as EnergyConsumption;
Ok(HttpResponse::Ok().json(Consumption { consumption })) Ok(HttpResponse::Ok().json(Consumption {
consumption: Some(consumption),
}))
} }
pub async fn relays_consumption_history() -> HttpResult { pub async fn relays_consumption_history() -> HttpResult {

View File

@@ -0,0 +1,66 @@
use crate::app_config::AppConfig;
use crate::server::custom_error::HttpResult;
use crate::utils::time_utils::current_day;
use actix_web::HttpResponse;
use anyhow::Context;
use std::fs::File;
use std::io::{Cursor, Read, Write};
use walkdir::WalkDir;
use zip::write::SimpleFileOptions;
/// Download a full copy of the storage data
pub async fn download_storage() -> HttpResult {
let mut zip_buff = Cursor::new(Vec::new());
let mut zip = zip::ZipWriter::new(&mut zip_buff);
let options = SimpleFileOptions::default()
.compression_method(zip::CompressionMethod::Bzip2)
.unix_permissions(0o700);
let storage = AppConfig::get().storage_path();
let mut file_buff = Vec::new();
for entry in WalkDir::new(&storage) {
let entry = entry?;
let path = entry.path();
let name = path.strip_prefix(&storage).unwrap();
let path_as_string = name
.to_str()
.map(str::to_owned)
.with_context(|| format!("{name:?} Is a Non UTF-8 Path"))?;
// Write file or directory explicitly
// Some unzip tools unzip files with directory paths correctly, some do not!
if path.is_file() {
log::debug!("adding file {path:?} as {name:?} ...");
zip.start_file(path_as_string, options)?;
let mut f = File::open(path)?;
f.read_to_end(&mut file_buff)?;
zip.write_all(&file_buff)?;
file_buff.clear();
} else if !name.as_os_str().is_empty() {
// Only if not root! Avoids path spec / warning
// and mapname conversion failed error on unzip
log::debug!("adding dir {path_as_string:?} as {name:?} ...");
zip.add_directory(path_as_string, options)?;
}
}
// Inject runtime configuration
zip.start_file("/app_config.json", options)?;
zip.write_all(&serde_json::to_vec_pretty(&AppConfig::get())?)?;
zip.finish()?;
let filename = format!("storage-{}.zip", current_day());
Ok(HttpResponse::Ok()
.content_type("application/zip")
.insert_header((
"content-disposition",
format!("attachment; filename=\"{filename}\""),
))
.body(zip_buff.into_inner()))
}

View File

@@ -2,6 +2,7 @@ pub mod auth_controller;
pub mod devices_controller; pub mod devices_controller;
pub mod energy_controller; pub mod energy_controller;
pub mod logging_controller; pub mod logging_controller;
pub mod management_controller;
pub mod ota_controller; pub mod ota_controller;
pub mod relays_controller; pub mod relays_controller;
pub mod server_controller; pub mod server_controller;

View File

@@ -13,6 +13,10 @@ struct ServerConfig {
auth_disabled: bool, auth_disabled: bool,
constraints: StaticConstraints, constraints: StaticConstraints,
unsecure_origin: String, unsecure_origin: String,
backend_version: &'static str,
dashboard_custom_current_consumption_title: Option<&'static str>,
dashboard_custom_relays_consumption_title: Option<&'static str>,
dashboard_custom_cached_consumption_title: Option<&'static str>,
} }
impl Default for ServerConfig { impl Default for ServerConfig {
@@ -21,6 +25,16 @@ impl Default for ServerConfig {
auth_disabled: AppConfig::get().unsecure_disable_login, auth_disabled: AppConfig::get().unsecure_disable_login,
constraints: Default::default(), constraints: Default::default(),
unsecure_origin: AppConfig::get().unsecure_origin(), unsecure_origin: AppConfig::get().unsecure_origin(),
backend_version: env!("CARGO_PKG_VERSION"),
dashboard_custom_current_consumption_title: AppConfig::get()
.dashboard_custom_current_consumption_title
.as_deref(),
dashboard_custom_relays_consumption_title: AppConfig::get()
.dashboard_custom_relays_consumption_title
.as_deref(),
dashboard_custom_cached_consumption_title: AppConfig::get()
.dashboard_custom_cached_consumption_title
.as_deref(),
} }
} }
} }

View File

@@ -41,6 +41,12 @@ pub fn time_start_of_day() -> anyhow::Result<u64> {
Ok(local.timestamp() as u64) Ok(local.timestamp() as u64)
} }
/// Get formatted string containing current day information
pub fn current_day() -> String {
let dt = Local::now();
format!("{}-{:0>2}-{:0>2}", dt.year(), dt.month(), dt.day())
}
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use crate::utils::time_utils::day_number; use crate::utils::time_utils::day_number;

File diff suppressed because it is too large Load Diff

View File

@@ -15,10 +15,10 @@
"@fontsource/roboto": "^5.1.0", "@fontsource/roboto": "^5.1.0",
"@mdi/js": "^7.4.47", "@mdi/js": "^7.4.47",
"@mdi/react": "^1.6.1", "@mdi/react": "^1.6.1",
"@mui/icons-material": "^6.1.3", "@mui/icons-material": "^6.1.4",
"@mui/material": "^6.1.3", "@mui/material": "^6.1.4",
"@mui/x-charts": "^7.20.0", "@mui/x-charts": "^7.21.0",
"@mui/x-date-pickers": "^7.20.0", "@mui/x-date-pickers": "^7.21.0",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"date-and-time": "^3.6.0", "date-and-time": "^3.6.0",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
@@ -31,13 +31,13 @@
"devDependencies": { "devDependencies": {
"@types/react": "^18.3.11", "@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1", "@types/react-dom": "^18.3.1",
"@typescript-eslint/eslint-plugin": "^8.8.0", "@typescript-eslint/eslint-plugin": "^8.15.0",
"@typescript-eslint/parser": "^8.8.0", "@typescript-eslint/parser": "^8.10.0",
"@vitejs/plugin-react": "^4.3.2", "@vitejs/plugin-react": "^4.3.2",
"eslint": "^8.57.1", "eslint": "^9.0.0",
"eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.12", "eslint-plugin-react-refresh": "^0.4.12",
"typescript": "^5.6.3", "typescript": "^5.6.3",
"vite": "^5.4.8" "vite": "^5.4.9"
} }
} }

View File

@@ -16,6 +16,7 @@ import { PendingDevicesRoute } from "./routes/PendingDevicesRoute";
import { RelaysListRoute } from "./routes/RelaysListRoute"; import { RelaysListRoute } from "./routes/RelaysListRoute";
import { BaseAuthenticatedPage } from "./widgets/BaseAuthenticatedPage"; import { BaseAuthenticatedPage } from "./widgets/BaseAuthenticatedPage";
import { OTARoute } from "./routes/OTARoute"; import { OTARoute } from "./routes/OTARoute";
import { ManagementRoute } from "./routes/ManagementRoute";
export function App() { export function App() {
if (!AuthApi.SignedIn && !ServerApi.Config.auth_disabled) if (!AuthApi.SignedIn && !ServerApi.Config.auth_disabled)
@@ -31,6 +32,7 @@ export function App() {
<Route path="relays" element={<RelaysListRoute />} /> <Route path="relays" element={<RelaysListRoute />} />
<Route path="ota" element={<OTARoute />} /> <Route path="ota" element={<OTARoute />} />
<Route path="logs" element={<LogsRoute />} /> <Route path="logs" element={<LogsRoute />} />
<Route path="management" element={<ManagementRoute />} />
<Route path="*" element={<NotFoundRoute />} /> <Route path="*" element={<NotFoundRoute />} />
</Route> </Route>
) )

View File

@@ -4,6 +4,10 @@ export interface ServerConfig {
auth_disabled: boolean; auth_disabled: boolean;
constraints: ServerConstraint; constraints: ServerConstraint;
unsecure_origin: string; unsecure_origin: string;
backend_version: string;
dashboard_custom_current_consumption_title?: string;
dashboard_custom_relays_consumption_title?: string;
dashboard_custom_cached_consumption_title?: string;
} }
export interface ServerConstraint { export interface ServerConstraint {

View File

@@ -81,7 +81,7 @@ function ValidatedDevicesList(p: {
<Table sx={{ minWidth: 650 }} aria-label="simple table"> <Table sx={{ minWidth: 650 }} aria-label="simple table">
<TableHead> <TableHead>
<TableRow> <TableRow>
<TableCell>#</TableCell> <TableCell>Name</TableCell>
<TableCell align="center">Model</TableCell> <TableCell align="center">Model</TableCell>
<TableCell align="center">Version</TableCell> <TableCell align="center">Version</TableCell>
<TableCell align="center">Max relays</TableCell> <TableCell align="center">Max relays</TableCell>
@@ -99,7 +99,7 @@ function ValidatedDevicesList(p: {
onDoubleClick={() => navigate(DeviceURL(dev))} onDoubleClick={() => navigate(DeviceURL(dev))}
> >
<TableCell component="th" scope="row"> <TableCell component="th" scope="row">
{dev.id} {dev.name}
</TableCell> </TableCell>
<TableCell align="center">{dev.info.reference}</TableCell> <TableCell align="center">{dev.info.reference}</TableCell>
<TableCell align="center">{dev.info.version}</TableCell> <TableCell align="center">{dev.info.version}</TableCell>

View File

@@ -2,6 +2,7 @@ import React from "react";
import { EnergyApi } from "../../api/EnergyApi"; import { EnergyApi } from "../../api/EnergyApi";
import { useSnackbar } from "../../hooks/context_providers/SnackbarProvider"; import { useSnackbar } from "../../hooks/context_providers/SnackbarProvider";
import StatCard from "../../widgets/StatCard"; import StatCard from "../../widgets/StatCard";
import { ServerApi } from "../../api/ServerApi";
export function CachedConsumptionWidget(): React.ReactElement { export function CachedConsumptionWidget(): React.ReactElement {
const snackbar = useSnackbar(); const snackbar = useSnackbar();
@@ -26,6 +27,12 @@ export function CachedConsumptionWidget(): React.ReactElement {
}); });
return ( return (
<StatCard title="Cached consumption" value={val?.toString() ?? "Loading"} /> <StatCard
title={
ServerApi.Config.dashboard_custom_cached_consumption_title ??
"Cached consumption"
}
value={val?.toString() ?? "Loading"}
/>
); );
} }

View File

@@ -2,6 +2,7 @@ import React from "react";
import { EnergyApi } from "../../api/EnergyApi"; import { EnergyApi } from "../../api/EnergyApi";
import { useSnackbar } from "../../hooks/context_providers/SnackbarProvider"; import { useSnackbar } from "../../hooks/context_providers/SnackbarProvider";
import StatCard from "../../widgets/StatCard"; import StatCard from "../../widgets/StatCard";
import { ServerApi } from "../../api/ServerApi";
export function CurrConsumptionWidget(): React.ReactElement { export function CurrConsumptionWidget(): React.ReactElement {
const snackbar = useSnackbar(); const snackbar = useSnackbar();
@@ -29,7 +30,10 @@ export function CurrConsumptionWidget(): React.ReactElement {
return ( return (
<StatCard <StatCard
title="Current consumption" title={
ServerApi.Config.dashboard_custom_current_consumption_title ??
"Current consumption"
}
data={history ?? []} data={history ?? []}
interval="Last day" interval="Last day"
value={val?.toString() ?? "Loading"} value={val?.toString() ?? "Loading"}

View File

@@ -2,6 +2,7 @@ import React from "react";
import { EnergyApi } from "../../api/EnergyApi"; import { EnergyApi } from "../../api/EnergyApi";
import { useSnackbar } from "../../hooks/context_providers/SnackbarProvider"; import { useSnackbar } from "../../hooks/context_providers/SnackbarProvider";
import StatCard from "../../widgets/StatCard"; import StatCard from "../../widgets/StatCard";
import { ServerApi } from "../../api/ServerApi";
export function RelayConsumptionWidget(): React.ReactElement { export function RelayConsumptionWidget(): React.ReactElement {
const snackbar = useSnackbar(); const snackbar = useSnackbar();
@@ -29,7 +30,10 @@ export function RelayConsumptionWidget(): React.ReactElement {
return ( return (
<StatCard <StatCard
title="Relays consumption" title={
ServerApi.Config.dashboard_custom_relays_consumption_title ??
"Relays consumption"
}
data={history ?? []} data={history ?? []}
interval="Last day" interval="Last day"
value={val?.toString() ?? "Loading"} value={val?.toString() ?? "Loading"}

View File

@@ -0,0 +1,31 @@
import { Button } from "@mui/material";
import { useConfirm } from "../hooks/context_providers/ConfirmDialogProvider";
import { SolarEnergyRouteContainer } from "../widgets/SolarEnergyRouteContainer";
import { APIClient } from "../api/ApiClient";
export function ManagementRoute(): React.ReactElement {
const confirm = useConfirm();
const downloadBackup = async () => {
try {
if (
!(await confirm(
`Do you really want to download a copy of the storage? It will contain sensitive information!`
))
)
return;
location.href = APIClient.backendURL() + "/management/download_storage";
} catch (e) {
console.error(`Failed to donwload a backup of the storage! Error: ${e}`);
}
};
return (
<SolarEnergyRouteContainer label="Management">
<Button variant="outlined" onClick={downloadBackup}>
Download a backup of storage
</Button>
</SolarEnergyRouteContainer>
);
}

View File

@@ -1,5 +1,6 @@
import { import {
mdiChip, mdiChip,
mdiCog,
mdiElectricSwitch, mdiElectricSwitch,
mdiHome, mdiHome,
mdiMonitorArrowDown, mdiMonitorArrowDown,
@@ -12,9 +13,11 @@ import {
ListItemButton, ListItemButton,
ListItemIcon, ListItemIcon,
ListItemText, ListItemText,
Typography,
} from "@mui/material"; } from "@mui/material";
import { useLocation } from "react-router-dom"; import { useLocation } from "react-router-dom";
import { RouterLink } from "./RouterLink"; import { RouterLink } from "./RouterLink";
import { ServerApi } from "../api/ServerApi";
export function SolarEnergyNavList(): React.ReactElement { export function SolarEnergyNavList(): React.ReactElement {
return ( return (
@@ -52,6 +55,18 @@ export function SolarEnergyNavList(): React.ReactElement {
uri="/logs" uri="/logs"
icon={<Icon path={mdiNotebookMultiple} size={1} />} icon={<Icon path={mdiNotebookMultiple} size={1} />}
/> />
<NavLink
label="Management"
uri="/management"
icon={<Icon path={mdiCog} size={1} />}
/>
<Typography
variant="caption"
component="div"
style={{ textAlign: "center", width: "100%", marginTop: "30px" }}
>
Version {ServerApi.Config.backend_version}
</Typography>
</List> </List>
); );
} }

View File

@@ -21,7 +21,7 @@ export function timeDiff(a: number, b: number): string {
diff = Math.floor(diff / 60); diff = Math.floor(diff / 60);
if (diff === 1) return "1 minute"; if (diff === 1) return "1 minute";
if (diff < 24) { if (diff < 60) {
return `${diff} minutes`; return `${diff} minutes`;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -7,6 +7,6 @@ edition = "2021"
env_logger = "0.11.5" env_logger = "0.11.5"
log = "0.4.22" log = "0.4.22"
clap = { version = "4.5.18", features = ["derive", "env"] } clap = { version = "4.5.18", features = ["derive", "env"] }
egui = "0.28.1" egui = "0.29.1"
eframe = "0.28.1" eframe = "0.29.1"
lazy_static = "1.5.0" lazy_static = "1.5.0"

View File

@@ -1,5 +1,7 @@
# Configure project for production # Configure project for production
Note: This guide assumes that you use the default hostname, `central.internal` as hostname for your central system.
## Create production build ## Create production build
### Central ### Central
@@ -44,6 +46,70 @@ The OTA update is then located in `build/main.bin`
* A server running a recent Linux (Debian / Ubuntu preferred) with `central` as hostname * A server running a recent Linux (Debian / Ubuntu preferred) with `central` as hostname
* DHCP configured on the network * DHCP configured on the network
## Configure DNS server
If you need to setup a DNS server / proxy to point `central.internal` to the central server IP, you can follow this guide.
### Retrieve DNS server binary
Use [DNSProxy](https://gitlab.com/pierre42100/dnsproxy) as DNS server. Get and compile the sources:
```bash
git clone https://gitlab.com/pierre42100/dnsproxy
cd dnsproxy
cargo build --release
scp target/release/dns_proxy USER@CENTRAL_IP:/home/USER
```
Then, on the target server, install the binary to its final destination:
```bash
sudo mv dns_proxy /usr/local/bin/
```
### Configure DNS server
Configure the server as a service `/etc/systemd/system/dns.service`:
```conf
[Unit]
Description=DNS server
After=syslog.target
After=network.target
[Service]
RestartSec=2s
Type=simple
User=root
Group=root
WorkingDirectory=/tmp
ExecStart=/usr/local/bin/dns_proxy -l "CENTRAL_IP:53" -c "central.internal. A CENTRAL_IP"
Restart=always
[Install]
WantedBy=multi-user.target
```
Enable and start the new service:
```bash
sudo systemctl enable dns
sudo systemctl start dns
```
Check that it works correctly:
```bash
dig central.internal. @CENTRAL_IP
```
You should get an entry like this if it works:
```
;; ANSWER SECTION:
central.internal. 0 IN A CENTRAL_IP
```
Then, in your DHCP service, define the central as the DNS server.
## Configure server ## Configure server
### Create a user dedicated to the central ### Create a user dedicated to the central
@@ -82,7 +148,7 @@ COOKIE_SECURE=true
LISTEN_ADDRESS=0.0.0.0:443 LISTEN_ADDRESS=0.0.0.0:443
ADMIN_USERNAME=admin ADMIN_USERNAME=admin
ADMIN_PASSWORD=FIXME ADMIN_PASSWORD=FIXME
HOSTNAME=central.local HOSTNAME=central.internal
STORAGE=/home/central/storage STORAGE=/home/central/storage
FRONIUS_ORIG=http://10.0.0.10 FRONIUS_ORIG=http://10.0.0.10
``` ```

View File

@@ -8,7 +8,7 @@
/** /**
* Backend unsecure API URL * Backend unsecure API URL
*/ */
#define BACKEND_UNSECURE_URL "http://devweb.internal:8080" #define BACKEND_UNSECURE_URL "http://central.internal:8080"
/** /**
* Device name len * Device name len

View File

@@ -1 +1 @@
1.0.0 1.0.2-b1