def detect_battery(self): status = power.get_power_status().battery_flag status = power.BatteryFlags(status) log.debug('Battery:', status) if status == power.BatteryFlags.NONE: self.kill_the_system('Battery')
def detect_ac(self): status = power.get_power_status().ac_line_status status = power.ACLineStatus(status) log.debug('AC:', status.name) if status != power.ACLineStatus.ONLINE: # If not connected to power, shutdown self.kill_the_system('AC')