ACTION=="add", GOTO="helios64_ups_end" ACTION=="remove", GOTO="helios64_ups_end" # Power loss event ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTRS{online}=="0", RUN+="/usr/bin/systemctl start helios64-ups.timer" # Power restore event ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTRS{online}=="1", RUN+="/usr/bin/systemctl stop helios64-ups.timer" LABEL="helios64_ups_end"