Tidy up logging
This commit is contained in:
4
api.py
4
api.py
@@ -9,7 +9,7 @@ def getReq(endpoint) -> dict:
|
|||||||
"Authorization": "Bearer " + TOKEN,
|
"Authorization": "Bearer " + TOKEN,
|
||||||
"content-type": "application/json"
|
"content-type": "application/json"
|
||||||
}
|
}
|
||||||
print("Starting request for " + endpoint)
|
print("GET " + endpoint)
|
||||||
try:
|
try:
|
||||||
response = get(HASS_URL + endpoint, headers=headers)
|
response = get(HASS_URL + endpoint, headers=headers)
|
||||||
return response.json()
|
return response.json()
|
||||||
@@ -22,7 +22,7 @@ def postReq(endpoint, d) -> bool:
|
|||||||
"Authorization": "Bearer " + TOKEN,
|
"Authorization": "Bearer " + TOKEN,
|
||||||
"content-type": "application/json"
|
"content-type": "application/json"
|
||||||
}
|
}
|
||||||
print("Starting post request to " + endpoint)
|
print("POST " + endpoint)
|
||||||
try:
|
try:
|
||||||
response = post(HASS_URL + endpoint, headers=headers, json=d)
|
response = post(HASS_URL + endpoint, headers=headers, json=d)
|
||||||
return response.status_code == 200
|
return response.status_code == 200
|
||||||
|
|||||||
1
app.py
1
app.py
@@ -102,7 +102,6 @@ class App:
|
|||||||
self.scr_n -= 1
|
self.scr_n -= 1
|
||||||
self.lcd.left["v"] = False
|
self.lcd.left["v"] = False
|
||||||
self.lcd.right["v"] = False
|
self.lcd.right["v"] = False
|
||||||
print(f"Screen change: {c}")
|
|
||||||
return c
|
return c
|
||||||
|
|
||||||
def handleButtons(self) -> bool:
|
def handleButtons(self) -> bool:
|
||||||
|
|||||||
@@ -138,10 +138,8 @@ class LightsScreen(Screen):
|
|||||||
# otherwise display the outline lightbulb icon in grey, centrally in the light's grid square
|
# otherwise display the outline lightbulb icon in grey, centrally in the light's grid square
|
||||||
else:
|
else:
|
||||||
color = colour(80, 80, 80)
|
color = colour(80, 80, 80)
|
||||||
print("Drawing light off")
|
|
||||||
with open("images/lightbulb-off.bmp", "rb") as file_handle:
|
with open("images/lightbulb-off.bmp", "rb") as file_handle:
|
||||||
reader = BMPFileReader(file_handle)
|
reader = BMPFileReader(file_handle)
|
||||||
print("Drawing light off - loaded file")
|
|
||||||
img_height = reader.get_height()
|
img_height = reader.get_height()
|
||||||
x_offset = w//2 + xo - reader.get_width()//2
|
x_offset = w//2 + xo - reader.get_width()//2
|
||||||
y_offset = h//2 + yo - reader.get_height()//2 - 4
|
y_offset = h//2 + yo - reader.get_height()//2 - 4
|
||||||
@@ -161,7 +159,6 @@ class LightsScreen(Screen):
|
|||||||
self._invalidConfig(lcd)
|
self._invalidConfig(lcd)
|
||||||
return
|
return
|
||||||
self._updateData()
|
self._updateData()
|
||||||
print("Updating lights")
|
|
||||||
# for each light to be displayed
|
# for each light to be displayed
|
||||||
for i in range(0, len(self.d)):
|
for i in range(0, len(self.d)):
|
||||||
# if its settings have changed, re-draw them without clearing the display
|
# if its settings have changed, re-draw them without clearing the display
|
||||||
|
|||||||
Reference in New Issue
Block a user