mirror of
				https://github.com/KevinMidboe/fanController.git
				synced 2025-10-29 17:40:22 +00:00 
			
		
		
		
	Beacuse states are checked before its toggled a new function was made, just to update the GPIO with the fan state last saved in db.
This commit is contained in:
		| @@ -28,21 +28,24 @@ def turnFanON(): | ||||
| 	if not getFanstate(): | ||||
| 		updateFanstate(1) | ||||
| 		GPIO.setup("CSID0", GPIO.OUT)   #set CSID0 as an output | ||||
| 		GPIO.output("CSID0", GPIO.HIGH) #set CSID0 (LED) HIGH (On) | ||||
| 		GPIO.output("CSID0", GPIO.HIGH) #set CSID0 (Relay) HIGH (On) | ||||
| 		return '1' | ||||
|  | ||||
| def turnFanOFF(): | ||||
| 	if getFanstate(): | ||||
| 		updateFanstate(0) | ||||
| 		GPIO.setup("CSID0", GPIO.OUT)   #set CSID0 as an output | ||||
| 		GPIO.output("CSID0", GPIO.LOW) #set CSID0 (LED) HIGH (On) | ||||
| 		GPIO.output("CSID0", GPIO.LOW) #set CSID0 (Relay) LOW (Off) | ||||
| 		return '1' | ||||
|  | ||||
| def reloadFanstate(): | ||||
| 	if (getFanstate()): | ||||
| 		turnFanON() | ||||
| 	GPIO.setup("CSID0", GPIO.OUT)   #set CSID0 as an output | ||||
| 	 | ||||
| 	if getFanstate(): | ||||
| 		GPIO.output("CSID0", GPIO.HIGH) #set CSID0 (Relay) HIGH (On) | ||||
| 	else: | ||||
| 		turnFanOFF() | ||||
| 		updateFanstate(1) | ||||
| 		GPIO.output("CSID0", GPIO.LOW) #set CSID0 (Relay) LOW (Off) | ||||
|  | ||||
| if __name__ == '__main__': | ||||
| 	arg = argv[-1] | ||||
|   | ||||
		Reference in New Issue
	
	Block a user