@NUT_UPSSTATS_TEMPLATE single@
<!-- upsstats template file -->

<!--
	This is upsstats-modern-single.html, a custom template for monitoring a
	single host. This mode is selected by adding "host=<host>" to the
	upsstats.cgi URL.

	Such URLs are generated automatically when using the HOSTLINK
	command.

	See upsstats.html(5) for more information on template files.
-->

<!-- change this to TEMPF if you don't like Celsius. -->

@TEMPC@

<!-- Note: on Windows you may have to use the `*.cgi.exe` in PATHs below -->

@UPSSTATSPATH upsstats.cgi@
@UPSIMAGEPATH upsimage.cgi@

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@REFRESH@
<title>@HOSTDESC@ : @VAR ups.model@</title>
<style>
:root {
  --bg: #0f172a; --card: #1e293b; --text: #f8fafc;
  --dim: #94a3b8; --green: #4ade80; --border: #334155;
  --accent: #38bdf8; --warn: #fbbf24; --crit: #ef4444;

@IFEQ upsstats.use_celsius 1@
  --x-nut-temperature-mode: "default-C";
  --x-nut-temperature-nominal:  30;
  --x-nut-temperature-graphmin: 0;
  --x-nut-temperature-graphmax: 65;
@ELSE@
  --x-nut-temperature-mode: "default-F";
  --x-nut-temperature-nominal:  86;
  --x-nut-temperature-graphmin: 32;
  --x-nut-temperature-graphmax: 150;
@ENDIF@

@IFSUPP battery.voltage.nominal@
  --x-nut-battery-voltage-mode: "nominal";
  --x-nut-battery-voltage-nominal: @VAR battery.voltage.nominal@;
  --x-nut-battery-voltage-graphmin: round(down, calc(var(--x-nut-battery-voltage-nominal) * 0.8), 0.1);
  --x-nut-battery-voltage-graphmax: round(up, calc(var(--x-nut-battery-voltage-nominal) * 1.2), 0.1);

@ELSE@

@IFSUPP battery.voltage@
@IFBETWEEN 0 1.75 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-0-1.75-AAA";
  --x-nut-battery-voltage-nominal: 1.5;
  --x-nut-battery-voltage-graphmin: 0;
  --x-nut-battery-voltage-graphmax: 3;
@ELSE@
@IFSUPP battery.voltage@
@IFBETWEEN 1.75 2.3 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-1.75-2.3-PbAc-#1";
  --x-nut-battery-voltage-nominal: 2.0;
  --x-nut-battery-voltage-graphmin: 0;
  --x-nut-battery-voltage-graphmax: 3;
@ELSE@
@IFSUPP battery.voltage@
@IFBETWEEN 2.3 3.8 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-2.3-3.8-CR2032";
  --x-nut-battery-voltage-nominal: 3.0;
  --x-nut-battery-voltage-graphmin: 0;
  --x-nut-battery-voltage-graphmax: 5;
@ELSE@
@IFSUPP battery.voltage@
@IFBETWEEN 3.8 5.5 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-3.8-5.5-Li";
  --x-nut-battery-voltage-nominal: 4.2;
  --x-nut-battery-voltage-graphmin: 0;
  --x-nut-battery-voltage-graphmax: 7;
@ELSE@
@IFSUPP battery.voltage@
@IFBETWEEN 5.5 9.9 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-5.5-9.9-D";
  --x-nut-battery-voltage-nominal: 9.0;
  --x-nut-battery-voltage-graphmin: 0;
  --x-nut-battery-voltage-graphmax: 12;
@ELSE@
@IFSUPP battery.voltage@
@IFBETWEEN 9.9 18 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-9.9-18.0-PbAc#6";
  --x-nut-battery-voltage-nominal: 12.0;
  --x-nut-battery-voltage-graphmin: 9;
  --x-nut-battery-voltage-graphmax: 18;
@ELSE@
@IFSUPP battery.voltage@
@IFBETWEEN 18 30 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-18-30-PbAc#12";
  --x-nut-battery-voltage-nominal: 24.0;
  --x-nut-battery-voltage-graphmin: 18;
  --x-nut-battery-voltage-graphmax: 30;
@ELSE@
@IFSUPP battery.voltage@
@IFBETWEEN 30 42 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-18-30-PbAc#18";
  --x-nut-battery-voltage-nominal: 36.0;
  --x-nut-battery-voltage-graphmin: 30;
  --x-nut-battery-voltage-graphmax: 42;
@ELSE@
@IFSUPP battery.voltage@
@IFBETWEEN 42 54 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-18-30-PbAc#24";
  --x-nut-battery-voltage-nominal: 48.0;
  --x-nut-battery-voltage-graphmin: 42;
  --x-nut-battery-voltage-graphmax: 54;
@ELSE@
@IFSUPP battery.voltage@
@IFBETWEEN 54 66 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-18-30-PbAc#30";
  --x-nut-battery-voltage-nominal: 60.0;
  --x-nut-battery-voltage-graphmin: 54;
  --x-nut-battery-voltage-graphmax: 66;
@ELSE@
@IFSUPP battery.voltage@
@IFBETWEEN 66 78 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-18-30-PbAc#36";
  --x-nut-battery-voltage-nominal: 72.0;
  --x-nut-battery-voltage-graphmin: 66;
  --x-nut-battery-voltage-graphmax: 78;
@ELSE@
@IFSUPP battery.voltage@
@IFBETWEEN 78 90 battery.voltage@
  --x-nut-battery-voltage-mode: "battery-18-30-PbAc#42";
  --x-nut-battery-voltage-nominal: 84.0;
  --x-nut-battery-voltage-graphmin: 78;
  --x-nut-battery-voltage-graphmax: 90;
@ELSE@
  --x-nut-battery-voltage-mode: "battery-default";
  --x-nut-battery-voltage-nominal:  12;
  --x-nut-battery-voltage-graphmin: 0;
  --x-nut-battery-voltage-graphmax: 100;
@ENDIF@

@IFSUPP input.L2-L3.voltage@
@IFBETWEEN 90 160 input.L2-L3.voltage@
  --x-nut-input-L2-L3-voltage-nominal: 120;
  --x-nut-input-L2-L3-voltage-graphmin: 90;
  --x-nut-input-L2-L3-voltage-graphmax: 160;
@ELSE@
@IFSUPP input.L2-L3.voltage@
@IFBETWEEN 160 280 input.L2-L3.voltage@
  --x-nut-input-L2-L3-voltage-nominal: 240;
  --x-nut-input-L2-L3-voltage-graphmin: 160;
  --x-nut-input-L2-L3-voltage-graphmax: 280;
@ELSE@
@IFSUPP input.L2-L3.voltage@
@IFBETWEEN 280 500 input.L2-L3.voltage@
  --x-nut-input-L2-L3-voltage-nominal: 400;
  --x-nut-input-L2-L3-voltage-graphmin: 280;
  --x-nut-input-L2-L3-voltage-graphmax: 500;
@ELSE@
  --x-nut-input-L2-L3-voltage-nominal:  240;
  --x-nut-input-L2-L3-voltage-graphmin: 0;
  --x-nut-input-L2-L3-voltage-graphmax: 500;
@ENDIF@

@IFSUPP input.L1-L2.voltage@
@IFBETWEEN 90 160 input.L1-L2.voltage@
  --x-nut-input-L1-L2-voltage-nominal: 120;
  --x-nut-input-L1-L2-voltage-graphmin: 90;
  --x-nut-input-L1-L2-voltage-graphmax: 160;
@ELSE@
@IFSUPP input.L1-L2.voltage@
@IFBETWEEN 160 280 input.L1-L2.voltage@
  --x-nut-input-L1-L2-voltage-nominal: 240;
  --x-nut-input-L1-L2-voltage-graphmin: 160;
  --x-nut-input-L1-L2-voltage-graphmax: 280;
@ELSE@
@IFSUPP input.L1-L2.voltage@
@IFBETWEEN 280 500 input.L1-L2.voltage@
  --x-nut-input-L1-L2-voltage-nominal: 400;
  --x-nut-input-L1-L2-voltage-graphmin: 280;
  --x-nut-input-L1-L2-voltage-graphmax: 500;
@ELSE@
@IFSUPP input.L1-L2.voltage@
  --x-nut-input-L1-L2-voltage-nominal:  240;
  --x-nut-input-L1-L2-voltage-graphmin: 0;
  --x-nut-input-L1-L2-voltage-graphmax: 500;
@ELSE@
  --x-nut-input-L1-L2-voltage-nominal:  var(--x-nut-input-L2-L3-voltage-nominal);
  --x-nut-input-L1-L2-voltage-graphmin: var(--x-nut-input-L2-L3-voltage-graphmin);
  --x-nut-input-L1-L2-voltage-graphmax: var(--x-nut-input-L2-L3-voltage-graphmax);
@ENDIF@

@IFSUPP input.L3-L1.voltage@
@IFBETWEEN 90 160 input.L3-L1.voltage@
  --x-nut-input-L3-L1-voltage-nominal: 120;
  --x-nut-input-L3-L1-voltage-graphmin: 90;
  --x-nut-input-L3-L1-voltage-graphmax: 160;
@ELSE@
@IFSUPP input.L3-L1.voltage@
@IFBETWEEN 160 280 input.L3-L1.voltage@
  --x-nut-input-L3-L1-voltage-nominal: 240;
  --x-nut-input-L3-L1-voltage-graphmin: 160;
  --x-nut-input-L3-L1-voltage-graphmax: 280;
@ELSE@
@IFSUPP input.L3-L1.voltage@
@IFBETWEEN 280 500 input.L3-L1.voltage@
  --x-nut-input-L3-L1-voltage-nominal: 400;
  --x-nut-input-L3-L1-voltage-graphmin: 280;
  --x-nut-input-L3-L1-voltage-graphmax: 500;
@ELSE@
@IFSUPP input.L3-L1.voltage@
  --x-nut-input-L3-L1-voltage-nominal:  240;
  --x-nut-input-L3-L1-voltage-graphmin: 0;
  --x-nut-input-L3-L1-voltage-graphmax: 500;
@ELSE@
  --x-nut-input-L3-L1-voltage-nominal:  var(--x-nut-input-L2-L3-voltage-nominal);
  --x-nut-input-L3-L1-voltage-graphmin: var(--x-nut-input-L2-L3-voltage-graphmin);
  --x-nut-input-L3-L1-voltage-graphmax: var(--x-nut-input-L2-L3-voltage-graphmax);
@ENDIF@


@IFSUPP input.L2-N.voltage@
@IFBETWEEN 90 160 input.L2-N.voltage@
  --x-nut-input-L2-N-voltage-nominal: 120;
  --x-nut-input-L2-N-voltage-graphmin: 90;
  --x-nut-input-L2-N-voltage-graphmax: 160;
@ELSE@
@IFSUPP input.L2-N.voltage@
@IFBETWEEN 160 280 input.L2-N.voltage@
  --x-nut-input-L2-N-voltage-nominal: 240;
  --x-nut-input-L2-N-voltage-graphmin: 160;
  --x-nut-input-L2-N-voltage-graphmax: 280;
@ELSE@
@IFSUPP input.L2-N.voltage@
@IFBETWEEN 280 500 input.L2-N.voltage@
  --x-nut-input-L2-N-voltage-nominal: 400;
  --x-nut-input-L2-N-voltage-graphmin: 280;
  --x-nut-input-L2-N-voltage-graphmax: 500;
@ELSE@
  --x-nut-input-L2-N-voltage-nominal:  240;
  --x-nut-input-L2-N-voltage-graphmin: 0;
  --x-nut-input-L2-N-voltage-graphmax: 500;
@ENDIF@

@IFSUPP input.L1-N.voltage@
@IFBETWEEN 90 160 input.L1-N.voltage@
  --x-nut-input-L1-N-voltage-nominal: 120;
  --x-nut-input-L1-N-voltage-graphmin: 90;
  --x-nut-input-L1-N-voltage-graphmax: 160;
@ELSE@
@IFSUPP input.L1-N.voltage@
@IFBETWEEN 160 280 input.L1-N.voltage@
  --x-nut-input-L1-N-voltage-nominal: 240;
  --x-nut-input-L1-N-voltage-graphmin: 160;
  --x-nut-input-L1-N-voltage-graphmax: 280;
@ELSE@
@IFSUPP input.L1-N.voltage@
@IFBETWEEN 280 500 input.L1-N.voltage@
  --x-nut-input-L1-N-voltage-nominal: 400;
  --x-nut-input-L1-N-voltage-graphmin: 280;
  --x-nut-input-L1-N-voltage-graphmax: 500;
@ELSE@
@IFSUPP input.L1-N.voltage@
  --x-nut-input-L1-N-voltage-nominal:  240;
  --x-nut-input-L1-N-voltage-graphmin: 0;
  --x-nut-input-L1-N-voltage-graphmax: 500;
@ELSE@
  --x-nut-input-L1-N-voltage-nominal:  var(--x-nut-input-L2-N-voltage-nominal);
  --x-nut-input-L1-N-voltage-graphmin: var(--x-nut-input-L2-N-voltage-graphmin);
  --x-nut-input-L1-N-voltage-graphmax: var(--x-nut-input-L2-N-voltage-graphmax);
@ENDIF@

@IFSUPP input.L3-N.voltage@
@IFBETWEEN 90 160 input.L3-N.voltage@
  --x-nut-input-L3-N-voltage-nominal: 120;
  --x-nut-input-L3-N-voltage-graphmin: 90;
  --x-nut-input-L3-N-voltage-graphmax: 160;
@ELSE@
@IFSUPP input.L3-N.voltage@
@IFBETWEEN 160 280 input.L3-N.voltage@
  --x-nut-input-L3-N-voltage-nominal: 240;
  --x-nut-input-L3-N-voltage-graphmin: 160;
  --x-nut-input-L3-N-voltage-graphmax: 280;
@ELSE@
@IFSUPP input.L3-N.voltage@
@IFBETWEEN 280 500 input.L3-N.voltage@
  --x-nut-input-L3-N-voltage-nominal: 400;
  --x-nut-input-L3-N-voltage-graphmin: 280;
  --x-nut-input-L3-N-voltage-graphmax: 500;
@ELSE@
@IFSUPP input.L3-N.voltage@
  --x-nut-input-L3-N-voltage-nominal:  240;
  --x-nut-input-L3-N-voltage-graphmin: 0;
  --x-nut-input-L3-N-voltage-graphmax: 500;
@ELSE@
  --x-nut-input-L3-N-voltage-nominal:  var(--x-nut-input-L2-N-voltage-nominal);
  --x-nut-input-L3-N-voltage-graphmin: var(--x-nut-input-L2-N-voltage-graphmin);
  --x-nut-input-L3-N-voltage-graphmax: var(--x-nut-input-L2-N-voltage-graphmax);
@ENDIF@


@IFSUPP input.L2-L3.voltage@
  --x-nut-input-voltage-mode: "L2-L3";
  --x-nut-input-voltage-nominal:  calc( (var(--x-nut-input-L3-L1-voltage-nominal) + var(--x-nut-input-L2-L3-voltage-nominal) + var(--x-nut-input-L1-L2-voltage-nominal)) / 3);
  --x-nut-input-voltage-graphmin: min(var(--x-nut-input-L3-L1-voltage-graphmin), var(--x-nut-input-L2-L3-voltage-graphmin), var(--x-nut-input-L1-L2-voltage-graphmin));
  --x-nut-input-voltage-graphmax: max(var(--x-nut-input-L3-L1-voltage-graphmax), var(--x-nut-input-L2-L3-voltage-graphmax), var(--x-nut-input-L1-L2-voltage-graphmax));

@ELSE@

@IFSUPP input.L2-N.voltage@
  --x-nut-input-voltage-mode: "L2-N";
  --x-nut-input-voltage-nominal:  calc( (var(--x-nut-input-L3-N-voltage-nominal) + var(--x-nut-input-L2-N-voltage-nominal) + var(--x-nut-input-L1-N-voltage-nominal)) / 3);
  --x-nut-input-voltage-graphmin: min(var(--x-nut-input-L3-N-voltage-graphmin), var(--x-nut-input-L2-N-voltage-graphmin), var(--x-nut-input-L1-N-voltage-graphmin));
  --x-nut-input-voltage-graphmax: max(var(--x-nut-input-L3-N-voltage-graphmax), var(--x-nut-input-L2-N-voltage-graphmax), var(--x-nut-input-L1-N-voltage-graphmax));

@ELSE@

@IFSUPP input.voltage.nominal@
  --x-nut-input-voltage-mode: "nominal";
  --x-nut-input-voltage-nominal: @VAR input.voltage.nominal@;
  --x-nut-input-voltage-graphmin: round(down, calc(var(--x-nut-input-voltage-nominal) * 0.8), 10);
  --x-nut-input-voltage-graphmax: round(up, calc(var(--x-nut-input-voltage-nominal) * 1.2), 10);

@ELSE@

@IFSUPP input.voltage@
@IFBETWEEN 90 160 input.voltage@
  --x-nut-input-voltage-mode: "input-90-160";
  --x-nut-input-voltage-nominal: 120;
  --x-nut-input-voltage-graphmin: 90;
  --x-nut-input-voltage-graphmax: 160;
@ELSE@
@IFSUPP input.voltage@
@IFBETWEEN 160 280 input.voltage@
  --x-nut-input-voltage-mode: "input-160-280";
  --x-nut-input-voltage-nominal: 240;
  --x-nut-input-voltage-graphmin: 160;
  --x-nut-input-voltage-graphmax: 280;
@ELSE@
@IFSUPP input.voltage@
@IFBETWEEN 280 500 input.voltage@
  --x-nut-input-voltage-mode: "input-280-500";
  --x-nut-input-voltage-nominal: 400;
  --x-nut-input-voltage-graphmin: 280;
  --x-nut-input-voltage-graphmax: 500;
@ELSE@
  --x-nut-input-voltage-mode: "input-default";
  --x-nut-input-voltage-nominal:  240;
  --x-nut-input-voltage-graphmin: 0;
  --x-nut-input-voltage-graphmax: 500;
@ENDIF@


@IFSUPP output.L2-L3.voltage@
@IFBETWEEN 90 160 output.L2-L3.voltage@
  --x-nut-output-L2-L3-voltage-nominal: 120;
  --x-nut-output-L2-L3-voltage-graphmin: 90;
  --x-nut-output-L2-L3-voltage-graphmax: 160;
@ELSE@
@IFSUPP output.L2-L3.voltage@
@IFBETWEEN 160 280 output.L2-L3.voltage@
  --x-nut-output-L2-L3-voltage-nominal: 240;
  --x-nut-output-L2-L3-voltage-graphmin: 160;
  --x-nut-output-L2-L3-voltage-graphmax: 280;
@ELSE@
@IFSUPP output.L2-L3.voltage@
@IFBETWEEN 280 500 output.L2-L3.voltage@
  --x-nut-output-L2-L3-voltage-nominal: 400;
  --x-nut-output-L2-L3-voltage-graphmin: 280;
  --x-nut-output-L2-L3-voltage-graphmax: 500;
@ELSE@
  --x-nut-output-L2-L3-voltage-nominal:  240;
  --x-nut-output-L2-L3-voltage-graphmin: 0;
  --x-nut-output-L2-L3-voltage-graphmax: 500;
@ENDIF@

@IFSUPP output.L1-L2.voltage@
@IFBETWEEN 90 160 output.L1-L2.voltage@
  --x-nut-output-L1-L2-voltage-nominal: 120;
  --x-nut-output-L1-L2-voltage-graphmin: 90;
  --x-nut-output-L1-L2-voltage-graphmax: 160;
@ELSE@
@IFSUPP output.L1-L2.voltage@
@IFBETWEEN 160 280 output.L1-L2.voltage@
  --x-nut-output-L1-L2-voltage-nominal: 240;
  --x-nut-output-L1-L2-voltage-graphmin: 160;
  --x-nut-output-L1-L2-voltage-graphmax: 280;
@ELSE@
@IFSUPP output.L1-L2.voltage@
@IFBETWEEN 280 500 output.L1-L2.voltage@
  --x-nut-output-L1-L2-voltage-nominal: 400;
  --x-nut-output-L1-L2-voltage-graphmin: 280;
  --x-nut-output-L1-L2-voltage-graphmax: 500;
@ELSE@
@IFSUPP output.L1-L2.voltage@
  --x-nut-output-L1-L2-voltage-nominal:  240;
  --x-nut-output-L1-L2-voltage-graphmin: 0;
  --x-nut-output-L1-L2-voltage-graphmax: 500;
@ELSE@
  --x-nut-output-L1-L2-voltage-nominal:  var(--x-nut-output-L2-L3-voltage-nominal);
  --x-nut-output-L1-L2-voltage-graphmin: var(--x-nut-output-L2-L3-voltage-graphmin);
  --x-nut-output-L1-L2-voltage-graphmax: var(--x-nut-output-L2-L3-voltage-graphmax);
@ENDIF@

@IFSUPP output.L3-L1.voltage@
@IFBETWEEN 90 160 output.L3-L1.voltage@
  --x-nut-output-L3-L1-voltage-nominal: 120;
  --x-nut-output-L3-L1-voltage-graphmin: 90;
  --x-nut-output-L3-L1-voltage-graphmax: 160;
@ELSE@
@IFSUPP output.L3-L1.voltage@
@IFBETWEEN 160 280 output.L3-L1.voltage@
  --x-nut-output-L3-L1-voltage-nominal: 240;
  --x-nut-output-L3-L1-voltage-graphmin: 160;
  --x-nut-output-L3-L1-voltage-graphmax: 280;
@ELSE@
@IFSUPP output.L3-L1.voltage@
@IFBETWEEN 280 500 output.L3-L1.voltage@
  --x-nut-output-L3-L1-voltage-nominal: 400;
  --x-nut-output-L3-L1-voltage-graphmin: 280;
  --x-nut-output-L3-L1-voltage-graphmax: 500;
@ELSE@
@IFSUPP output.L3-L1.voltage@
  --x-nut-output-L3-L1-voltage-nominal:  240;
  --x-nut-output-L3-L1-voltage-graphmin: 0;
  --x-nut-output-L3-L1-voltage-graphmax: 500;
@ELSE@
  --x-nut-output-L3-L1-voltage-nominal:  var(--x-nut-output-L2-L3-voltage-nominal);
  --x-nut-output-L3-L1-voltage-graphmin: var(--x-nut-output-L2-L3-voltage-graphmin);
  --x-nut-output-L3-L1-voltage-graphmax: var(--x-nut-output-L2-L3-voltage-graphmax);
@ENDIF@


@IFSUPP output.L2-N.voltage@
@IFBETWEEN 90 160 output.L2-N.voltage@
  --x-nut-output-L2-N-voltage-nominal: 120;
  --x-nut-output-L2-N-voltage-graphmin: 90;
  --x-nut-output-L2-N-voltage-graphmax: 160;
@ELSE@
@IFSUPP output.L2-N.voltage@
@IFBETWEEN 160 280 output.L2-N.voltage@
  --x-nut-output-L2-N-voltage-nominal: 240;
  --x-nut-output-L2-N-voltage-graphmin: 160;
  --x-nut-output-L2-N-voltage-graphmax: 280;
@ELSE@
@IFSUPP output.L2-N.voltage@
@IFBETWEEN 280 500 output.L2-N.voltage@
  --x-nut-output-L2-N-voltage-nominal: 400;
  --x-nut-output-L2-N-voltage-graphmin: 280;
  --x-nut-output-L2-N-voltage-graphmax: 500;
@ELSE@
  --x-nut-output-L2-N-voltage-nominal:  240;
  --x-nut-output-L2-N-voltage-graphmin: 0;
  --x-nut-output-L2-N-voltage-graphmax: 500;
@ENDIF@

@IFSUPP output.L1-N.voltage@
@IFBETWEEN 90 160 output.L1-N.voltage@
  --x-nut-output-L1-N-voltage-nominal: 120;
  --x-nut-output-L1-N-voltage-graphmin: 90;
  --x-nut-output-L1-N-voltage-graphmax: 160;
@ELSE@
@IFSUPP output.L1-N.voltage@
@IFBETWEEN 160 280 output.L1-N.voltage@
  --x-nut-output-L1-N-voltage-nominal: 240;
  --x-nut-output-L1-N-voltage-graphmin: 160;
  --x-nut-output-L1-N-voltage-graphmax: 280;
@ELSE@
@IFSUPP output.L1-N.voltage@
@IFBETWEEN 280 500 output.L1-N.voltage@
  --x-nut-output-L1-N-voltage-nominal: 400;
  --x-nut-output-L1-N-voltage-graphmin: 280;
  --x-nut-output-L1-N-voltage-graphmax: 500;
@ELSE@
@IFSUPP output.L1-N.voltage@
  --x-nut-output-L1-N-voltage-nominal:  240;
  --x-nut-output-L1-N-voltage-graphmin: 0;
  --x-nut-output-L1-N-voltage-graphmax: 500;
@ELSE@
  --x-nut-output-L1-N-voltage-nominal:  var(--x-nut-output-L2-N-voltage-nominal);
  --x-nut-output-L1-N-voltage-graphmin: var(--x-nut-output-L2-N-voltage-graphmin);
  --x-nut-output-L1-N-voltage-graphmax: var(--x-nut-output-L2-N-voltage-graphmax);
@ENDIF@

@IFSUPP output.L3-N.voltage@
@IFBETWEEN 90 160 output.L3-N.voltage@
  --x-nut-output-L3-N-voltage-nominal: 120;
  --x-nut-output-L3-N-voltage-graphmin: 90;
  --x-nut-output-L3-N-voltage-graphmax: 160;
@ELSE@
@IFSUPP output.L3-N.voltage@
@IFBETWEEN 160 280 output.L3-N.voltage@
  --x-nut-output-L3-N-voltage-nominal: 240;
  --x-nut-output-L3-N-voltage-graphmin: 160;
  --x-nut-output-L3-N-voltage-graphmax: 280;
@ELSE@
@IFSUPP output.L3-N.voltage@
@IFBETWEEN 280 500 output.L3-N.voltage@
  --x-nut-output-L3-N-voltage-nominal: 400;
  --x-nut-output-L3-N-voltage-graphmin: 280;
  --x-nut-output-L3-N-voltage-graphmax: 500;
@ELSE@
@IFSUPP output.L3-N.voltage@
  --x-nut-output-L3-N-voltage-nominal:  240;
  --x-nut-output-L3-N-voltage-graphmin: 0;
  --x-nut-output-L3-N-voltage-graphmax: 500;
@ELSE@
  --x-nut-output-L3-N-voltage-nominal:  var(--x-nut-output-L2-N-voltage-nominal);
  --x-nut-output-L3-N-voltage-graphmin: var(--x-nut-output-L2-N-voltage-graphmin);
  --x-nut-output-L3-N-voltage-graphmax: var(--x-nut-output-L2-N-voltage-graphmax);
@ENDIF@


@IFSUPP output.L2-L3.voltage@
  --x-nut-output-voltage-mode: "L2-L3";
  --x-nut-output-voltage-nominal:  calc( (var(--x-nut-output-L3-L1-voltage-nominal) + var(--x-nut-output-L2-L3-voltage-nominal) + var(--x-nut-output-L1-L2-voltage-nominal)) / 3);
  --x-nut-output-voltage-graphmin: min(var(--x-nut-output-L3-L1-voltage-graphmin), var(--x-nut-output-L2-L3-voltage-graphmin), var(--x-nut-output-L1-L2-voltage-graphmin));
  --x-nut-output-voltage-graphmax: max(var(--x-nut-output-L3-L1-voltage-graphmax), var(--x-nut-output-L2-L3-voltage-graphmax), var(--x-nut-output-L1-L2-voltage-graphmax));

@ELSE@

@IFSUPP output.L2-N.voltage@
  --x-nut-output-voltage-mode: "L2-N";
  --x-nut-output-voltage-nominal:  calc( (var(--x-nut-output-L3-N-voltage-nominal) + var(--x-nut-output-L2-N-voltage-nominal) + var(--x-nut-output-L1-N-voltage-nominal)) / 3);
  --x-nut-output-voltage-graphmin: min(var(--x-nut-output-L3-N-voltage-graphmin), var(--x-nut-output-L2-N-voltage-graphmin), var(--x-nut-output-L1-N-voltage-graphmin));
  --x-nut-output-voltage-graphmax: max(var(--x-nut-output-L3-N-voltage-graphmax), var(--x-nut-output-L2-N-voltage-graphmax), var(--x-nut-output-L1-N-voltage-graphmax));

@ELSE@

@IFSUPP output.voltage.nominal@
  --x-nut-output-voltage-mode: "nominal";
  --x-nut-output-voltage-nominal:  @VAR output.voltage.nominal@;
  --x-nut-output-voltage-graphmin: round(down, calc(var(--x-nut-output-voltage-nominal) * 0.8), 10);
  --x-nut-output-voltage-graphmax: round(up, calc(var(--x-nut-output-voltage-nominal) * 1.2), 10);
@ELSE@
@IFSUPP output.voltage@
@IFBETWEEN 90 160 output.voltage@
  --x-nut-output-voltage-mode: "output-90-160";
  --x-nut-output-voltage-nominal:  120;
  --x-nut-output-voltage-graphmin: 90;
  --x-nut-output-voltage-graphmax: 160;
@ELSE@
@IFSUPP output.voltage@
@IFBETWEEN 160 280 output.voltage@
  --x-nut-output-voltage-mode: "output-160-280";
  --x-nut-output-voltage-nominal:  240;
  --x-nut-output-voltage-graphmin: 160;
  --x-nut-output-voltage-graphmax: 280;
@ELSE@
@IFSUPP output.voltage@
@IFBETWEEN 280 500 output.voltage@
  --x-nut-output-voltage-mode: "output-280-500";
  --x-nut-output-voltage-nominal:  400;
  --x-nut-output-voltage-graphmin: 280;
  --x-nut-output-voltage-graphmax: 500;
@ELSE@
  --x-nut-output-voltage-mode: "output-default";
  --x-nut-output-voltage-nominal:  240;
  --x-nut-output-voltage-graphmin: 0;
  --x-nut-output-voltage-graphmax: 500;
@ENDIF@

}
* { box-sizing: border-box; }

