More improvements to battery monitor.
This commit is contained in:
@@ -101,7 +101,7 @@ class BatteryMonitor:
|
|||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subprocess.run(['spd-say', '-w', message], check=True)
|
subprocess.run(['espeak-ng', '-v', 'en-us', '-a', '200', message], check=True)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Speech error: {e}")
|
logger.error(f"Speech error: {e}")
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ class BatteryMonitor:
|
|||||||
logger.critical(f"Battery at {level}% - initiating shutdown")
|
logger.critical(f"Battery at {level}% - initiating shutdown")
|
||||||
self.speak("Critical battery level. System shutting down now.")
|
self.speak("Critical battery level. System shutting down now.")
|
||||||
time.sleep(2) # Give speech time to complete
|
time.sleep(2) # Give speech time to complete
|
||||||
subprocess.run(['sudo', 'poweroff'], check=True)
|
subprocess.run(['systemctl', 'poweroff'], check=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
elif level <= 5 and not self.warned_5:
|
elif level <= 5 and not self.warned_5:
|
||||||
|
|||||||
Reference in New Issue
Block a user