Message from @Vesdii
Discord ID: 605698664593358849
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
start there
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?
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
but once it reaches 100% theres an auto cutoff to prevent overcharging
lol you should. i keep telling you 😛
lol
i've got a trip to Fry's Electronics for my 20th birthday in a week planned so yeah ill get somethin
that's how i celebrate
new computer projects
lol at a boy!