chaospott-status/src/status.rs

109 lines
3.6 KiB
Rust
Raw Normal View History

2024-05-21 19:48:14 +00:00
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
}