mirror of
https://github.com/KevinMidboe/fanController.git
synced 2025-10-29 17:40:22 +00:00
Added check for last input item in fanController main function
This commit is contained in:
@@ -40,7 +40,7 @@ def turnFanOFF():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
arg = argv[1]
|
arg = argv[-1]
|
||||||
if (arg == 'on'):
|
if (arg == 'on'):
|
||||||
print(turnFanON())
|
print(turnFanON())
|
||||||
elif (arg == 'off'):
|
elif (arg == 'off'):
|
||||||
@@ -48,4 +48,4 @@ if __name__ == '__main__':
|
|||||||
elif (arg == 'get'):
|
elif (arg == 'get'):
|
||||||
print(getFanstate())
|
print(getFanstate())
|
||||||
else:
|
else:
|
||||||
print("Invalid input")
|
print("Invalid input")
|
||||||
|
|||||||
Binary file not shown.
@@ -21,7 +21,6 @@ app.get('/state', function(req, res) {
|
|||||||
|
|
||||||
PythonShell.run('scripts/fanController.py', options, function (err, results) {
|
PythonShell.run('scripts/fanController.py', options, function (err, results) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|
||||||
if (results[0] == true)
|
if (results[0] == true)
|
||||||
res.send('on')
|
res.send('on')
|
||||||
else
|
else
|
||||||
@@ -37,8 +36,8 @@ app.post('/on', function (req, res) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
PythonShell.run('scripts/fanController.py', options, function (err, results) {
|
PythonShell.run('scripts/fanController.py', options, function (err, results) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
|
|
||||||
if (results[0] == true)
|
if (results[0] == true)
|
||||||
res.send('on')
|
res.send('on')
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user