remove client rust app

This commit is contained in:
Alex Janka 2024-01-07 10:08:16 +11:00
parent aab2d73f9d
commit dc4db5e5f9
18 changed files with 57 additions and 834 deletions

652
Cargo.lock generated
View file

@ -95,12 +95,6 @@ version = "1.0.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9"
[[package]]
name = "anymap2"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d301b3b94cb4b2f23d7917810addbbaff90738e0ca2be692bd027e70d7e0330c"
[[package]]
name = "async-stream"
version = "0.3.5"
@ -191,15 +185,6 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72"
[[package]]
name = "bincode"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad"
dependencies = [
"serde",
]
[[package]]
name = "bitflags"
version = "1.3.2"
@ -224,12 +209,6 @@ dependencies = [
"generic-array",
]
[[package]]
name = "boolinator"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9"
[[package]]
name = "bumpalo"
version = "3.14.0"
@ -318,16 +297,6 @@ version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
[[package]]
name = "client"
version = "0.1.0"
dependencies = [
"reqwasm",
"shared-types",
"wasm-bindgen-futures",
"yew",
]
[[package]]
name = "colorchoice"
version = "1.0.0"
@ -345,16 +314,6 @@ dependencies = [
"yansi 0.5.1",
]
[[package]]
name = "console_error_panic_hook"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc"
dependencies = [
"cfg-if",
"wasm-bindgen",
]
[[package]]
name = "convert_case"
version = "0.4.0"
@ -617,17 +576,6 @@ version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
[[package]]
name = "futures-macro"
version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
]
[[package]]
name = "futures-sink"
version = "0.3.30"
@ -649,7 +597,6 @@ dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
@ -688,10 +635,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f"
dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi",
"wasm-bindgen",
]
[[package]]
@ -706,373 +651,6 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "gloo"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28999cda5ef6916ffd33fb4a7b87e1de633c47c0dc6d97905fee1cdaa142b94d"
dependencies = [
"gloo-console 0.2.3",
"gloo-dialogs 0.1.1",
"gloo-events 0.1.2",
"gloo-file 0.2.3",
"gloo-history 0.1.5",
"gloo-net 0.3.1",
"gloo-render 0.1.1",
"gloo-storage 0.2.2",
"gloo-timers 0.2.6",
"gloo-utils 0.1.7",
"gloo-worker 0.2.1",
]
[[package]]
name = "gloo"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd35526c28cc55c1db77aed6296de58677dbab863b118483a27845631d870249"
dependencies = [
"gloo-console 0.3.0",
"gloo-dialogs 0.2.0",
"gloo-events 0.2.0",
"gloo-file 0.3.0",
"gloo-history 0.2.2",
"gloo-net 0.4.0",
"gloo-render 0.2.0",
"gloo-storage 0.3.0",
"gloo-timers 0.3.0",
"gloo-utils 0.2.0",
"gloo-worker 0.4.0",
]
[[package]]
name = "gloo-console"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f"
dependencies = [
"gloo-utils 0.1.7",
"js-sys",
"serde",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-console"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a17868f56b4a24f677b17c8cb69958385102fa879418052d60b50bc1727e261"
dependencies = [
"gloo-utils 0.2.0",
"js-sys",
"serde",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-dialogs"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6"
dependencies = [
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-dialogs"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4748e10122b01435750ff530095b1217cf6546173459448b83913ebe7815df"
dependencies = [
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-events"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc"
dependencies = [
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-events"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27c26fb45f7c385ba980f5fa87ac677e363949e065a083722697ef1b2cc91e41"
dependencies = [
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-file"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7"
dependencies = [
"gloo-events 0.1.2",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-file"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97563d71863fb2824b2e974e754a81d19c4a7ec47b09ced8a0e6656b6d54bd1f"
dependencies = [
"gloo-events 0.2.0",
"js-sys",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-history"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85725d90bf0ed47063b3930ef28e863658a7905989e9929a8708aab74a1d5e7f"
dependencies = [
"gloo-events 0.1.2",
"gloo-utils 0.1.7",
"serde",
"serde-wasm-bindgen 0.5.0",
"serde_urlencoded",
"thiserror",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-history"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "903f432be5ba34427eac5e16048ef65604a82061fe93789f2212afc73d8617d6"
dependencies = [
"getrandom",
"gloo-events 0.2.0",
"gloo-utils 0.2.0",
"serde",
"serde-wasm-bindgen 0.6.3",
"serde_urlencoded",
"thiserror",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-net"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2899cb1a13be9020b010967adc6b2a8a343b6f1428b90238c9d53ca24decc6db"
dependencies = [
"futures-channel",
"futures-core",
"futures-sink",
"gloo-utils 0.1.7",
"js-sys",
"pin-project",
"serde",
"serde_json",
"thiserror",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]]
name = "gloo-net"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a66b4e3c7d9ed8d315fd6b97c8b1f74a7c6ecbbc2320e65ae7ed38b7068cc620"
dependencies = [
"futures-channel",
"futures-core",
"futures-sink",
"gloo-utils 0.1.7",
"http",
"js-sys",
"pin-project",
"serde",
"serde_json",
"thiserror",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]]
name = "gloo-net"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ac9e8288ae2c632fa9f8657ac70bfe38a1530f345282d7ba66a1f70b72b7dc4"
dependencies = [
"futures-channel",
"futures-core",
"futures-sink",
"gloo-utils 0.2.0",
"http",
"js-sys",
"pin-project",
"serde",
"serde_json",
"thiserror",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]]
name = "gloo-render"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764"
dependencies = [
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-render"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56008b6744713a8e8d98ac3dcb7d06543d5662358c9c805b4ce2167ad4649833"
dependencies = [
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-storage"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480"
dependencies = [
"gloo-utils 0.1.7",
"js-sys",
"serde",
"serde_json",
"thiserror",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-storage"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbc8031e8c92758af912f9bc08fbbadd3c6f3cfcbf6b64cdf3d6a81f0139277a"
dependencies = [
"gloo-utils 0.2.0",
"js-sys",
"serde",
"serde_json",
"thiserror",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-timers"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "gloo-timers"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "gloo-utils"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "037fcb07216cb3a30f7292bd0176b050b7b9a052ba830ef7d5d65f6dc64ba58e"
dependencies = [
"js-sys",
"serde",
"serde_json",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-utils"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b5555354113b18c547c1d3a98fbf7fb32a9ff4f6fa112ce823a21641a0ba3aa"
dependencies = [
"js-sys",
"serde",
"serde_json",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "gloo-worker"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13471584da78061a28306d1359dd0178d8d6fc1c7c80e5e35d27260346e0516a"
dependencies = [
"anymap2",
"bincode",
"gloo-console 0.2.3",
"gloo-utils 0.1.7",
"js-sys",
"serde",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]]
name = "gloo-worker"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76495d3dd87de51da268fa3a593da118ab43eb7f8809e17eb38d3319b424e400"
dependencies = [
"bincode",
"futures",
"gloo-utils 0.2.0",
"gloo-worker-macros",
"js-sys",
"pinned",
"serde",
"thiserror",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]]
name = "gloo-worker-macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "956caa58d4857bc9941749d55e4bd3000032d8212762586fa5705632967140e7"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.43",
]
[[package]]
name = "h2"
version = "0.3.22"
@ -1249,26 +827,6 @@ dependencies = [
"unicode-normalization",
]
[[package]]
name = "implicit-clone"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc06a255cbf402a52ae399c05a518c68c569c916ea11423620111df576b9b9bb"
dependencies = [
"implicit-clone-derive",
"indexmap",
]
[[package]]
name = "implicit-clone-derive"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9311685eb9a34808bbb0608ad2fcab9ae216266beca5848613e95553ac914e3b"
dependencies = [
"quote",
"syn 2.0.43",
]
[[package]]
name = "include_dir"
version = "0.7.3"
@ -1661,26 +1219,6 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pin-project"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
]
[[package]]
name = "pin-project-lite"
version = "0.2.13"
@ -1693,17 +1231,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "pinned"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a829027bd95e54cfe13e3e258a1ae7b645960553fb82b75ff852c29688ee595b"
dependencies = [
"futures",
"rustversion",
"thiserror",
]
[[package]]
name = "pkce"
version = "0.2.0"
@ -1733,50 +1260,6 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "prettyplease"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d"
dependencies = [
"proc-macro2",
"syn 2.0.43",
]
[[package]]
name = "proc-macro-crate"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
dependencies = [
"once_cell",
"toml_edit 0.19.15",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn 1.0.109",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro2"
version = "1.0.71"
@ -1799,23 +1282,6 @@ dependencies = [
"yansi 1.0.0-rc.1",
]
[[package]]
name = "prokio"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03b55e106e5791fa5a13abd13c85d6127312e8e09098059ca2bc9b03ca4cf488"
dependencies = [
"futures",
"gloo 0.8.1",
"num_cpus",
"once_cell",
"pin-project",
"pinned",
"tokio",
"tokio-stream",
"wasm-bindgen-futures",
]
[[package]]
name = "psl-types"
version = "2.0.11"
@ -1944,15 +1410,6 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
[[package]]
name = "reqwasm"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05b89870d729c501fa7a68c43bf4d938bbb3a8c156d333d90faa0e8b3e3212fb"
dependencies = [
"gloo-net 0.1.0",
]
[[package]]
name = "reqwest"
version = "0.11.23"
@ -2277,28 +1734,6 @@ dependencies = [
"serde_derive",
]
[[package]]
name = "serde-wasm-bindgen"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e"
dependencies = [
"js-sys",
"serde",
"wasm-bindgen",
]
[[package]]
name = "serde-wasm-bindgen"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9b713f70513ae1f8d92665bbbbda5c295c2cf1da5542881ae5eefe20c9af132"
dependencies = [
"js-sys",
"serde",
"wasm-bindgen",
]
[[package]]
name = "serde_derive"
version = "1.0.193"
@ -2362,15 +1797,6 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "shared-types"
version = "0.1.0"
dependencies = [
"serde",
"teslatte",
"thiserror",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.1"
@ -2573,7 +1999,6 @@ dependencies = [
"rocket",
"ron",
"serde",
"shared-types",
"teslatte",
"thiserror",
"tokio",
@ -2595,7 +2020,6 @@ dependencies = [
"serde",
"serde_json",
"strum",
"test-log",
"thiserror",
"tokio",
"tracing",
@ -2604,27 +2028,6 @@ dependencies = [
"urlencoding",
]
[[package]]
name = "test-log"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6159ab4116165c99fc88cce31f99fa2c9dbe08d3691cb38da02fc3b45f357d2b"
dependencies = [
"test-log-macros",
"tracing-subscriber",
]
[[package]]
name = "test-log-macros"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ba277e77219e9eea169e8508942db1bf5d8a41ff2db9b20aab5a5aadc9fa25d"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.43",
]
[[package]]
name = "textwrap"
version = "0.15.2"
@ -2794,7 +2197,7 @@ dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit 0.21.0",
"toml_edit",
]
[[package]]
@ -2806,17 +2209,6 @@ dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap",
"toml_datetime",
"winnow",
]
[[package]]
name = "toml_edit"
version = "0.21.0"
@ -3036,8 +2428,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e"
dependencies = [
"cfg-if",
"serde",
"serde_json",
"wasm-bindgen-macro",
]
@ -3319,46 +2709,6 @@ dependencies = [
"is-terminal",
]
[[package]]
name = "yew"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f1a03f255c70c7aa3e9c62e15292f142ede0564123543c1cc0c7a4f31660cac"
dependencies = [
"console_error_panic_hook",
"futures",
"gloo 0.10.0",
"implicit-clone",
"indexmap",
"js-sys",
"prokio",
"rustversion",
"serde",
"slab",
"thiserror",
"tokio",
"tracing",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"yew-macro",
]
[[package]]
name = "yew-macro"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02fd8ca5166d69e59f796500a2ce432ff751edecbbb308ca59fd3fe4d0343de2"
dependencies = [
"boolinator",
"once_cell",
"prettyplease",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.43",
]
[[package]]
name = "zeroize"
version = "1.7.0"

View file

@ -1,10 +1,24 @@
[workspace]
members = ["server", "client", "shared-types"]
default-members = ["server"]
resolver = "2"
[package]
name = "tesla-charge-controller"
version = "0.1.2"
edition = "2021"
license = "MITNFA"
description = "Controls Tesla charge rate based on solar charge data"
authors = ["Alex Janka"]
[workspace.dependencies]
shared-types = { path = "./shared-types" }
[package.metadata.deb]
maintainer-scripts = "debian/"
systemd-units = { enable = false }
depends = ""
assets = [["target/release/tesla-charge-controller", "usr/bin/", "755"]]
[dependencies]
clap = { version = "4.0", features = ["derive"] }
ron = "0.8"
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.35.1", features = ["full"] }
teslatte = { path = "./vendored/teslatte" }
thiserror = "1.0"
rocket = { version = "0.5", features = ["json"] }
anyhow = "1.0"
include_dir = "0.7"

View file

@ -1,12 +0,0 @@
[package]
name = "client"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
shared-types = { workspace = true }
yew = { version = "0.21", features = ["csr"] }
reqwasm = "0.5"
wasm-bindgen-futures = "0.4"

View file

@ -1,11 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Tesla Charge Control</title>
</head>
<body></body>
</html>

View file

@ -1,68 +0,0 @@
use yew::prelude::*;
const API_URL: &str = if cfg!(debug_assertions) {
"http://localhost:8000"
} else {
""
};
#[function_component]
fn App() -> Html {
let counter = use_state(Vec::new);
let onclick = {
let counter = counter.clone();
move |_| {
let counter = counter.clone();
wasm_bindgen_futures::spawn_local(async move {
counter.set(
match reqwasm::http::Request::get(&format!("{API_URL}/charge-state"))
.send()
.await
{
Ok(response) => match response.json::<shared_types::ChargeState>().await {
Ok(v) => vec![
format!("Battery {}%", v.battery_level),
format!("Range: {:.1}km", v.range_km()),
format!("Charging at {} amps", v.charge_amps),
],
Err(e) => vec![format!("error getting text: {e:#?}")],
},
Err(e) => vec![format!("request error: {e:#?}")],
},
);
})
}
};
let counter = <Vec<std::string::String> as Clone>::clone(&counter);
let text_elements: Vec<yew::virtual_dom::VNode> = counter
.iter()
.map(|text| {
html! {<p>{text}</p>}
})
.collect();
let flash = move |_| {
wasm_bindgen_futures::spawn_local(async move {
match reqwasm::http::Request::post(&format!("{API_URL}/flash"))
.send()
.await
{
Ok(response) => match response.json::<shared_types::ChargeState>().await {
Ok(_) => {}
Err(e) => println!("error getting text: {e:#?}"),
},
Err(e) => println!("request error: {e:#?}"),
}
})
};
html! {
<div>
<button {onclick}>{ "refresh" }</button>
{text_elements}
<button onclick={flash}>{ "flash" }</button>
</div>
}
}
fn main() {
yew::Renderer::<App>::new().render();
}

View file

@ -1,25 +0,0 @@
[package]
name = "tesla-charge-controller"
version = "0.1.2"
edition = "2021"
license = "MITNFA"
description = "Controls Tesla charge rate based on solar charge data"
authors = ["Alex Janka"]
[package.metadata.deb]
maintainer-scripts = "debian/"
systemd-units = { enable = false }
depends = ""
assets = [["target/release/tesla-charge-controller", "usr/bin/", "755"]]
[dependencies]
shared-types = { workspace = true, features = ["teslatte"] }
clap = { version = "4.0", features = ["derive"] }
ron = "0.8"
serde = { workspace = true }
tokio = { version = "1.35.1", features = ["full"] }
teslatte = { workspace = true }
thiserror = { workspace = true }
rocket = { version = "0.5", features = ["json"] }
anyhow = "1.0"
include_dir = "0.7"

View file

@ -1,13 +0,0 @@
[package]
name = "shared-types"
version = "0.1.0"
edition = "2021"
[features]
default = []
teslatte = ["dep:teslatte"]
[dependencies]
serde = { workspace = true }
teslatte = { workspace = true, optional = true }
thiserror = { workspace = true }

View file

@ -1,20 +0,0 @@
use serde::{Deserialize, Serialize};
#[cfg(feature = "teslatte")]
mod teslatte_impls;
#[derive(Clone, Copy, Serialize, Deserialize, Debug)]
pub struct ChargeState {
pub battery_level: i64,
pub battery_range: f64,
pub charge_amps: i64,
pub charge_current_request: i64,
pub charge_current_request_max: i64,
pub charge_enable_request: bool,
}
impl ChargeState {
pub fn range_km(&self) -> f64 {
self.battery_range * 1.60934
}
}

View file

@ -1,24 +0,0 @@
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ConvertError {
#[error("Error")]
Error,
}
impl TryFrom<teslatte::vehicles::ChargeState> for crate::ChargeState {
type Error = ConvertError;
fn try_from(
value: teslatte::vehicles::ChargeState,
) -> std::prelude::v1::Result<Self, Self::Error> {
Ok(crate::ChargeState {
battery_level: value.battery_level,
battery_range: value.battery_range,
charge_amps: value.charge_amps,
charge_current_request: value.charge_current_request,
charge_current_request_max: value.charge_current_request_max,
charge_enable_request: value.charge_enable_request,
})
}
}

View file

@ -21,6 +21,7 @@ use crate::{config::Config, errors::*};
mod config;
mod errors;
mod server;
mod types;
#[derive(Parser, Debug, Clone)]
#[clap(author, version, about, long_about = None)]

View file

@ -11,7 +11,7 @@ use teslatte::{
FleetVehicleApi,
};
use crate::{config::Config, Coords, FleetApiAuth};
use crate::{config::Config, types::ChargeState, Coords, FleetApiAuth};
use self::static_handler::UiStatic;
@ -55,7 +55,7 @@ async fn home(state: &State<ServerState>) -> Option<String> {
}
#[get("/charge-state")]
async fn charge_state(state: &State<ServerState>) -> Option<Json<shared_types::ChargeState>> {
async fn charge_state(state: &State<ServerState>) -> Option<Json<ChargeState>> {
let charge_state = state.get_charge_state().await.ok()?;
Some(Json(charge_state))
}
@ -84,7 +84,7 @@ impl ServerState {
})
}
async fn get_charge_state(&self) -> Result<shared_types::ChargeState> {
async fn get_charge_state(&self) -> Result<ChargeState> {
let vehicle_data = self
.auth
.api()
@ -94,7 +94,7 @@ impl ServerState {
})
.await?;
let charge_state = vehicle_data.charge_state.context("no drive state")?;
Ok(charge_state.try_into()?)
Ok(charge_state.into())
}
async fn flash(&self) {

31
src/types.rs Normal file
View file

@ -0,0 +1,31 @@
use serde::{Deserialize, Serialize};
#[derive(Clone, Copy, Serialize, Deserialize, Debug)]
pub struct ChargeState {
pub battery_level: i64,
pub battery_range: f64,
pub charge_amps: i64,
pub charge_current_request: i64,
pub charge_current_request_max: i64,
pub charge_enable_request: bool,
}
impl ChargeState {
#[allow(unused)]
pub fn range_km(&self) -> f64 {
self.battery_range * 1.60934
}
}
impl From<teslatte::vehicles::ChargeState> for ChargeState {
fn from(value: teslatte::vehicles::ChargeState) -> Self {
ChargeState {
battery_level: value.battery_level,
battery_range: value.battery_range,
charge_amps: value.charge_amps,
charge_current_request: value.charge_current_request,
charge_current_request_max: value.charge_current_request_max,
charge_enable_request: value.charge_enable_request,
}
}
}