picofssd doesn't obey time.sleep

Support for the UPS PIco HV3.0A and HV3.0B

picofssd doesn't obey time.sleep

Postby Siewert30SW » Mon Feb 27, 2017 9:30 pm

Didn't had a clue where to ask or put my question in the forum.
But today i was trying to amend the /usr/bin/picofssd.

I run my Home Automation from my Pi3 with Domoticz as Domotica System.
Domoticz needs a gracefull shutdown before the system is going down due to a empty battery.
If it's closed the hard way then the sqlite database gets corrupt.
I also need some time to do some task before shuttingdown.
So that when the power outage is over and Pi restarted the system can startup my house again in the previous state like lights On and such.

So i wanted to catch the shutdown command and before it really shutsdown letting Domoticz know it is going down.
I just need a minute to do some tasks, in the picofssd i wrote some extra lines to switch a virtual switch in domoticz which shutsdown my house.
But what ever i try, the /usr/bin/picofssd doens't like the time.sleep.
So when the fssd kicks in all commands are i put in are executed with 5 seconds and not 60 seconds as i want it to.
Why doesn't /urs/bin/picofssd like timesleep.

My snippet from /urs/bin/picofssd:
Code: Select all
          def isr(self, channel):
                GPIO interrupt service routine

                # This test is here because the user *might* have another HAT plugged in or another circuit that produces a
                # falling-edge signal on another GPIO pin.
                if channel != CLOCK_PIN:

                # we can get the state of a pin with GPIO.input even when it is currently configured as an output
                self.sqwave = not GPIO.input(PULSE_PIN)

                # set pulse pin low before changing it to input to look for shutdown signal
                GPIO.output(PULSE_PIN, False)
                GPIO.setup(PULSE_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
                if not GPIO.input(PULSE_PIN):
           # pin is low, this is shutdown signal from pico
         self.counter += 1
         self.log.warning("Raspberry lost power supply, Pi will shutdown")
                        self.log.warning("Domoticz will be stopped before shutting down")
         os.system('curl ""')
         os.system('sudo service domoticz.sh stop')
         os.system('/sbin/shutdown -h now')
                        self.counter = 0

- RPi3 - PIco HV3.0A / Domo Beta 3.9XXX / RFXtrx433E / Aeotec Gen5
- RPi3 - PIco HV3.0A / PiHole / PiVPN / NAS / Print Server
- Youless Elec&Gas
- FI9803P Cams
- KD101 detectors
- Zwave & KaKu

MyDomoticz scripts: @GitHub
PIco UPS Toolkit: @GitHub
User avatar
Posts: 194
Joined: Fri Jan 06, 2017 8:06 pm
Location: The Netherlands

Return to UPS PIco HV3.0A and HV3.0B

Who is online

Users browsing this forum: No registered users and 1 guest