Skip to content

Commit aab9105

Browse files
committed
Updated webhook plant code
1 parent 272ec17 commit aab9105

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

Webhook_Plant_Sensor/code.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
from adafruit_seesaw.seesaw import Seesaw
1515
import busio
1616

17+
LOW = False
18+
MIN = 500
19+
1720
# Set up moisture sensor with seesaw
1821
i2c_bus = board.I2C()
1922
seesaw = Seesaw(i2c_bus, addr=0x36)
@@ -79,11 +82,9 @@ def message(client, feed_id, payload):
7982
# Connect to Adafruit IO
8083
print("Connecting to Adafruit IO...")
8184
io.connect()
85+
plant_feed = "plant"
8286

8387
START = 0
84-
LOW = False
85-
86-
MIN = 500
8788

8889
while True:
8990
# read moisture level through capacitive touch pad
@@ -94,12 +95,12 @@ def message(client, feed_id, payload):
9495

9596
if touch < MIN:
9697
if not LOW:
97-
io.publish("plant", touch)
98+
io.publish(plant_feed, touch)
9899
print("published")
99100
LOW = True
100101

101102
elif touch >= MIN and time.time() - START > 10:
102-
io.publish("plant", touch)
103+
io.publish(plant_feed, touch)
103104
print("published to Adafruit IO")
104105
START = time.time()
105106
LOW = False

0 commit comments

Comments
 (0)