xorbit / LiFePO4wered-Pi

Access library, command line tool and daemon for the LiFePO4wered/Pi module
GNU General Public License v2.0
132 stars 31 forks source link

Nice, but it would be nice to have loss of external power logged #27

Closed garethhowell closed 4 years ago

garethhowell commented 5 years ago

The main daemon only does something when the battery expires and the system needs to be shutdown. It would be nice if there was some way of signalling that external power was lost and we are now running on battery: i.e. something more akin to the level of information you get from something like a APC UPS

xorbit commented 5 years ago

The daemon provides the minimum functionality to make the device work as expected for most people. If you want more functionality than that you can add what you want to the daemon yourself, or use the provided tools to implement the behavior in your own separate programs or scripts.

For instance you can query lifepo4wered-cli get vin to see if external power is lost and take appropriate action from a shell script. Or use the C, Python or Node.js bindings to do it.

garethhowell commented 5 years ago

Fair point, Patrick. I’ll see what I can do. It’s been a (very) long time since I did any C programming (about 50 years I think), but I’ll give some thought to forking the code and having a go.

Gareth

On 17 May 2019 at 22:54:24, Patrick Van Oosterwijck ( notifications@github.com) wrote:

The daemon provides the minimum functionality to make the device work as expected for most people. If you want more functionality than that you can add what you want to the daemon yourself, or use the provided tools to implement the behavior in your own separate programs or scripts.

For instance you can query lifepo4wered-cli get vin to see if external power is lost and take appropriate action from a shell script. Or use the C, Python or Node.js bindings to do it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xorbit/LiFePO4wered-Pi/issues/27?email_source=notifications&email_token=AAEQKNR2NWTARVL3P2HLFIDPV4SRBA5CNFSM4HNUDQR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVV6MBY#issuecomment-493610503, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEQKNXWU4AA2VFNWOU3DCTPV4SRBANCNFSM4HNUDQRQ .

ristomatti commented 5 years ago

I gave this issue thumbs up but also understand the design philosophy. @garethhowell I think it'll be far easier to write a simple shell script to do this. Just request the value once a minute for example and either log the event where you want. If you create a systemd service definition file to keep it running, you can also pass the output to a system log if that is what you're after.

garethhowell commented 5 years ago

That makes sense, @ristomatti. I’ve done a few system daemons in python, so I’ll use that.

Gareth

On 18 May 2019 at 14:50:43, Ristomatti Airo (notifications@github.com) wrote:

I gave this issue thumbs up but also understand the design philosophy. @garethhowell https://github.com/garethhowell I think it'll be far easier to write a simple shell script to do this. Just request the value once a minute for example and either log the event where you want. If you create a systemd service definition file to keep it running, you can also pass the output to a system log if that is what you're after.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xorbit/LiFePO4wered-Pi/issues/27?email_source=notifications&email_token=AAEQKNRR7QZMNMVZNZC2QZLPWACTHA5CNFSM4HNUDQR2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVWPAMY#issuecomment-493678643, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEQKNVK3KRLTXMZGKN7QDDPWACTHANCNFSM4HNUDQRQ .