- value = atof (answer[3]);
-
- if (strncmp ("ambient.", key, 8) == 0)
- {
- if (strcmp ("ambient.humidity", key) == 0)
- nut_submit (ups, "humidity", "ambient", value);
- else if (strcmp ("ambient.temperature", key) == 0)
- nut_submit (ups, "temperature", "ambient", value);
- }
- else if (strncmp ("battery.", key, 8) == 0)
- {
- if (strcmp ("battery.charge", key) == 0)
- nut_submit (ups, "percent", "charge", value);
- else if (strcmp ("battery.current", key) == 0)
- nut_submit (ups, "current", "battery", value);
- else if (strcmp ("battery.runtime", key) == 0)
- nut_submit (ups, "timeleft", "battery", value);
- else if (strcmp ("battery.temperature", key) == 0)
- nut_submit (ups, "temperature", "battery", value);
- else if (strcmp ("battery.voltage", key) == 0)
- nut_submit (ups, "voltage", "battery", value);
- }
- else if (strncmp ("input.", key, 6) == 0)
- {
- if (strcmp ("input.frequency", key) == 0)
- nut_submit (ups, "frequency", "input", value);
- else if (strcmp ("input.voltage", key) == 0)
- nut_submit (ups, "voltage", "input", value);
- }
- else if (strncmp ("output.", key, 7) == 0)
- {
- if (strcmp ("output.current", key) == 0)
- nut_submit (ups, "current", "output", value);
- else if (strcmp ("output.frequency", key) == 0)
- nut_submit (ups, "frequency", "output", value);
- else if (strcmp ("output.voltage", key) == 0)
- nut_submit (ups, "voltage", "output", value);
- }
- else if (strncmp ("ups.", key, 4) == 0)
- {
- if (strcmp ("ups.load", key) == 0)
- nut_submit (ups, "percent", "load", value);
- else if (strcmp ("ups.power", key) == 0)
- nut_submit (ups, "power", "ups", value);
- else if (strcmp ("ups.temperature", key) == 0)
- nut_submit (ups, "temperature", "ups", value);
+ value = atof(answer[3]);
+
+ if (strncmp("ambient.", key, 8) == 0) {
+ if (strcmp("ambient.humidity", key) == 0)
+ nut_submit(ups, "humidity", "ambient", value);
+ else if (strcmp("ambient.temperature", key) == 0)
+ nut_submit(ups, "temperature", "ambient", value);
+ } else if (strncmp("battery.", key, 8) == 0) {
+ if (strcmp("battery.charge", key) == 0)
+ nut_submit(ups, "percent", "charge", value);
+ else if (strcmp("battery.current", key) == 0)
+ nut_submit(ups, "current", "battery", value);
+ else if (strcmp("battery.runtime", key) == 0)
+ nut_submit(ups, "timeleft", "battery", value);
+ else if (strcmp("battery.temperature", key) == 0)
+ nut_submit(ups, "temperature", "battery", value);
+ else if (strcmp("battery.voltage", key) == 0)
+ nut_submit(ups, "voltage", "battery", value);
+ } else if (strncmp("input.", key, 6) == 0) {
+ if (strcmp("input.frequency", key) == 0)
+ nut_submit(ups, "frequency", "input", value);
+ else if (strcmp("input.voltage", key) == 0)
+ nut_submit(ups, "voltage", "input", value);
+ } else if (strncmp("output.", key, 7) == 0) {
+ if (strcmp("output.current", key) == 0)
+ nut_submit(ups, "current", "output", value);
+ else if (strcmp("output.frequency", key) == 0)
+ nut_submit(ups, "frequency", "output", value);
+ else if (strcmp("output.voltage", key) == 0)
+ nut_submit(ups, "voltage", "output", value);
+ } else if (strncmp("ups.", key, 4) == 0) {
+ if (strcmp("ups.load", key) == 0)
+ nut_submit(ups, "percent", "load", value);
+ else if (strcmp("ups.power", key) == 0)
+ nut_submit(ups, "power", "ups", value);
+ else if (strcmp("ups.temperature", key) == 0)
+ nut_submit(ups, "temperature", "ups", value);