body { background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; padding: 4vh 4vw; margin: 0; display: flex; justify-content: center; }
.dashboard { width: 100%; max-width: 1400px; display: flex; flex-direction: column; gap: 2rem; }

header { border-bottom: 1px solid var(--border); padding-bottom: 1rem; display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem;}
h1 { margin: 0; font-size: 1.5rem; color: var(--green); }

/* Fixed Grid Architecture: Prevents charts from dropping off screen */
.main-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 2rem; align-items: start; }

.sidebar { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; height: max-content; }
.sidebar-row { display: flex; justify-content: space-between; margin-bottom: 0.35rem; font-size: 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 0.35rem; }
.sidebar-label { color: var(--green); font-weight: bold; }
.sidebar-value { text-align: right; }
.sidebar-group { margin-top: 1.25rem; margin-bottom: 0.5rem; color: var(--dim); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: bold; border-bottom: 1px solid var(--border); padding-bottom: 0.25rem;}

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.card-header { font-size: 1rem; font-weight: bold; width: 100%; text-align: center; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; margin-bottom: 2rem;}

.charts { display: flex; gap: 1.5rem; height: 180px; justify-content: center; width: 100%; margin-top: 1rem; margin-bottom: 1.5rem; }
.bar-group { display: flex; gap: 6px; height: 100%; align-items: flex-end; position: relative; }

