Notifications
Clear all

fssd custom daemon

1 Posts
2 Users
0 Likes
25 Views
pozsothereal
(@pozsothereal)
Active Member
Joined: 11 months ago
Posts: 5
Topic starter  

Hi,

 

I would like to modify the fssd daemon to run my own command before the shutdown command and wait,

the command would be: 

curl -X POST -H "Authorization: Bearer token123" -H "Content-Type: application/json" http://localhost:8123/api/services/homeassistant/stop

"here it needs a sleep with 15s"

"shutdown"

 

could you please help me? the modified code would be i think like this i thinkbut not sure:

 

'''
# set pulse pin low before changing it to input to look for shu$
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("Lost power supply, Pi will shutdown")
self.alert_email()

curl -X POST -H "Authorization: Bearer token123" -H "Content-Type: application/json" http://localhost:8123/api/services/homeassistant/stop

time.sleep(15)
os.system('/sbin/shutdown -h now')

'''


   
Quote
Share: