PowerStationMonitor/openhab2/rules/apc_ups.rules

12 lines
339 B
Plaintext

rule "Calculate Battery Runtime"
when
Time cron "* * * ? * * *"
then
if (apc_status_OnBattery.state == ON) {
val temp = (apc_ups_counter.state as Number) + 1;
apc_ups_counter.sendCommand(temp);
}
if (apc_ups_counter.state == NULL || apc_ups_counter.state == "") {
apc_ups_counter.sendCommand("0");
}
end