Use new spaceapid version and configure temp. and humid. sensors

This commit is contained in:
June 2024-01-15 03:25:48 +01:00
parent ec5430ee34
commit 5b61a31904
3 changed files with 128 additions and 7 deletions

View file

@ -0,0 +1,77 @@
{
"dynamic": {
"sensors": {
"temperature": [
{
"sensor_data": {
"unit": "C",
"location": "Hauptraum",
"description": "Sensor im Hauptraum"
},
"allowed_credentials": [
"club-assistant"
]
},
{
"sensor_data": {
"unit": "C",
"location": "Loetschlauch",
"description": "Sensor im Lötschlauch (Teil der Werkstatt)"
},
"allowed_credentials": [
"club-assistant"
]
},
{
"sensor_data": {
"unit": "C",
"location": "Innenhof",
"description": "Sensor im Innenhof (erreichbar durch das Flurfenster)"
},
"allowed_credentials": [
"club-assistant"
]
}
],
"humidity": [
{
"sensor_data": {
"unit": "%",
"location": "Hauptraum",
"description": "Sensor im Hauptraum"
},
"allowed_credentials": [
"club-assistant"
]
},
{
"sensor_data": {
"unit": "%",
"location": "Loetschlauch",
"description": "Sensor im Lötschlauch (Teil der Werkstatt)"
},
"allowed_credentials": [
"club-assistant"
]
},
{
"sensor_data": {
"unit": "%",
"location": "Innenhof",
"description": "Sensor im Innenhof (erreichbar durch das Flurfenster)"
},
"allowed_credentials": [
"club-assistant"
]
}
]
},
"state": {
"open": {
"allowed_credentials": [
"dooris-hauptraum"
]
}
}
}
}

View file

@ -0,0 +1,44 @@
{
"response": {
"api_compatibility": [
"14"
],
"space": "CCCHH",
"logo": "https://next.hamburg.ccc.de/images/logo.svg",
"ext_ccc": "erfa",
"url": "https://hamburg.ccc.de/",
"location": {
"address": "Zeiseweg 9, 22765 Hamburg, Germany",
"lon": 9.9445899999999998,
"lat": 53.55836
},
"contact": {
"phone": "+49 40 23830150",
"irc": "ircs://irc.hackint.org:6697/#ccchh",
"mastodon": "@ccchh@chaos.social",
"email": "mail@hamburg.ccc.de",
"ml": "talk@hamburg.ccc.de",
"matrix": "#ccchh:hamburg.ccc.de"
},
"feeds": {
"blog": {
"type": "application/atom+xml",
"url": "https://hamburg.ccc.de/feed.xml"
},
"calendar": {
"type": "ical",
"url": "webcal://cloud.hamburg.ccc.de/remote.php/dav/public-calendars/QJAdExziSnNJEz5g/?export"
}
},
"links": [
{
"name": "Wiki",
"url": "https://wiki.ccchh.net"
},
{
"name": "GitLab",
"url": "https://gitlab.hamburg.ccc.de"
}
]
}
}

View file

@ -2,9 +2,9 @@
let let
spaceapidSrc = builtins.fetchGit { spaceapidSrc = builtins.fetchGit {
url = "https://gitlab.hamburg.ccc.de/ccchh/spaceapid.git"; url = "https://git.hamburg.ccc.de/CCCHH/spaceapid.git";
ref = "main"; ref = "main";
rev = "baf73f33e7e8ef763869a1677ebf5cd2f334d897"; rev = "42a012239fc7004c120a74c555a48202f5775bac";
}; };
spaceapid = pkgs.buildGoModule { spaceapid = pkgs.buildGoModule {
pname = "spaceapid"; pname = "spaceapid";
@ -16,6 +16,8 @@ let
# use the nonexistend vendored dependencies. # use the nonexistend vendored dependencies.
vendorHash = null; vendorHash = null;
}; };
spaceapidConfigResponse = pkgs.writeText "spaceapid-config-ccchh-response.json" (builtins.readFile spaceapid-config/ccchh-response.json);
spaceapidConfigDynamic = pkgs.writeText "spaceapid-config-ccchh-dynamic.json" (builtins.readFile spaceapid-config/ccchh-dynamic.json);
in in
{ {
users.users.spaceapi = { users.users.spaceapi = {
@ -32,20 +34,18 @@ in
After = [ "network.target" "network-online.target" ]; After = [ "network.target" "network-online.target" ];
}; };
serviceConfig = { serviceConfig = {
ExecStart = "${spaceapid}/bin/spaceapid"; ExecStart = "${spaceapid}/bin/spaceapid -c ${spaceapidConfigResponse},${spaceapidConfigDynamic},/secrets/spaceapid-config-ccchh-credentials.secret";
User = "spaceapi"; User = "spaceapi";
Group = "spaceapi"; Group = "spaceapi";
Restart = "on-failure"; Restart = "on-failure";
Environment = "BA_USERNAME=dooris JSON_TEMPLATE_PATH=${spaceapidSrc}/ccchh-template.json";
EnvironmentFile = "/secrets/spaceapid-environment-secrets.secret";
StateDirectory = "spaceapid"; StateDirectory = "spaceapid";
}; };
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
}; };
deployment.keys = { deployment.keys = {
"spaceapid-environment-secrets.secret" = { "spaceapid-config-ccchh-credentials.secret" = {
keyCommand = [ "pass" "noc/vm-secrets/chaosknoten/public-web-static/spaceapid-environment-secrets" ]; keyCommand = [ "pass" "noc/vm-secrets/chaosknoten/public-web-static/spaceapid-config-ccchh-credentials" ];
destDir = "/secrets"; destDir = "/secrets";
user = "spaceapi"; user = "spaceapi";
group = "spaceapi"; group = "spaceapi";