forked from onlywade/igrill
-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmonitor_igrill_v2.py
More file actions
39 lines (31 loc) · 883 Bytes
/
Copy pathmonitor_igrill_v2.py
File metadata and controls
39 lines (31 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import json
import time
import requests
from igrill import IGrillV2Peripheral
ADDRESS = 'D4:81:CA:23:67:A1'
INTERVAL = 15
url = 'https://your-api/bbq/'
if __name__ == '__main__':
periph = IGrillV2Peripheral(ADDRESS)
while True:
temperature=periph.read_temperature()
# Probe 1
if temperature[1] != 63536.0:
mytemp = {'probe1': temperature[1]}
requests.post(url, data = mytemp)
# Probe 2
if temperature[2] != 63536.0:
mytemp = {'probe1': temperature[2]}
requests.post(url, data = mytemp)
# Probe 3
if temperature[3] != 63536.0:
mytemp = {'probe1': temperature[3]}
requests.post(url, data = mytemp)
# Probe 4
if temperature[4] != 63536.0:
mytemp = {'probe1': temperature[4]}
requests.post(url, data = mytemp)
# Battery
mybattery = {'batter': periph.read_battery()}
requests.post(url, data = mybattery)
time.sleep(INTERVAL)