Handle calibration times

This commit is contained in:
Davide Depau 2023-09-17 18:04:35 +02:00
parent 88fc0940c4
commit b74feed771
2 changed files with 26 additions and 15 deletions

29
bot.py
View file

@ -214,22 +214,33 @@ class Bot:
) )
return return
self.tapo.setPreset(presets[self.profile_name]) self.tapo.setPreset(presets[self.profile_name])
self.tapo.setPrivacyMode(privacy_mode) message = await self.bot.send_message(
await self.bot.send_message(
chat_id=msg.chat_id, chat_id=msg.chat_id,
text=f"Repositioned to profile '{self.profile_name}'", text=f"Repositioning to profile '{self.profile_name}'...",
)
await asyncio.sleep(5)
self.tapo.setPrivacyMode(privacy_mode)
await self.bot.edit_message_text(
chat_id=msg.chat_id,
message_id=message.message_id,
text=f"Repositioning complete",
) )
case "/calibrate": case "/calibrate":
privacy_mode = self.tapo.getPrivacyMode() privacy_mode = self.tapo.getPrivacyMode()
self.tapo.setPrivacyMode(False)
await asyncio.sleep(0.3)
self.tapo.calibrateMotor() self.tapo.calibrateMotor()
presets = self._get_presets() message = await self.bot.send_message(
if self.profile_name in presets:
self.tapo.setPreset(presets[self.profile_name])
self.tapo.setPrivacyMode(privacy_mode)
await self.bot.send_message(
chat_id=msg.chat_id, chat_id=msg.chat_id,
text=f"Calibrated and repositioned to profile '{self.profile_name}'", text=f"Calibrating, this will take ~25s...",
) )
await asyncio.sleep(26)
await self.bot.edit_message_text(
chat_id=msg.chat_id,
message_id=message.message_id,
text=f"Calibration complete",
)
self.tapo.setPrivacyMode(privacy_mode)
case "/light_on": case "/light_on":
await self._send_item_command("ON") await self._send_item_command("ON")
await self.bot.send_message( await self.bot.send_message(

View file

@ -1,10 +1,10 @@
photo - Take a photo of the grocery list board photo - Take a photo of the grocery list board
calibrate - Calibrate the camera motor and re-aim
reposition - Re-aim the camera
light_on - Turn on the light
light_off - Turn off the light
light_status - Check the status of the light
photo_unprocessed - Take a photo of the grocery list board without processing photo_unprocessed - Take a photo of the grocery list board without processing
calibrate - Calibrate the camera motor
reposition - Re-aim the camera
privacy_on - Turn on privacy mode privacy_on - Turn on privacy mode
privacy_off - Turn off privacy mode privacy_off - Turn off privacy mode
privacy_status - Check the status of privacy mode privacy_status - Check the status of privacy mode
light_on - Turn on the light
light_off - Turn off the light
light_status - Check the status of the light