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():
|
if not getFanstate():
|
||||||
updateFanstate(1)
|
updateFanstate(1)
|
||||||
GPIO.setup("CSID0", GPIO.OUT) #set CSID0 as an output
|
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'
|
return '1'
|
||||||
|
|
||||||
def turnFanOFF():
|
def turnFanOFF():
|
||||||
if getFanstate():
|
if getFanstate():
|
||||||
updateFanstate(0)
|
updateFanstate(0)
|
||||||
GPIO.setup("CSID0", GPIO.OUT) #set CSID0 as an output
|
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'
|
return '1'
|
||||||
|
|
||||||
def reloadFanstate():
|
def reloadFanstate():
|
||||||
if (getFanstate()):
|
GPIO.setup("CSID0", GPIO.OUT) #set CSID0 as an output
|
||||||
turnFanON()
|
|
||||||
else:
|
if getFanstate():
|
||||||
turnFanOFF()
|
GPIO.output("CSID0", GPIO.HIGH) #set CSID0 (Relay) HIGH (On)
|
||||||
|
else:
|
||||||
|
updateFanstate(1)
|
||||||
|
GPIO.output("CSID0", GPIO.LOW) #set CSID0 (Relay) LOW (Off)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
arg = argv[-1]
|
arg = argv[-1]
|
||||||
|
|||||||
Reference in New Issue
Block a user