Update GlucoseCheck.py

Enkele typo's eruit gehaald om te kunnen runnen.
This commit is contained in:
Bart Koolen 2025-02-24 23:11:26 +01:00
parent 153ce6b02e
commit 2625295898

View file

@ -96,10 +96,11 @@ def main(url_main, headers_main):
print(f"hrs after last bolus: {round(hours_since_last_bolus, 1)}")
# linear interpolation of gluc_upper_limit = a[int] + (a[int+1]-a[n]) * frac_part
gluc_upper_limit = limits_table[last_bolus_type][int(hours_since_last_bolus)][0] +
(limits_table[last_bolus_type][int(hours_since_last_bolus+1)][0] - limits_table[last_bolus_type][int(hours_since_last_bolus)][0]) * (hours_since_last_bolus-int(hours_since_last_bolus))
gluc_upper_limit = limits_table[last_bolus_type][int(hours_since_last_bolus)][0] + \
(limits_table[last_bolus_type][int(hours_since_last_bolus+1)][0] - limits_table[last_bolus_type][int(hours_since_last_bolus)][0]) \
* (hours_since_last_bolus-int(hours_since_last_bolus))
if ((gluc_value > gluc_upper_limit) or
(gluc_slope > limits_table[last_bolus_type][hours_since_last_bolus][1])):
(gluc_slope > limits_table[last_bolus_type][int(hours_since_last_bolus)][1])):
print("Hey joh check je glucosepeil !")
Mqtt.publish(send_topic, f"Hey joh check peil ! (lastbolus -{round(hours_since_last_bolus, 1)})")
@ -145,4 +146,4 @@ Mqtt.connect(broker_address, broker_port, 60) #Set Connection
Mqtt.loop_start() #Start connecting
if __name__ == "__main__":
main(url, headers)
main(url, headers)