initial commit
This commit is contained in:
commit
f3e05f44dc
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/target
|
129
Cargo.lock
generated
Normal file
129
Cargo.lock
generated
Normal file
@ -0,0 +1,129 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "chaospott-status"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"spaceapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.83"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.202"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.202"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.117"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spaceapi"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c17c4add299cf8d62c8bc2c959b32e5447661676400f6784b8e7649d98909381"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
10
Cargo.toml
Normal file
10
Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "chaospott-status"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
serde = "1.0.202"
|
||||
serde_derive = "1.0.202"
|
||||
serde_json = "1.0.117"
|
||||
spaceapi = "0.9.0"
|
9
src/main.rs
Normal file
9
src/main.rs
Normal file
@ -0,0 +1,9 @@
|
||||
mod status;
|
||||
|
||||
fn main() {
|
||||
let status = status::status();
|
||||
|
||||
let serialized = serde_json::to_string(&status).unwrap();
|
||||
|
||||
println!("{serialized}");
|
||||
}
|
108
src/status.rs
Normal file
108
src/status.rs
Normal file
@ -0,0 +1,108 @@
|
||||
use spaceapi::{
|
||||
sensors::{DoorLockedSensor, SensorMetadataWithLocation, Sensors},
|
||||
Contact, Location, State, Status, StatusBuilder,
|
||||
};
|
||||
|
||||
const SPACE_NAME: &str = "Chaospott";
|
||||
const SPACE_LOGO: &str = "https://chaospott.de/images/logo.png";
|
||||
const SPACE_URL: &str = "https://chaospott.de";
|
||||
|
||||
pub fn status() -> Status {
|
||||
let mut status = StatusBuilder::v14(SPACE_NAME)
|
||||
.logo(SPACE_LOGO)
|
||||
.url(SPACE_URL)
|
||||
.location(Location {
|
||||
address: Some("Sibyllastr. 9, 45136 Essen, Germany".into()),
|
||||
lat: 51.438476,
|
||||
lon: 7.024991,
|
||||
..Default::default()
|
||||
})
|
||||
.contact(Contact {
|
||||
email: Some("info@chaospott.de".into()),
|
||||
irc: Some("irc://irc.hackint.org/#chaospott".into()),
|
||||
issue_mail: Some("support@chaospott.de".into()),
|
||||
mastodon: Some("https://chaos.social/@chaospott".into()),
|
||||
matrix: Some("#chaospott:matrix.chaospott.de".into()),
|
||||
ml: Some("discuss@lists.chaospott.de".into()),
|
||||
mumble: Some("mumble://mumble.chaospott.de".into()),
|
||||
phone: Some("+49 201 85892243".into()),
|
||||
..Default::default()
|
||||
})
|
||||
// .add_issue_report_channel(IssueReportChannel::IssueMail)
|
||||
// .add_issue_report_channel(IssueReportChannel::Ml)
|
||||
.state(State {
|
||||
open: Some(false),
|
||||
..State::default()
|
||||
})
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let mut sensores = Sensors::default();
|
||||
|
||||
sensores.door_locked.push(DoorLockedSensor {
|
||||
value: true,
|
||||
metadata: SensorMetadataWithLocation {
|
||||
name: None,
|
||||
description: None,
|
||||
location: "aerie".to_string(),
|
||||
},
|
||||
});
|
||||
sensores.door_locked.push(DoorLockedSensor {
|
||||
value: true,
|
||||
metadata: SensorMetadataWithLocation {
|
||||
name: None,
|
||||
description: None,
|
||||
location: "cellar".to_string(),
|
||||
},
|
||||
});
|
||||
status.sensors = Some(sensores);
|
||||
let mut status = StatusBuilder::v14(SPACE_NAME)
|
||||
.logo(SPACE_LOGO)
|
||||
.url(SPACE_URL)
|
||||
.location(Location {
|
||||
address: Some("Sibyllastr. 9, 45136 Essen, Germany".into()),
|
||||
lat: 51.438476,
|
||||
lon: 7.024991,
|
||||
..Default::default()
|
||||
})
|
||||
.contact(Contact {
|
||||
email: Some("info@chaospott.de".into()),
|
||||
irc: Some("irc://irc.hackint.org/#chaospott".into()),
|
||||
issue_mail: Some("support@chaospott.de".into()),
|
||||
mastodon: Some("https://chaos.social/@chaospott".into()),
|
||||
matrix: Some("#chaospott:matrix.chaospott.de".into()),
|
||||
ml: Some("discuss@lists.chaospott.de".into()),
|
||||
mumble: Some("mumble://mumble.chaospott.de".into()),
|
||||
phone: Some("+49 201 85892243".into()),
|
||||
..Default::default()
|
||||
})
|
||||
// .add_issue_report_channel(IssueReportChannel::IssueMail)
|
||||
// .add_issue_report_channel(IssueReportChannel::Ml)
|
||||
.state(State {
|
||||
open: Some(false),
|
||||
..State::default()
|
||||
})
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
let mut sensores = Sensors::default();
|
||||
|
||||
sensores.door_locked.push(DoorLockedSensor {
|
||||
value: true,
|
||||
metadata: SensorMetadataWithLocation {
|
||||
name: None,
|
||||
description: None,
|
||||
location: "aerie".to_string(),
|
||||
},
|
||||
});
|
||||
sensores.door_locked.push(DoorLockedSensor {
|
||||
value: true,
|
||||
metadata: SensorMetadataWithLocation {
|
||||
name: None,
|
||||
description: None,
|
||||
location: "cellar".to_string(),
|
||||
},
|
||||
});
|
||||
status.sensors = Some(sensores);
|
||||
status
|
||||
}
|
Loading…
Reference in New Issue
Block a user