Message from @Big T
Discord ID: 605698188468551682
whats the idea? and why would you use a shell script for it lol?
easier to write than a python script cuz i dont wanna encase everything in a fuckin function
so my linux machine is my laptop and i want to be able to have it on at all times so tasks and bots can run all the time
you technically dont have to with python
automation eh? 💤
so i bought a pack of smart plugs....
and even if you had to wrap it with a function, its only 2 more lines
function definition and a line calling it
but again, you can just write python with out any function declarations.
im gonna use this to toggle the smart plug
(work in progress, got some shit to move around)
```
upower -i $(upower -e | grep BAT) | egrep 'state|percentage' > .power-temp
cut -c 26- .power-temp | sponge .power-temp
STATE=`head -1 .power-temp`
PERC=`tail -1 .power-temp | cut -c -2`
case $STATE in
charging)
echo charging
;;
discharging)
echo discharging
;;
fully-charged)
echo fully-charged
;;
esac
if [ $PERC -le '20' ]; then
echo '<=20%'
fi
rm .power-temp
```
ew
ikr
it's aids
why write that then?
cuz i didnt know how to do it efficiently with python
people keep telling me that but idk how
does the smart plug have an api?
think so
it works with IFTTT and Alexa n shit so i assume so
well i dont have the plug yet so ill redesign it when i get it
have my laptop charger only be receiving power when the laptop needs to be charged
cronjob will check every 5 minutes for if it's 20% or under
cuz it looks like all you are doing is querying the status of the plug and then running a switch statement
yeah like i said it was just a skeleton of the program
does your laptop not auto shut off the power when fully charged?
err script
do laptops do that?
mhmm
<:Thonk:414176518936330241>
well the power brick gets really fucking spicy hot and i just wanna minimize that
lol
because as i said
my laptop serves as my linux server
i dont use it, it's just for SSHing
it's just an old 2012 gaming laptop
if its getting hot then its charging up, so your battery is discharging.
it being a gaming laptop means its power draw would be more than normal laptops.
yeah thats why ive been srsly thinkin bout getting a rasp pi 4
or an odroid