Skip to content

Commit 0f0b427

Browse files
committed
Add sentry for better debugging
1 parent 9f60024 commit 0f0b427

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

WeatherStationCoreLink/Dockerfile.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ RUN pip3 install cffi
2525
RUN pip3 install cairocffi==0.6
2626
RUN pip3 install pyserial pusher
2727
RUN pip3 install balena-sdk
28+
RUN pip3 install sentry-sdk
2829
#pip also install - git+https://github.com/resin-io/resin-sdk-python.git
2930

3031
# Set our working directory

WeatherStationCoreLink/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@
1010
import sqlite3 #Database
1111
import pusher #Pusher.com
1212

13+
import sentry_sdk
14+
from sentry_sdk import capture_message
15+
sentry_sdk.init(
16+
"https://[email protected]/0",
17+
traces_sample_rate=1.0,
18+
)
19+
1320
os.environ['TZ'] = 'Europe/London' #SetTimezone
1421
def log(message):
1522
print(message)
@@ -127,6 +134,8 @@ def looprequest():
127134
errorcount = errorcount + 1
128135
return False # Ignore - there's very little we can do remotely :(
129136
elif data["windSpeed"] > 80 or data["temperatureC"] > 50 or data["humidity"] > 100 or data["windDirection"] > 360:
137+
capture_message(repr(data))
138+
capture_message(response.decode("utf-8"))
130139
log("[INFO] Ignoring data because it's a bit weird")
131140
return False
132141
elif data["windSpeed"] == 0 and data["windDirection"] == 0: #This indicates it's struggling for data so ignore

0 commit comments

Comments
 (0)