Improved handling of show_time

This commit is contained in:
Maximilian Giller 2024-05-07 14:41:00 +02:00
parent 35443b7cc8
commit 33617ec7a3

View file

@ -91,9 +91,6 @@ def check_for_change():
if show_scale_countdown % 3 == 0: if show_scale_countdown % 3 == 0:
show_scale(latest["total"] - empty_weight) show_scale(latest["total"] - empty_weight)
show_scale_countdown -= 1 show_scale_countdown -= 1
elif show_scale_countdown == 0:
show_scale_countdown -= 1
show_time()
# Is triggered? # Is triggered?
delta = latest["total"] - local_history[-2]["total"] delta = latest["total"] - local_history[-2]["total"]
@ -115,11 +112,14 @@ def check_for_change():
number_of_people = round((latest["total"] - empty_weight) / average_person_weight) number_of_people = round((latest["total"] - empty_weight) / average_person_weight)
logging.info(f"Number of people: {number_of_people}") logging.info(f"Number of people: {number_of_people}")
if number_of_people == 1 and weight_increased: # Show scale?
if number_of_people == 1 and weight_increased and show_scale_countdown == 0:
show_scale_countdown = 60 # Should be a multiple of 3 show_scale_countdown = 60 # Should be a multiple of 3
elif number_of_people >= 2 and weight_increased: else:
show_scale_countdown = 0 show_scale_countdown = 0
show_time()
# Make room sexy
if number_of_people >= 2 and weight_increased:
hue.in_room_activate_scene("Max Zimmer", "Sexy") hue.in_room_activate_scene("Max Zimmer", "Sexy")
elif number_of_people == 1 and not weight_increased: elif number_of_people == 1 and not weight_increased:
hue.in_room_activate_scene("Max Zimmer", "Tageslicht") hue.in_room_activate_scene("Max Zimmer", "Tageslicht")