added missing updated for boilstep

This commit is contained in:
avollkopf 2022-10-22 13:02:13 +02:00
parent 9a1e457505
commit 17a2d403bf

View file

@ -322,12 +322,19 @@ class ActorStep(CBPiStep):
Property.Select(label="LidAlert",options=["Yes","No"], description="Trigger Alert to remove lid if temp is close to boil"),
Property.Select(label="AutoMode",options=["Yes","No"], description="Switch Kettlelogic automatically on and off -> Yes"),
Property.Select("First_Wort", options=["Yes","No"], description="First Wort Hop alert if set to Yes"),
Property.Text("First_Wort_text", configurable = True, description="First Wort Hop alert text"),
Property.Number("Hop_1", configurable = True, description="First Hop alert (minutes before finish)"),
Property.Text("Hop_1_text", configurable = True, description="First Hop alert text"),
Property.Number("Hop_2", configurable=True, description="Second Hop alert (minutes before finish)"),
Property.Text("Hop_2_text", configurable = True, description="Second Hop alert text"),
Property.Number("Hop_3", configurable=True, description="Third Hop alert (minutes before finish)"),
Property.Text("Hop_3_text", configurable = True, description="Third Hop alert text"),
Property.Number("Hop_4", configurable=True, description="Fourth Hop alert (minutes before finish)"),
Property.Text("Hop_4_text", configurable = True, description="Fourth Hop alert text"),
Property.Number("Hop_5", configurable=True, description="Fifth Hop alert (minutes before finish)"),
Property.Number("Hop_6", configurable=True, description="Sixth Hop alert (minutes before finish)")])
Property.Text("Hop_5_text", configurable = True, description="Fifth Hop alert text"),
Property.Number("Hop_6", configurable=True, description="Sixth Hop alert (minutes before finish)"),
Property.Text("Hop_6_text", configurable = True, description="Sixth Hop alert text")])
class BoilStep(CBPiStep):
@action("Start Timer", [])
@ -367,6 +374,7 @@ class BoilStep(CBPiStep):
self.AutoMode = True if self.props.get("AutoMode", "No") == "Yes" else False
self.first_wort_hop_flag = False
self.first_wort_hop=self.props.get("First_Wort", "No")
self.first_wort_hop_text=self.props.get("First_Wort_text", None)
self.hops_added=["","","","","",""]
self.remaining_seconds = None
@ -389,10 +397,13 @@ class BoilStep(CBPiStep):
await self.setAutoMode(True)
await self.push_update()
async def check_hop_timer(self, number, value):
async def check_hop_timer(self, number, value, text):
if value is not None and self.hops_added[number-1] is not True:
if self.remaining_seconds != None and self.remaining_seconds <= (int(value) * 60 + 1):
self.hops_added[number-1]= True
if text is not None and text != "":
self.cbpi.notify('Hop Alert', "Please add %s (%s)" % (text, number), NotificationType.INFO)
else:
self.cbpi.notify('Hop Alert', "Please add Hop %s" % number, NotificationType.INFO)
async def on_stop(self):
@ -409,6 +420,9 @@ class BoilStep(CBPiStep):
async def run(self):
if self.first_wort_hop_flag == False and self.first_wort_hop == "Yes":
self.first_wort_hop_flag = True
if self.first_wort_hop_text is not None and self.first_wort_hop_text != "":
self.cbpi.notify('First Wort Hop Addition!', 'Please add %s for first wort' % self.first_wort_hop_text, NotificationType.INFO)
else:
self.cbpi.notify('First Wort Hop Addition!', 'Please add hops for first wort', NotificationType.INFO)
while self.running == True:
@ -426,7 +440,7 @@ class BoilStep(CBPiStep):
self.cbpi.notify(self.name, 'Timer started. Estimated completion: {}'.format(estimated_completion_time.strftime("%H:%M")), NotificationType.INFO)
else:
for x in range(1, 6):
await self.check_hop_timer(x, self.props.get("Hop_%s" % x, None))
await self.check_hop_timer(x, self.props.get("Hop_%s" % x, None), self.props.get("Hop_%s_text" % x, None))
return StepResult.DONE