Compare commits
No commits in common. "777d79aec8a6d6c2809709e735f069a22d335466" and "23d9e306b7323a376e475da7dfeb549fa9f9397a" have entirely different histories.
777d79aec8
...
23d9e306b7
@ -1,2 +1 @@
|
||||
from . import fuel_check
|
||||
plugins = [fuel_check]
|
||||
plugins = []
|
||||
|
@ -1,26 +0,0 @@
|
||||
import time
|
||||
|
||||
start = time.monotonic()
|
||||
last_message = None
|
||||
threshold = 5
|
||||
|
||||
def check(data, emit):
|
||||
"Checks if the fuel ratio is below a certain threshold"
|
||||
global last_message
|
||||
if "FuelRatio" not in data:
|
||||
return
|
||||
|
||||
ratio = data["FuelRatio"]
|
||||
if ratio <= threshold:
|
||||
if last_message is None:
|
||||
emit("switchPlugin", {
|
||||
"plugin": "warning",
|
||||
"data": {
|
||||
"title": "Low Fuel",
|
||||
"description": f"Only {int(ratio)}% fuel left. Please refill the tank."
|
||||
},
|
||||
"time": 5000
|
||||
})
|
||||
last_message = time.monotonic()
|
||||
else:
|
||||
last_message = None
|
@ -1,3 +1,3 @@
|
||||
OSD_URL = "http://localhost:5050/send"
|
||||
OSD_URL = "http://localhost:5050/send/"
|
||||
CAR_API_URL = "http://localhost:5000/all/"
|
||||
DELAY = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user