M
manwithnoname
you rock Fred! I might just have to take that IT leap on my next grow
#!/usr/bin/perl
# Import something called a library so that perl understand telnet protocol
use Net::Telnet;
# Set your max and minimum temperatures here (this is degrees Celcius)
$max_temp = 26;
$min_temp = 22;
# This line only records what time the script started
$start_time=localtime;
# Okay, here is some programming mumbojumbo. We want a program that runs all the time, over and over again.
# So I tell this program to repeat and repeat (called: while) until untrue (the (1)).
# In programming 1 is always true, while 0 (zero) is always untrue.
# Since the "while" will continue to repeat until 1 is untrue, it's gonna have to run for a while
while (1){
# This line records what time it is last time script is run
$time_now = localtime;
# This is mumbojumbo again. A sub is a procedure. A procedure does not run until it is called apon.
# Later on I will call this sub so I get the temperatur from the powerswitch.
# The code inside here is also a bit "tricky". I first give a command to the powerswitch "envmon"
# to get the output form the switch.
# Then I look through all the lines returned for a bit that says "Deg", and take the number in front of it.
# It then returns the temperatur back to the place that called this sub.
sub get_temp {
@temp_number = $telnet->cmd('Envmon');
foreach $number (@temp_number)
{
$temp = $number =~ m/.*telt\s*(.*) Deg/;
$temp = $1;
}
return $temp;
}
# Again a sub. Called when I want to turn shit on. It sends turn on outlet 2 and 3 to the switch. And after each one
# writes that it did it.
sub turn_on_equipment {
$telnet->cmd('on .a2');
print "Turned on heat\n";
$telnet->cmd('on .a3');
print "Turned on fan.\n";
}
# Same as above, but to turn stuff off.
sub turn_off_equipment {
$telnet->cmd('off .a2');
print "Turn off heat\n";
$telnet->cmd('off .a3');
print "Turn off fan\n";
}
# Okay, first part of the program. This is run before the subs actually. Since the subs will not run before they are called upon.
# The subs must be "declared" before they are called upon in a computer program. So thats why the script starts with them.
# But it is the part below that is first "triggerd" when the while loop runs once more.
# Here I connect to the switch with the telenet protocol. I say it should timeout if no conntact is esablished within 10 seconds
# and that it should look for the ":" sign before it tryes to log inn with username/password.
$telnet = new Net::Telnet ( Timeout=>10, Errmode=>'return', Prompt => '/\: $/i');
# What IP address to talk to.
$telnet->open('192.168.1.101');
# Write username/password
$telnet->login('admn', 'admn');
# Okay, here we should be connected to the switch, so lets call the sub that gets the temp. Code in the sub named get_temp
# is now excecuted. And remember that it will return the temperatur. I store this "returned" temperatur in something called a
# variable (shoe box), so when I need it later I will just call upon it.
$temperatur = &get_temp();
# I now check to see if temperatur returned to me is higher that max temp (remmeber you put this in a shoe box all the way on the
# top of this program.
# Note that I also count how many times max temp has been reached. If reached 13 times or more, well then call the sub turn_off_equipment
# which will turn outlet 2 and 3 off. Since that part has not been called yet since it is a sub.
# I also clear the counter for how many times it has been reached.
if ($temperatur >= $max_temp){
if ($top >= 13){
&turn_off_equipment();
$top = 0;
$bottom = 0;
}
$top ++;
print "Temp is more than $max_temp\n";
}
# Same as above, but I check to see if temp is lower than min_temp (minimum temperatur set in the beginning).
elsif ($temperatur <= $min_temp && $temperatur > 1){
if ($bottom >= 5){
&turn_on_equipment();
$top = 0;
$bottom = 0;
}
$bottom++;
print "Temp is less than $min_temp\n";
}
# You reach here if the temperatur measured is between max and min temperatur.
else
{
print "Temp is fine...\n Started script: $start_time\n Time now is: $time_now\n";
}
# Now it is time to disconnect from the powerswitch. End telenet session.
$telnet->close;
# Now go to sleep for 5 seconds. When you wake up go and see if while is untrue. Guess what, it's not. Since 1 is always true.
# So I guess we run again.
sleep(5);
}
Update time.
It's now 3 days since last pics. Here is an update.
The pot is now "dry" and she has taken up the 1 liter (1/4 gallon) she was given 1 week ago. Time for some more. No nutes this time either since she has only been 1 week in the new soil. Next time she is gonna get a dash.
Small curl on end of some leafs, probably because she want's some water.
Mugshot today:
and 3 days ago:
Happy with the progress. She is going under 600W MH today or tomorrow. My plan is to give her the MH for 1 week or 2 before I take the clones.
Hey there Light.
man, you gotta love the high tech grow!!
moving to 600w MH huh....i hope you will be moving the light away a bit or that baby is gonna burn!!!
Good luck, i am pulling up a chair
She is looking GREAT!!!!!!!!! Damn looks like 2 plants in one. Very nice my friend very nice.
Nice room you have got going there .Pulls up a chair for the show ,what strain is it you are growing .