Message from @Vesdii

Discord ID: 605698154591158273


2019-07-30 09:41:44 UTC  

it took me all night to get the bones and tendons of this idea out onto a shell script

2019-07-30 09:42:04 UTC  

whats the idea? and why would you use a shell script for it lol?

2019-07-30 09:42:29 UTC  

easier to write than a python script cuz i dont wanna encase everything in a fuckin function

2019-07-30 09:43:12 UTC  

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

2019-07-30 09:43:20 UTC  

you technically dont have to with python

2019-07-30 09:44:08 UTC  

automation eh? 💤

2019-07-30 09:44:23 UTC  

so i bought a pack of smart plugs....

2019-07-30 09:44:49 UTC  

and even if you had to wrap it with a function, its only 2 more lines

2019-07-30 09:45:00 UTC  

function definition and a line calling it

2019-07-30 09:45:21 UTC  

but again, you can just write python with out any function declarations.

2019-07-30 09:45:54 UTC  

im gonna use this to toggle the smart plug

2019-07-30 09:46:20 UTC  

(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
```

2019-07-30 09:46:39 UTC  

ew

2019-07-30 09:46:41 UTC  

ikr

2019-07-30 09:46:44 UTC  

it's aids

2019-07-30 09:46:51 UTC  

why write that then?

2019-07-30 09:47:14 UTC  

cuz i didnt know how to do it efficiently with python

2019-07-30 09:47:26 UTC  

people keep telling me that but idk how

2019-07-30 09:47:55 UTC  

does the smart plug have an api?

2019-07-30 09:48:01 UTC  

think so

2019-07-30 09:48:13 UTC  

it works with IFTTT and Alexa n shit so i assume so

2019-07-30 09:48:21 UTC  

start there

2019-07-30 09:48:42 UTC  

well i dont have the plug yet so ill redesign it when i get it

2019-07-30 09:49:07 UTC  

have my laptop charger only be receiving power when the laptop needs to be charged

2019-07-30 09:49:34 UTC  

cronjob will check every 5 minutes for if it's 20% or under

2019-07-30 09:49:43 UTC  

cuz it looks like all you are doing is querying the status of the plug and then running a switch statement

2019-07-30 09:50:06 UTC  

yeah like i said it was just a skeleton of the program

2019-07-30 09:50:14 UTC  

does your laptop not auto shut off the power when fully charged?

2019-07-30 09:50:14 UTC  

err script

2019-07-30 09:50:27 UTC  

do laptops do that?

2019-07-30 09:50:41 UTC  

mhmm

2019-07-30 09:50:48 UTC  

<:Thonk:414176518936330241>

2019-07-30 09:51:21 UTC  

well the power brick gets really fucking spicy hot and i just wanna minimize that

2019-07-30 09:51:43 UTC  

lol

2019-07-30 09:51:46 UTC  

because as i said

2019-07-30 09:51:55 UTC  

my laptop serves as my linux server

2019-07-30 09:52:02 UTC  

i dont use it, it's just for SSHing

2019-07-30 09:52:29 UTC  

it's just an old 2012 gaming laptop

2019-07-30 09:52:30 UTC  

if its getting hot then its charging up, so your battery is discharging.

2019-07-30 09:52:47 UTC  

it being a gaming laptop means its power draw would be more than normal laptops.

2019-07-30 09:53:11 UTC  

yeah thats why ive been srsly thinkin bout getting a rasp pi 4