doti3/bar/src/3dprinter.php
2022-09-26 12:11:24 +02:00

28 lines
598 B
PHP
Executable file

#!/usr/bin/env php
<?php
require __DIR__.'/base/block.php';
$blockName = $argv[1];
$telemetry = $argv[2];
$content = json_decode(@file_get_contents($telemetry), true);
if (empty($content)) {
die;
}
$fullText =
span(sprintf(' %d%%', $content['progress']), '#6bffa6', '#333')
.span(sprintf(' %d°', $content['temp_nozzle']), '#ff946a', '#333')
.span(sprintf(' %d°', $content['temp_bed']), '#66caff', '#333')
.span(sprintf(' %s ', date('H:i', $content['time_est'] + time())), '#d5d5d5', '#333')
;
echo block(
$blockName,
[
'full_text' => $fullText,
]
);