fruxefarms / FruxePi

Indoor farming software using the Raspberry Pi
https://docs.fruxe.co
Other
140 stars 41 forks source link

Lighting schedule doesn’t work properly #74

Open curt2199 opened 4 years ago

curt2199 commented 4 years ago

Running 0.3-beta and have been fighting with it. It doesn’t seem to follow the schedule no matter what I try. Also the listed time until lights on or off always just reflects the current time.

BBC2AFD0-5127-4377-A328-7E7307D954C4

I’m pulling it today to try out some other automation software because having a proper light schedule is critical.

trabogano commented 4 years ago

Same here, beta 4 also affected.

trabogano commented 4 years ago

I found a possible solution, it seems that relay has inverted logic in script. Turn off manual control edit fruxe script with sudo nano /var/www/html/actions/fruxepi.py Relevant section is here:

Lights

elif action == "lights":  

I have edited this line original in this section are ON i have changed in OFF

    # Lights OFF
    if action_option == "-OFF" and action_GPIO is not None: 
        lightsON(action_GPIO, action_interval)

Same here i have switched OFF to ON

    # Lights ON
    elif action_option == "-ON" and action_GPIO is not None:
        lightsOFF(action_GPIO, action_interval)
    # Light Relay State    
    elif action_option == "-s" and action_GPIO is not None:
        print(getRelayGPIOState(action_GPIO, action_interval))

Same here i have inverted on to off and vice versa:

Lights OFF

def lightsON(gpioPIN, reverseRelay): print("Lights OFF") if reverseRelay: os.system("gpio -g mode " + str(gpioPIN) + " out") os.system("gpio -g write " + str(gpioPIN) + " 0") else: os.system("gpio -g mode " + str(gpioPIN) + " out") os.system("gpio -g write " + str(gpioPIN) + " 1")

Lights ON

def lightsOFF(gpioPIN, reverseRelay): print("Lights ON") if reverseRelay: os.system("gpio -g mode " + str(gpioPIN) + " out")

Now my cron job work perfectly but i dont think cron is the best way to do this if you switch to manual and you try to back in automatic light remain off until cron call the program to say lights ON

It need more code for better automation.

epetti commented 4 years ago

Could the same be applied to fans?