Skip to content

Commit 0eef868

Browse files
authored
Correct lint issues
Feather_Freezer_Alarm/code.py:180: Unnecessary parens after 'if' keyword (superfluous-parens) Feather_Freezer_Alarm/code.py:252: Unnecessary parens after 'if' keyword (superfluous-parens) Feather_Freezer_Alarm/code.py:79: Unused argument 'client' (unused-argument) Feather_Freezer_Alarm/code.py:180: Comparison 'prealarm == True' should be 'prealarm is True' if checking for the singleton value True, or 'prealarm' if testing for truthiness (singleton-comparison) Feather_Freezer_Alarm/code.py:197: Comparison 'alarm1 == False' should be 'alarm1 is False' if checking for the singleton value False, or 'not alarm1' if testing for falsiness (singleton-comparison) Feather_Freezer_Alarm/code.py:197: Comparison 'alarm2 == False' should be 'alarm2 is False' if checking for the singleton value False, or 'not alarm2' if testing for falsiness (singleton-comparison) Feather_Freezer_Alarm/code.py:197: Comparison 'prealarm == False' should be 'prealarm is False' if checking for the singleton value False, or 'not prealarm' if testing for falsiness (singleton-comparison) Feather_Freezer_Alarm/code.py:236: Comparison 'alarm1 == False' should be 'alarm1 is False' if checking for the singleton value False, or 'not alarm1' if testing for falsiness (singleton-comparison) Feather_Freezer_Alarm/code.py:243: Comparison 'alarm2 == False' should be 'alarm2 is False' if checking for the singleton value False, or 'not alarm2' if testing for falsiness (singleton-comparison) Feather_Freezer_Alarm/code.py:11: Unused import neopixel (unused-import) Feather_Freezer_Alarm/code.py:16: Unused import supervisor (unused-import)
1 parent 0e9cf83 commit 0eef868

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Feather_Freezer_Alarm/code.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
import socketpool
99
import wifi
1010
import board
11-
import neopixel
1211
import adafruit_minimqtt.adafruit_minimqtt as MQTT
1312
from adafruit_io.adafruit_io import IO_MQTT
1413
import digitalio
1514
from adafruit_debouncer import Debouncer
16-
import supervisor
1715

1816
#setup buzzer1
1917
buzzer1 = digitalio.DigitalInOut(board.D13)
@@ -76,7 +74,7 @@
7674
)
7775

7876
# Define callback functions which will be called when certain events happen.
79-
def connected(client):
77+
def connected():
8078
print("Connected to Adafruit IO! Listening for Freezer changes...")
8179

8280
# Initialize Adafruit IO MQTT "helper"
@@ -177,7 +175,7 @@ def connected(client):
177175
if not rightswitch.value and not leftswitch.value:
178176
print('doors just closed')
179177
#if prelarm is true then set it to False
180-
if(prealarm == True):
178+
if prealarm is True:
181179
buzzer1.value = False
182180
#if an alarm is true then upload to IO alarm resolved
183181
if alarm1 or alarm2:
@@ -194,7 +192,7 @@ def connected(client):
194192
io.publish(resolvedfeed, 0)
195193

196194
#check motion sensor if there is no alarm
197-
if(alarm1 == False and alarm2 == False and prealarm == False):
195+
if(alarm1 is False and alarm2 is False and prealarm is False):
198196
#update pir sensor
199197
motion.update()
200198
#if motion stopped
@@ -233,14 +231,14 @@ def connected(client):
233231
buzzer1.value = False
234232

235233
#check if difference between time now and start1 if more than X seconds turn on buzzer2
236-
if (alarm1 == False and ((time.monotonic() - start1) >= 600)):
234+
if (alarm1 is False and ((time.monotonic() - start1) >= 600)):
237235
alarm1 = True
238236
buzzer2.value = True
239237
#publish 1 to alarm feed
240238
io.publish(alarmfeed, 1)
241239

242240
#check if difference between time now and start2 if more than X seconds turn on buzzer2
243-
if (alarm2 == False and ((time.monotonic() - start2) >= 600)):
241+
if (alarm2 is False and ((time.monotonic() - start2) >= 600)):
244242
alarm2 = True
245243
buzzer2.value = True
246244
#publish 1 to alarm feed
@@ -249,7 +247,7 @@ def connected(client):
249247
print(str(time.time()))
250248
print(str(int(time.time()/300)))
251249
#check if 300 seconds have passed compared to start time, if so publish values
252-
if(int(time.time()/300) > start):
250+
if int(time.time()/300) > start:
253251
print("PUBLISH EVERY FIVE MINUTES")
254252
start = int(time.time()/300)
255253
io.publish(door1feed, int(leftswitch.value))

0 commit comments

Comments
 (0)