.threshold-battery { width: 4px; height: 100%; border-radius: 2px; background: linear-gradient(to top, var(--crit) 0% 20%, var(--warn) 20% 40%, var(--green) 40% 100%); }
.threshold-voltage { width: 4px; height: 100%; border-radius: 2px; background: linear-gradient(to top, var(--crit) 0% 15%, var(--warn) 15% 25%, var(--green) 25% 85%, var(--warn) 85% 95%, var(--crit) 95% 100%); }

.bar-wrapper { position: relative; height: 100%; flex-shrink: 0; }
.bar-bg { width: 34px; height: 100%; border-radius: 4px; display: flex; align-items: flex-end; position: relative; overflow: hidden; background: #334155; background-image: repeating-linear-gradient(to top, transparent, transparent calc(20% - 1px), rgba(255,255,255,0.05) calc(20% - 1px), rgba(255,255,255,0.05) 20%); }
.bar-fill { width: 100%; background: var(--green); border-radius: 4px; }
.fill-blue { background: var(--accent); }

.y-axis { position: relative; height: 100%; width: 24px; flex-shrink: 0; }
.tick { position: absolute; left: 0; transform: translateY(50%); font-size: 0.65rem; color: var(--dim); display: flex; align-items: center; white-space: nowrap; }
.tick::before { content: ''; width: 4px; height: 1px; background: var(--border); margin-right: 4px; }

.label-top { position: absolute; top: -25px; left: 50%; transform: translateX(-50%); font-size: 0.75rem; color: var(--dim); white-space: nowrap; }
.label-bottom { position: absolute; bottom: -30px; left: 50%; transform: translateX(-50%); font-size: 0.85rem; font-weight: bold; white-space: nowrap; }

@media (max-width: 1024px) { .main-layout { grid-template-columns: 1fr; } }
</style>
<!-- link rel="stylesheet" type="text/css" href="nut.css" / -->
</head>
<body>

<div class="dashboard">
<header>
<div>
<h1>Network UPS Tools</h1>
<div style="color: var(--dim)">@HOSTDESC@ -
@IFSUPP device.model@
@VAR device.model@
@ELSE@
@VAR ups.model@
@ENDIF@
on @HOST@</div>
</div>
<div style="color: var(--dim)">@DATE %a %b %d %X %Z %Y@</div>
</header>

<div class="main-layout">
<div class="sidebar">
<div class="sidebar-row"><span class="sidebar-label">Model:</span> <span class="sidebar-value">
@IFSUPP device.model@
@VAR device.model@
@ELSE@
@VAR ups.model@
@ENDIF@
</span></div>

<div class="sidebar-row"><span class="sidebar-label">Status:</span> <span class="sidebar-value" style="nowrap">@STATUS  @&nbsp;<b style="color: @STATUSCOLOR@">[]</b></span></div>

@IFSUPP battery.runtime@<div class="sidebar-row"><span class="sidebar-label">Runtime:</span> <span class="sidebar-value">@RUNTIME@</span></div>@ENDIF@

@IFSUPP ups.temperature@<div class="sidebar-row"><span class="sidebar-label">UPS Temp:</span> <span class="sidebar-value">@UPSTEMP@ @DEGREES@</span></div>@ENDIF@

@IFSUPP ambient.temperature@
<div class="sidebar-group">Ambient</div>
@ELSE@
@IFSUPP ambient.humidity@
<div class="sidebar-group">Ambient</div>
@ENDIF@

@IFSUPP ambient.temperature@<div class="sidebar-row"><span class="sidebar-label">Temperature:</span> <span class="sidebar-value">@VAR ambient.temperature@ @DEGREES@</span></div>@ENDIF@

@IFSUPP ambient.humidity@<div class="sidebar-row"><span class="sidebar-label">Humidity:</span> <span class="sidebar-value">@VAR ambient.humidity@ %</span></div>@ENDIF@

<div class="sidebar-group">Battery</div>
@IFSUPP battery.voltage@<div class="sidebar-row"><span class="sidebar-label">Voltage:</span> <span class="sidebar-value">@VAR battery.voltage@ V</span></div>@ENDIF@
@IFSUPP battery.current@<div class="sidebar-row"><span class="sidebar-label">Current:</span> <span class="sidebar-value">@VAR battery.current@ A</span></div>@ENDIF@

<div class="sidebar-group">Input</div>

@IFSUPP input.L2-L3.voltage@
<div class="sidebar-row"><span class="sidebar-label">Voltage L1-L2:</span> <span class="sidebar-value">@VAR input.L1-L2.voltage@ V</span></div>
<div class="sidebar-row"><span class="sidebar-label">Voltage L2-L3:</span> <span class="sidebar-value">@VAR input.L2-L3.voltage@ V</span></div>
<div class="sidebar-row"><span class="sidebar-label">Voltage L3-L1:</span> <span class="sidebar-value">@VAR input.L3-L1.voltage@ V</span></div>
@ELSE@
@IFSUPP input.L2-N.voltage@
<div class="sidebar-row"><span class="sidebar-label">Voltage L1-N:</span> <span class="sidebar-value">@VAR input.L1-N.voltage@ V</span></div>
<div class="sidebar-row"><span class="sidebar-label">Voltage L2-N:</span> <span class="sidebar-value">@VAR input.L2-N.voltage@ V</span></div>
<div class="sidebar-row"><span class="sidebar-label">Voltage L3-N:</span> <span class="sidebar-value">@VAR input.L3-N.voltage@ V</span></div>
@ELSE@
@IFSUPP input.voltage@
<div class="sidebar-row"><span class="sidebar-label">Voltage:</span> <span class="sidebar-value">@VAR input.voltage@ V</span></div>
@ENDIF@

@IFSUPP input.L2.current@
<div class="sidebar-row"><span class="sidebar-label">Current L1:</span> <span class="sidebar-value">@VAR input.L1.current@ A</span></div>
<div class="sidebar-row"><span class="sidebar-label">Current L2:</span> <span class="sidebar-value">@VAR input.L2.current@ A</span></div>
<div class="sidebar-row"><span class="sidebar-label">Current L3:</span> <span class="sidebar-value">@VAR input.L3.current@ A</span></div>
@ELSE@
@IFSUPP input.current@
<div class="sidebar-row"><span class="sidebar-label">Current:</span> <span class="sidebar-value">@VAR input.current@ A</span></div>
@ENDIF@

@IFSUPP input.frequency@<div class="sidebar-row"><span class="sidebar-label">Freq:</span> <span class="sidebar-value">@VAR input.frequency@ Hz</span></div>@ENDIF@

<div class="sidebar-group">Output</div>
@IFSUPP output.L2-L3.voltage@
<div class="sidebar-row"><span class="sidebar-label">Voltage L1-L2:</span> <span class="sidebar-value">@VAR output.L1-L2.voltage@ V</span></div>
<div class="sidebar-row"><span class="sidebar-label">Voltage L2-L3:</span> <span class="sidebar-value">@VAR output.L2-L3.voltage@ V</span></div>
<div class="sidebar-row"><span class="sidebar-label">Voltage L3-L1:</span> <span class="sidebar-value">@VAR output.L3-L1.voltage@ V</span></div>
@ELSE@
@IFSUPP output.L2-N.voltage@
<div class="sidebar-row"><span class="sidebar-label">Voltage L1-N:</span> <span class="sidebar-value">@VAR output.L1-N.voltage@ V</span></div>
<div class="sidebar-row"><span class="sidebar-label">Voltage L2-N:</span> <span class="sidebar-value">@VAR output.L2-N.voltage@ V</span></div>
<div class="sidebar-row"><span class="sidebar-label">Voltage L3-N:</span> <span class="sidebar-value">@VAR output.L3-N.voltage@ V</span></div>
@ELSE@
@IFSUPP output.voltage@
<div class="sidebar-row"><span class="sidebar-label">Voltage:</span> <span class="sidebar-value">@VAR output.voltage@ V</span></div>
@ENDIF@

@IFSUPP output.L2.current@
<div class="sidebar-row"><span class="sidebar-label">Current L1:</span> <span class="sidebar-value">@VAR output.L1.current@ A</span></div>
<div class="sidebar-row"><span class="sidebar-label">Current L2:</span> <span class="sidebar-value">@VAR output.L2.current@ A</span></div>
<div class="sidebar-row"><span class="sidebar-label">Current L3:</span> <span class="sidebar-value">@VAR output.L3.current@ A</span></div>
@ELSE@
@IFSUPP output.current@
<div class="sidebar-row"><span class="sidebar-label">Current:</span> <span class="sidebar-value">@VAR output.current@ A</span></div>
@ENDIF@

@IFSUPP output.frequency@<div class="sidebar-row"><span class="sidebar-label">Freq:</span> <span class="sidebar-value">@VAR output.frequency@ Hz</span></div>@ENDIF@
</div>

<div class="chart-grid">
<div class="card">
<div class="card-header">Battery</div>
<div class="charts">
@IFSUPP battery.charge@
<div class="bar-group">
<div class="threshold-battery"></div>
<div class="bar-wrapper">
<div class="label-top">Charge</div>
<div class="bar-bg"><div class="bar-fill" style="height: @VAR battery.charge@%;"></div></div>
<div class="label-bottom">@VAR battery.charge@ %</div>
</div>
<div class="y-axis">
<div class="tick" style="bottom: 100%">100</div><div class="tick" style="bottom: 50%">50</div><div class="tick" style="bottom: 0%">0</div>
</div>
</div>
@ENDIF@

@IFSUPP battery.voltage@
<div class="bar-group">
<div class="threshold-battery"></div>
<div class="bar-wrapper">
<div class="label-top">Voltage</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR battery.voltage@ - var(--x-nut-battery-voltage-graphmin)) / (var(--x-nut-battery-voltage-graphmax) - var(--x-nut-battery-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR battery.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-battery-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-battery-voltage-nominal" style="bottom: calc( ( (var(--x-nut-battery-voltage-nominal) - var(--x-nut-battery-voltage-graphmin)) / (var(--x-nut-battery-voltage-graphmax) - var(--x-nut-battery-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-battery-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>
</div>
@ENDIF@
</div>
</div>

<div class="card">
<div class="card-header">Line Voltage</div>
<div class="charts">
@IFSUPP input.L2-L3.voltage@
<div class="bar-group">
<div class="threshold-voltage"></div>

<div class="bar-wrapper">
<div class="label-top">Input L1-L2</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR input.L1-L2.voltage@ - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR input.L1-L2.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-nominal" style="bottom: calc( ( (var(--x-nut-input-voltage-nominal) - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Input L2-L3</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR input.L2-L3.voltage@ - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR input.L2-L3.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-nominal" style="bottom: calc( ( (var(--x-nut-input-voltage-nominal) - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Input L3-L1</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR input.L3-L1.voltage@ - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR input.L3-L1.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-nominal" style="bottom: calc( ( (var(--x-nut-input-voltage-nominal) - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

</div>
@ELSE@
@IFSUPP input.L2-N.voltage@

<div class="bar-group">
<div class="threshold-voltage"></div>

<div class="bar-wrapper">
<div class="label-top">Input L1-N</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR input.L1-N.voltage@ - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR input.L1-N.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-nominal" style="bottom: calc( ( (var(--x-nut-input-voltage-nominal) - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Input L2-N</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR input.L2-N.voltage@ - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR input.L2-N.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-nominal" style="bottom: calc( ( (var(--x-nut-input-voltage-nominal) - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Input L3-N</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR input.L3-N.voltage@ - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR input.L3-N.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-nominal" style="bottom: calc( ( (var(--x-nut-input-voltage-nominal) - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

</div>
@ELSE@
@IFSUPP input.voltage@
<div class="bar-group">
<div class="threshold-voltage"></div>
<div class="bar-wrapper">
<div class="label-top">Input</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR input.voltage@ - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR input.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-nominal" style="bottom: calc( ( (var(--x-nut-input-voltage-nominal) - var(--x-nut-input-voltage-graphmin)) / (var(--x-nut-input-voltage-graphmax) - var(--x-nut-input-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-input-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>
</div>
@ENDIF@
@IFSUPP output.L2-L3.voltage@
<div class="bar-group">
<div class="threshold-voltage"></div>

<div class="bar-wrapper">
<div class="label-top">Output L1-L2</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR output.L1-L2.voltage@ - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR output.L1-L2.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-nominal" style="bottom: calc( ( (var(--x-nut-output-voltage-nominal) - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Output L2-L3</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR output.L2-L3.voltage@ - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR output.L2-L3.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-nominal" style="bottom: calc( ( (var(--x-nut-output-voltage-nominal) - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Output L3-L1</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR output.L3-L1.voltage@ - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR output.L3-L1.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-nominal" style="bottom: calc( ( (var(--x-nut-output-voltage-nominal) - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

</div>
@ELSE@
@IFSUPP output.L2-N.voltage@
<div class="bar-group">
<div class="threshold-voltage"></div>

<div class="bar-wrapper">
<div class="label-top">Output L1-N</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR output.L1-N.voltage@ - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR output.L1-N.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-nominal" style="bottom: calc( ( (var(--x-nut-output-voltage-nominal) - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Output L2-N</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR output.L2-N.voltage@ - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR output.L2-N.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-nominal" style="bottom: calc( ( (var(--x-nut-output-voltage-nominal) - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Output L3-N</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR output.L3-N.voltage@ - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR output.L3-N.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-nominal" style="bottom: calc( ( (var(--x-nut-output-voltage-nominal) - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>

</div>
@ELSE@
@IFSUPP output.voltage@
<div class="bar-group">
<div class="threshold-voltage"></div>
<div class="bar-wrapper">
<div class="label-top">Output</div>
<div class="bar-bg"><div class="bar-fill" style="height: calc( ( (@VAR output.voltage@ - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR output.voltage@ V</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-nominal" style="bottom: calc( ( (var(--x-nut-output-voltage-nominal) - var(--x-nut-output-voltage-graphmin)) / (var(--x-nut-output-voltage-graphmax) - var(--x-nut-output-voltage-graphmin)) ) * 100%)">NOM</div><div class="tick js-populate-var" data-var="--x-nut-output-voltage-graphmin" style="bottom: 0%">MIN</div>
</div>
</div>
@ENDIF@
</div>
</div>

<div class="card">
<div class="card-header">Load</div>
<div class="charts">
@IFSUPP output.L2.power.percent@
<div class="bar-group">

<div class="bar-wrapper">
<div class="label-top">Load L1</div>
<div class="bar-bg"><div class="bar-fill fill-blue" style="height: @VAR output.L1.power.percent@%;"></div></div>
<div class="label-bottom">@VAR output.L1.power.percent@ %</div>
</div>
<div class="y-axis">
<div class="tick" style="bottom: 100%">100</div><div class="tick" style="bottom: 50%">50</div><div class="tick" style="bottom: 0%">0</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Load L2</div>
<div class="bar-bg"><div class="bar-fill fill-blue" style="height: @VAR output.L1.power.percent@%;"></div></div>
<div class="label-bottom">@VAR output.L2.power.percent@ %</div>
</div>
<div class="y-axis">
<div class="tick" style="bottom: 100%">100</div><div class="tick" style="bottom: 50%">50</div><div class="tick" style="bottom: 0%">0</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Load L3</div>
<div class="bar-bg"><div class="bar-fill fill-blue" style="height: @VAR output.L1.power.percent@%;"></div></div>
<div class="label-bottom">@VAR output.L3.power.percent@ %</div>
</div>
<div class="y-axis">
<div class="tick" style="bottom: 100%">100</div><div class="tick" style="bottom: 50%">50</div><div class="tick" style="bottom: 0%">0</div>
</div>

</div>
@ELSE@
@IFSUPP output.L2.realpower.percent@
<div class="bar-group">

<div class="bar-wrapper">
<div class="label-top">Load L1</div>
<div class="bar-bg"><div class="bar-fill fill-blue" style="height: @VAR output.L1.realpower.percent@%;"></div></div>
<div class="label-bottom">@VAR output.L1.realpower.percent@ %</div>
</div>
<div class="y-axis">
<div class="tick" style="bottom: 100%">100</div><div class="tick" style="bottom: 50%">50</div><div class="tick" style="bottom: 0%">0</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Load L2</div>
<div class="bar-bg"><div class="bar-fill fill-blue" style="height: @VAR output.L1.realpower.percent@%;"></div></div>
<div class="label-bottom">@VAR output.L2.realpower.percent@ %</div>
</div>
<div class="y-axis">
<div class="tick" style="bottom: 100%">100</div><div class="tick" style="bottom: 50%">50</div><div class="tick" style="bottom: 0%">0</div>
</div>

<div class="bar-wrapper">
<div class="label-top">Load L3</div>
<div class="bar-bg"><div class="bar-fill fill-blue" style="height: @VAR output.L1.realpower.percent@%;"></div></div>
<div class="label-bottom">@VAR output.L3.realpower.percent@ %</div>
</div>
<div class="y-axis">
<div class="tick" style="bottom: 100%">100</div><div class="tick" style="bottom: 50%">50</div><div class="tick" style="bottom: 0%">0</div>
</div>

</div>
@ELSE@
@IFSUPP ups.load@
<div class="bar-group">
<div class="bar-wrapper">
<div class="bar-bg"><div class="bar-fill fill-blue" style="height: @VAR ups.load@%;"></div></div>
<div class="label-bottom">@VAR ups.load@ %</div>
</div>
<div class="y-axis">
<div class="tick" style="bottom: 100%">100</div><div class="tick" style="bottom: 50%">50</div><div class="tick" style="bottom: 0%">0</div>
</div>
</div>
@ENDIF@
</div>
</div>

@IFSUPP ambient.temperature@
<div class="card">
<div class="card-header">Environment</div>
<div class="charts">
<div class="bar-group">
<div class="bar-wrapper">
<div class="label-top">Temp</div>
<div class="bar-bg"><div class="bar-fill fill-warn" style="height: calc( ( (@VAR ambient.temperature@ - var(--x-nut-temperature-graphmin)) / (var(--x-nut-temperature-graphmax) - var(--x-nut-temperature-graphmin)) ) * 100%);"></div></div>
<div class="label-bottom">@VAR ambient.temperature@ &deg;</div>
</div>
<div class="y-axis">
<div class="tick js-populate-var" data-var="--x-nut-temperature-graphmax" style="bottom: 100%">MAX</div><div class="tick js-populate-var" data-var="--x-nut-temperature-graphmin" style="bottom: 0%">MIN</div>
</div>
</div>
</div>
</div>
@ENDIF@
</div>
</div>

<div><small><hr/>
@TREELINK_JSON Device data as JSON@ | @TREELINK Device data as HTML table@
<a href="https://jigsaw.w3.org/css-validator/check/referer"><img
  style="float:right" src="https://jigsaw.w3.org/css-validator/images/vcss"
  alt="Valid CSS" title="Valid CSS" height="31" width="88"></a>
<a href="https://validator.w3.org/check?uri=referer"><img
  style="float:right" src="https://www.w3.org/Icons/valid-html401"
  alt="Valid HTML 4.01 Strict" title="Valid HTML 4.01 Strict"
  height="31" width="88"></a>
<p align="right">Network UPS Tools upsstats @VERSION@</p>
</small></div>

</div>

<script>
var els = document.querySelectorAll('.js-populate-var');

els.forEach(el => {
  // Create dummy element
  const dummy = document.createElement('div')

  // Set dummy size (named via "data-var" in original caller)
  dummy.style.width = "calc(" + getComputedStyle(el).getPropertyValue(el.dataset.var) + "*1px)"
  document.body.appendChild(dummy)

  elementWidth = dummy.getBoundingClientRect().width

  // Remove the element when we're finished with it
  dummy.remove()

  el.innerHTML = Math.round(elementWidth)
})
</script>

</body>
</html>
