API Command to switch off Raspberry PI

Support for Air Player desktop on ARM devices, like the Raspberry Pi.

Moderators: russ, Ralph

Message
Author
User avatar
fweinrebe
Posts: 62
Joined: Mon Dec 14, 2015 10:03 am

API Command to switch off Raspberry PI

#1 Post by fweinrebe »

Isn't there a API command I can call in a custom gauge or by a press of a button that can shut down the Raspberry Pi(s)?

Why I am asking is because I run Air Manager 3.0 on my laptop and on my cockpit I run multiple Air Player Desktops and RPi. But my laptop is not always at my sim. When shutting down the sim I switch off all the PC's, then I have to walk over to my laptop, open Air Manager and then shut down the Raspberry remotely.

I would like to link a switch to a RPI or Arduino and pressing that button/switch must command all the Raspberry Pis to switch off. Or is there a GPIO pin on the RPi that will trigger a shutdown?

Fritz
Last edited by fweinrebe on Mon Feb 05, 2018 5:59 am, edited 1 time in total.

User avatar
fweinrebe
Posts: 62
Joined: Mon Dec 14, 2015 10:03 am

Re: API Command to switch of Raspberry PI

#2 Post by fweinrebe »

After some research I found a Python script that monitors a GPIO pin using Python. On detection that a button was pressed on that pin, it then calls the shutdown of the PI.

What I plan to do is connect a relay to an Arduino pin. I can then in my gauge trigger the relay. That will toggle the value on the GPIO pin of the Pi calling for the shutdown. My PC's are also set to shutdown when I press the power button, so the same Arduino is gonna pulse the power buttons thereby switching off the whole simulator.

Hopefully Air Player will not interfere with the Python script also monitoring a GPIO pin?

User avatar
Corjan
Posts: 2941
Joined: Thu Nov 19, 2015 9:04 am

Re: API Command to switch of Raspberry PI

#3 Post by Corjan »

Hi,


To be honest, I'm not sure if it would interfere. I think both systems only read the same registry, so that might work fine.

Having said that, I will implement this feature in Air Manager / Air Player. It might take a while though before it is part of a new release, I have put it on the TODO list.

Might become something like this:

Code: Select all

shut_down("SYSTEM")
shut_down("APPLICATION")
shut_down("INSTRUMENT")
shut_down("PANEL")

Expect something along the lines of two months.

Corjan

User avatar
fweinrebe
Posts: 62
Joined: Mon Dec 14, 2015 10:03 am

Re: API Command to switch of Raspberry PI

#4 Post by fweinrebe »

Corjan wrote: Thu Jan 25, 2018 12:40 pm Having said that, I will implement this feature in Air Manager / Air Player. It might take a while though before it is part of a new release, I have put it on the TODO list.

Might become something like this:

Code: Select all

shut_down("SYSTEM")
shut_down("APPLICATION")
shut_down("INSTRUMENT")
shut_down("PANEL")
Expect something along the lines of two months.
Thanks very much Corjan. :D

User avatar
Corjan
Posts: 2941
Joined: Thu Nov 19, 2015 9:04 am

Re: API Command to switch of Raspberry PI

#5 Post by Corjan »

Hi,


No problem,

I have implemented the shut_down function in our codebase. Only the "APPLICATION" and "SYSTEM" types.
Next week, I will probably create a new Air Player BETA for Raspberry Pi, it will be included in that version.


Corjan

bmcmullan
Posts: 23
Joined: Sat Sep 02, 2017 2:33 pm
Location: Louisville, KY USA
Contact:

Re: API Command to switch off Raspberry PI

#6 Post by bmcmullan »

I know it's bad form, but I just shut off the mains and dump the PIs - so far, never knackered one after probably 200 such dumps over last three months. I was expecting to have to reflash occasionally, but so far so good.
FSX/P3D/XP11 - i7@5Ghz, GTX1080, 4 screens + Air Manager screen + custom hardware & Avionics COM, GPS, Radios, XPOND, AP (www.simav8.com)

User avatar
brodhaq
Posts: 152
Joined: Wed Jun 29, 2016 4:13 pm

Re: API Command to switch off Raspberry PI

#7 Post by brodhaq »

Hi,
is this in the latest beta yet? Just asking if I should download that beta or not, this would be the only reason for me as I am pretty happy with the stable.

Best regards,
Pavel
Pavel Brodský
Prague, Czech Republic

User avatar
Corjan
Posts: 2941
Joined: Thu Nov 19, 2015 9:04 am

Re: API Command to switch off Raspberry PI

#8 Post by Corjan »

Hi,


Unfortunately, I don't know anymore :) I think it is...

I will make a new BETA tomorrow anyways, so it is definitely in there.


Corjan

User avatar
brodhaq
Posts: 152
Joined: Wed Jun 29, 2016 4:13 pm

Re: API Command to switch off Raspberry PI

#9 Post by brodhaq »

Working perfectly with the latest beta, thank you so much!

Pavel
Pavel Brodský
Prague, Czech Republic

User avatar
Corjan
Posts: 2941
Joined: Thu Nov 19, 2015 9:04 am

Re: API Command to switch off Raspberry PI

#10 Post by Corjan »

No problem.

And sorry for the delay,

Corjan

Post Reply