<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.geekworm.com/index.php?action=history&amp;feed=atom&amp;title=CommentStreams%3A349c3b14b8ade3fe3331b162fd247b6a</id>
	<title>CommentStreams:349c3b14b8ade3fe3331b162fd247b6a - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.geekworm.com/index.php?action=history&amp;feed=atom&amp;title=CommentStreams%3A349c3b14b8ade3fe3331b162fd247b6a"/>
	<link rel="alternate" type="text/html" href="https://wiki.geekworm.com/index.php?title=CommentStreams:349c3b14b8ade3fe3331b162fd247b6a&amp;action=history"/>
	<updated>2026-07-26T13:52:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki.geekworm.com/index.php?title=CommentStreams:349c3b14b8ade3fe3331b162fd247b6a&amp;diff=34322&amp;oldid=prev</id>
		<title>174.174.80.39: Migrated reply #4848</title>
		<link rel="alternate" type="text/html" href="https://wiki.geekworm.com/index.php?title=CommentStreams:349c3b14b8ade3fe3331b162fd247b6a&amp;diff=34322&amp;oldid=prev"/>
		<updated>2024-06-12T01:28:23Z</updated>

		<summary type="html">&lt;p&gt;Migrated reply #4848&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;OK so I got pretty close by modifying the included pld.py script. I can get it to shutdown when on battery with a delay. However, it will execute the second the pi is on battery. I would rather it be on battery for say 10 seconds so random power drops don&amp;#039;t shut it down. Any idea on how to implement this?&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/env python3&lt;br /&gt;
#This python script is only suitable for UPS Shield X1200, X1201 and X1202&lt;br /&gt;
&lt;br /&gt;
import gpiod&lt;br /&gt;
import time&lt;br /&gt;
from subprocess import call&lt;br /&gt;
&lt;br /&gt;
PLD_PIN = 6&lt;br /&gt;
chip = gpiod.Chip(&amp;#039;gpiochip4&amp;#039;)&lt;br /&gt;
pld_line = chip.get_line(PLD_PIN)&lt;br /&gt;
pld_line.request(consumer=&amp;quot;PLD&amp;quot;, type=gpiod.LINE_REQ_DIR_IN)&lt;br /&gt;
try:&lt;br /&gt;
   while True:&lt;br /&gt;
       pld_state = pld_line.get_value()&lt;br /&gt;
       if pld_state == 1:&lt;br /&gt;
           pass&lt;br /&gt;
       else:&lt;br /&gt;
            time.sleep(1)&lt;br /&gt;
            call(&amp;quot;sudo nohup shutdown -h now&amp;quot;, shell=True)  #uncomment to implement shutdown when power outage&lt;br /&gt;
&lt;br /&gt;
finally:&lt;br /&gt;
&lt;br /&gt;
 pld_line.release()&amp;lt;!-- migrated from Comments; original IP: 174.174.80.39 --&amp;gt;&lt;/div&gt;</summary>
		<author><name>174.174.80.39</name></author>
	</entry>
</feed>