initial commit
This commit is contained in:
commit
afb4290b11
7 changed files with 1592 additions and 0 deletions
7
node.json
Normal file
7
node.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "AfRA status",
|
||||
"permissions": {
|
||||
"network": "Needs to fetch afra open/close state"
|
||||
},
|
||||
"options": []
|
||||
}
|
1
node.lua
Normal file
1
node.lua
Normal file
|
@ -0,0 +1 @@
|
|||
-- unused
|
10
package.json
Normal file
10
package.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "AfRA status power switcher",
|
||||
"author": "kunsi",
|
||||
"desc": "switches display power according to space status",
|
||||
"platforms": ["pi/epoch-1", "pi/epoch-2"],
|
||||
"offline": {
|
||||
"support": "no",
|
||||
"info": "Needs to fetch space status"
|
||||
}
|
||||
}
|
BIN
package.png
Normal file
BIN
package.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
159
pinguin-afra-export.svg
Normal file
159
pinguin-afra-export.svg
Normal file
|
@ -0,0 +1,159 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
width="65.222176mm"
|
||||
height="65.222176mm"
|
||||
id="svg4084"
|
||||
sodipodi:docname="pinguin-afra-export.svg"
|
||||
inkscape:export-filename="package.png"
|
||||
inkscape:export-xdpi="24.92404"
|
||||
inkscape:export-ydpi="24.92404"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25, custom)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
showgrid="false"
|
||||
inkscape:zoom="3.5414585"
|
||||
inkscape:cx="119.15994"
|
||||
inkscape:cy="123.2543"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1061"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="19"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4084"
|
||||
inkscape:document-units="mm" />
|
||||
<defs
|
||||
id="defs4086" />
|
||||
<metadata
|
||||
id="metadata4089">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(-335.89983,-409.73033)"
|
||||
id="layer1">
|
||||
<path
|
||||
d="m 477.47435,591.06022 c 1.03564,1.14665 -4.2669,3.88794 -2.09339,8.16053 2.30385,4.52881 3.27404,9.31066 3.03539,10.55207 -0.21041,1.09471 -1.37583,0.65717 -1.40927,-0.15131 -0.24932,-6.02827 -5.31188,-8.60357 -3.74472,0.76842 0.0724,0.43302 -1.09439,0.625 -1.38745,-0.31511 -1.91815,-6.15337 -3.94437,-5.35888 -4.17007,-0.50439 -0.045,0.97137 -1.05093,0.85453 -1.12089,0.16627 -0.35853,-3.52779 -0.40911,-6.17315 0.21295,-9.29276 0.59577,-2.98821 -3.9468,-5.06576 -3.41714,-8.0553 z"
|
||||
id="path3227"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;stroke:#000000;stroke-width:0.407405;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 460.16131,592.05145 c -0.18696,4.36924 -2.97264,6.66085 -2.03172,9.12765 1.27518,3.34286 1.26204,5.49821 0.97826,8.55984 -0.0688,0.74237 -1.27879,0.32176 -1.28891,-0.19684 -0.1573,-8.05601 -3.68356,-6.3772 -2.62262,-0.009 0.14855,0.89111 -0.94975,1.01255 -1.02906,0.33563 -0.66124,-5.64416 -4.25963,-10.23611 -4.50089,0.71824 -0.0138,0.62544 -0.91024,1.03937 -1.16125,0.0803 -0.95872,-3.66341 -1.12049,-4.11282 -0.4394,-9.37153 0.36326,-2.80475 0.97957,-4.00462 -1.78471,-7.52177 z"
|
||||
id="path3229"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;stroke:#000000;stroke-width:0.407405;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 447.58375,593.41283 c -36.99971,-30.94158 -29.88029,-74.31101 -10.45316,-114.40393 0.23695,-6.11777 0.8531,-37.49783 17.13157,-37.45713 18.94526,0.0473 18.15858,27.16912 18.80329,39.48968 13.67868,18.30317 39.48972,79.22617 1.02319,111.52511 -2.83786,4.26733 -4.43949,1.81152 -8.94036,1.40495 -0.6551,0.0481 -2.95767,-13.49018 -4.32247,-13.46445 -1.38379,0.026 -1.82999,13.6159 -2.49862,13.62147 -4.28278,1.61402 -8.22284,1.22316 -10.74344,-0.71577 z"
|
||||
id="path3178"
|
||||
style="fill:#ffffff;stroke:none" />
|
||||
<path
|
||||
d="m 463.66388,446.31723 c 0,0 -3.76279,-12.72876 -5.23563,-19.55666 -0.4592,-2.12878 0.0915,-5.68232 -1.84789,-6.67288 -0.65432,-0.3342 -1.8031,0.54589 -2.30983,1.07792 -0.90357,0.94865 -1.7813,3.35382 -2.30985,5.38964 -1.79593,6.91728 -3.4168,7.1666 -5.03033,21.40452 4.57913,-0.0777 14.42365,-1.15588 16.73353,-1.64254 z"
|
||||
id="path4005"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffd42a;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:2.85184;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 437.691,479.88692 c 8.60315,-8.01004 11.70319,-1.93484 17.55478,-2.66914 6.44755,-0.74025 11.7547,-1.95122 17.04151,4.72234 l 0.10257,-18.47875 -32.85108,-2.97712 z"
|
||||
id="path3875"
|
||||
style="fill:#ffd42a;stroke:none" />
|
||||
<path
|
||||
d="m 438.25562,475.16458 c 0,0 1.34644,-12.45779 4.15772,-12.11384 4.84072,0.59223 4.09651,14.54528 11.85719,14.42367 10.25309,-0.16074 9.39344,-13.90558 14.11569,-14.11569 2.00583,-0.0892 4.05506,4.00372 4.05506,4.00372 -6.97269,-44.65864 -38.43137,-23.36144 -34.18566,7.80214 z"
|
||||
id="path4024"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;stroke:#000000;stroke-width:0.407025;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 457.96432,594.21133 2.71384,-15.3593 5.51121,15.29531 c -1.19251,-4.12365 -0.9715,-8.35206 -0.69429,-14.69935 5.3592,-5.51347 3.746,-4.30933 6.54259,-9.4599 -9.52275,7.96699 -14.3663,5.326 -21.46052,-0.15385 2.82559,3.13044 5.05091,7.69609 5.42719,9.5684 2.22481,5.28833 2.76119,10.08769 1.95998,14.80863 z"
|
||||
id="path4032"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#000000;stroke:#000000;stroke-width:0.407405;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<g
|
||||
transform="matrix(2.2995761,0,0,2.2995761,-428.44845,-564.74012)"
|
||||
id="g3964"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#800000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;enable-background:accumulate">
|
||||
<path
|
||||
d="m 355.16199,522.02066 h 3.69112 l -1.38533,-4.49072 c -0.0433,-0.13638 -0.10235,-0.35638 -0.17661,-0.66011 -0.0743,-0.30371 -0.17042,-0.69423 -0.28821,-1.1715 -0.0807,0.33472 -0.16114,0.65393 -0.24173,0.95764 -0.0743,0.30373 -0.15186,0.59506 -0.23254,0.87397 l -1.36675,4.49072 m -5.19731,5.08576 4.69526,-13.61161 h 4.64876 l 4.70455,13.61161 h -3.69112 l -0.68801,-2.43596 h -5.2717 l -0.70662,2.43596 h -3.69112"
|
||||
id="path3937"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:8px;line-height:125%;font-family:'Futura Md BT';-inkscape-font-specification:'Futura Md BT Bold';letter-spacing:0px;word-spacing:0px;display:inline;overflow:visible;visibility:visible;fill:#800000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 373.3573,527.10642 v -13.61161 h 8.33991 v 2.9845 h -4.72314 v 2.36158 h 4.45351 v 2.91943 h -4.45351 v 5.3461 h -3.61677"
|
||||
id="path3939"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:8px;line-height:125%;font-family:'Futura Md BT';-inkscape-font-specification:'Futura Md BT Bold';letter-spacing:0px;word-spacing:0px;display:inline;overflow:visible;visibility:visible;fill:#800000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 392.66834,527.10642 v -13.61161 h 3.87709 c 1.51857,0 2.57539,0.0712 3.17046,0.21374 0.60123,0.13639 1.1188,0.36884 1.55268,0.69732 0.48967,0.37193 0.86467,0.84608 1.12501,1.42254 0.26651,0.57645 0.39977,1.21179 0.3998,1.90599 -3e-5,1.05372 -0.26035,1.9122 -0.78101,2.57542 -0.51447,0.65702 -1.26756,1.09402 -2.2593,1.31095 l 3.70973,5.48555 h -4.19319 l -3.12398,-5.32749 v 5.32749 h -3.47729 m 3.47729,-7.17771 h 0.68801 c 0.79957,2e-5 1.38224,-0.13639 1.74793,-0.40908 0.3719,-0.27272 0.55786,-0.70042 0.55786,-1.28306 0,-0.68182 -0.17351,-1.16528 -0.52066,-1.45043 -0.34091,-0.29131 -0.91736,-0.43697 -1.72934,-0.43697 h -0.7438 v 3.57954"
|
||||
id="path3941"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:8px;line-height:125%;font-family:'Futura Md BT';-inkscape-font-specification:'Futura Md BT Bold';letter-spacing:0px;word-spacing:0px;display:inline;overflow:visible;visibility:visible;fill:#800000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 416.77679,522.02066 h 3.69113 l -1.38534,-4.49072 c -0.0433,-0.13638 -0.10234,-0.35638 -0.1766,-0.66011 -0.0743,-0.30371 -0.17042,-0.69423 -0.28822,-1.1715 -0.0807,0.33472 -0.16114,0.65393 -0.24175,0.95764 -0.0743,0.30373 -0.15186,0.59506 -0.23231,0.87397 l -1.36674,4.49072 m -5.19734,5.08576 4.69527,-13.61161 h 4.64878 l 4.70455,13.61161 h -3.69112 l -0.68804,-2.43596 h -5.27169 l -0.70661,2.43596 h -3.69114"
|
||||
id="path3943"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:8px;line-height:125%;font-family:'Futura Md BT';-inkscape-font-specification:'Futura Md BT Bold';letter-spacing:0px;word-spacing:0px;display:inline;overflow:visible;visibility:visible;fill:#800000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;enable-background:accumulate" />
|
||||
</g>
|
||||
<path
|
||||
d="m 447.58375,593.41283 c -17.53572,-15.93224 -24.9816,-34.60353 -25.75857,-53.9908 -0.80634,-20.12034 5.57008,-41.01183 15.30541,-60.41313 0.23695,-6.11777 0.8531,-37.49783 17.13157,-37.45713 18.94526,0.0473 18.15858,27.16912 18.80329,39.48968 13.49356,18.14891 40.24794,78.10675 3.41319,110.02115 -2.83786,4.26731 -6.82949,3.31548 -11.33036,2.90891 -0.6551,0.0481 -2.95767,-13.49018 -4.32247,-13.46445 -1.38379,0.026 -1.82999,13.6159 -2.49862,13.62147 -4.28278,1.61402 -8.22284,1.22316 -10.74344,-0.71577 z"
|
||||
id="path3178-8"
|
||||
style="fill:none;stroke:#000000;stroke-width:3.28588;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
d="m 473.28108,484.81621 c 22.74776,-15.7033 45.89193,-21.05968 81.01237,-8.93776 -0.68723,2.21704 -1.92314,5.58551 -3.62958,7.54949 -19.75237,1.25504 -32.44514,7.12546 -55.31502,15.76136 -1.92111,-3.06189 -8.84831,-5.62302 -15.38936,-3.19402"
|
||||
id="path3180"
|
||||
style="fill:#ffffff;stroke:none" />
|
||||
<path
|
||||
d="m 485.18606,513.41719 c 30.38706,-8.2971 58.53056,-7.07961 78.86113,10.9249 0.17063,2.51166 -3.5574,5.92005 -5.66213,6.82357 -13.88187,-3.65487 -49.48444,-2.38645 -58.24518,-0.90727 -0.97438,-2.23721 -8.08853,-2.5543 -12.92125,-1.59701"
|
||||
id="path3182"
|
||||
style="fill:#ffffff;stroke:none" />
|
||||
<path
|
||||
d="m 488.30221,544.35721 c 28.99858,3.19917 49.81275,-2.12231 63.36968,25.4099 1.77587,3.60654 -3.23539,5.77761 -6.05693,3.69574 -14.16435,-10.45114 -29.69746,-6.83998 -43.76169,-6.8285 -2.89103,-4.0359 -8.59034,-6.90183 -15.19362,-9.03407"
|
||||
id="path3195"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;stroke:none;stroke-width:2.95696;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 436.93936,485.10658 c -0.78116,-0.47104 -1.56212,-0.92494 -2.3426,-1.36199 -36.21887,-20.28263 -71.39724,-4.37511 -77.06346,9.90924 10.63556,0.0897 40.84498,-1.18414 53.70874,7.56804 7.15856,-0.39925 11.32424,-0.29039 11.32424,-0.29039 4.8074,-4.49022 8.27603,-1.77527 10.0176,-0.43554"
|
||||
id="path3203"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;stroke:none;stroke-width:2.95696;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 432.72907,508.19062 c -5.88753,6.06309 -10.64993,3.49435 -15.38936,3.91993 -51.53272,-1.79521 -56.09752,3.58522 -71.41136,18.39274 l 2.75848,3.33922 c 26.27181,0.0138 40.82619,-0.14809 58.63526,0.33581 7.69128,-2.35056 10.41407,-5.80524 14.95382,-8.85613 4.29664,-0.0338 8.00765,0.45308 8.85615,3.48436"
|
||||
id="path3211"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;stroke:none;stroke-width:2.95696;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 425.57061,538.09495 c 0,0 -9.61467,3.64 -13.85907,4.1064 -15.87064,1.744 -45.77593,13.44284 -44.71102,37.86926 10.64046,-4.13753 15.15839,-5.93026 25.17964,-9.52786 6.16418,-2.2129 12.32872,-2.67774 16.9649,-4.62702 3.93262,-2.38884 6.77772,-6.1323 8.52075,-10.16332 3.25271,-2.33425 5.89552,-2.22886 8.62341,-2.46384"
|
||||
id="path3219"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;stroke:none;stroke-width:2.95696;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 474.90608,484.19121 c 22.74776,-15.7033 44.26693,-20.43468 79.38737,-8.31276 -0.68723,2.21704 -1.92314,5.58551 -3.62958,7.54949 -19.75237,1.25504 -32.44514,7.12546 -55.31502,15.76136 -1.92111,-3.06189 -9.09831,-5.24802 -13.76436,-3.44402"
|
||||
id="path3180-0"
|
||||
style="fill:#ffffff;stroke:#000000;stroke-width:2.95696;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
d="m 487.58078,512.71663 c 28.79419,-7.0755 57.06343,-5.55759 76.46641,11.62546 0.17063,2.51166 -3.5574,5.92005 -5.66213,6.82357 -13.88187,-3.65487 -49.48444,-2.38645 -58.24518,-0.90727 -0.70825,-1.62617 -3.41041,-1.98785 -7.37242,-1.83304"
|
||||
id="path3182-1"
|
||||
style="fill:#ffffff;stroke:#000000;stroke-width:2.95696;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
d="m 494.00555,545.03305 c 26.36601,2.19478 44.91425,-1.16364 57.66634,24.73406 1.77587,3.60654 -3.23539,5.77761 -6.05693,3.69574 -14.16435,-10.45114 -29.69746,-6.83998 -43.76169,-6.8285 -1.75576,-2.45105 -4.54728,-4.47058 -7.94803,-6.15632"
|
||||
id="path3195-0"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;stroke:#000000;stroke-width:2.95696;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 435.06439,483.8368 c -0.46537,-0.27246 -0.003,0.16823 -0.46763,-0.0922 -36.21927,-20.28192 -71.39724,-4.37511 -77.06346,9.90924 10.63556,0.0897 40.84498,-1.18414 53.70874,7.56804 7.15856,-0.39925 11.32424,-0.29039 11.32424,-0.29039 3.32066,-3.10157 6.00257,-2.76541 7.91775,-1.81931"
|
||||
id="path3203-3"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;stroke:#000000;stroke-width:2.95696;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 425.79154,512.129 c -2.96673,0.48956 -5.71311,-0.26437 -8.45183,-0.0185 -51.53272,-1.79521 -56.09752,3.58522 -71.41136,18.39274 l 2.75848,3.33922 c 26.27181,0.0138 40.82619,-0.14809 58.63526,0.33581 7.69128,-2.35056 10.41407,-5.80524 14.95382,-8.85613 1.19907,-0.009 2.81435,-0.0443 3.47689,0.5002"
|
||||
id="path3211-8"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;stroke:#000000;stroke-width:2.95696;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
d="m 423.1848,538.96274 c -3.12947,1.10748 -8.56341,2.91886 -11.47326,3.23861 -15.87064,1.74396 -45.77593,13.44284 -44.71102,37.86926 10.64046,-4.13753 15.15839,-5.93026 25.17964,-9.52786 6.16418,-2.2129 12.32872,-2.67774 16.9649,-4.62702 3.93262,-2.38884 6.77772,-6.1323 8.52075,-10.16332 2.63521,-1.89111 4.87011,-2.18095 7.07425,-2.34779"
|
||||
id="path3219-8"
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;stroke:#000000;stroke-width:2.95696;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 16 KiB |
41
service
Normal file
41
service
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
from time import sleep
|
||||
|
||||
from pytz import utc
|
||||
from requests import get
|
||||
|
||||
from hosted import device
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
log = logging.getLogger("afra-status")
|
||||
|
||||
last_open = datetime.now(utc)
|
||||
|
||||
while True:
|
||||
try:
|
||||
r = get("https://spaceapi.afra-berlin.de/v1/status.json")
|
||||
r.raise_for_status()
|
||||
status = r.json()
|
||||
except Exception as e:
|
||||
log.exception("error while fetching status")
|
||||
status = {
|
||||
"state": {
|
||||
"open": None,
|
||||
},
|
||||
}
|
||||
|
||||
try:
|
||||
if status["state"]["open"]:
|
||||
last_open = datetime.now(utc)
|
||||
except KeyError:
|
||||
log.exception("open status was not in state json")
|
||||
|
||||
if datetime.now(utc) - last_open > timedelta(minutes=2):
|
||||
device.screen(on=False)
|
||||
else:
|
||||
device.screen(on=True)
|
||||
|
||||
sleep(30)
|
Loading…
Reference in a new issue