The Kitchen Hardware Interface provides tools for controlling and monitoring virtual kitchen equipment in TomatoPy.
Basic Equipment Control
Initializing Equipment
from tomatopy import KitchenHardware# Initialize kitchen hardwarehardware =KitchenHardware()# Initialize specific equipmentoven = hardware.get_oven()stove = hardware.get_stove()blender = hardware.get_blender()
Basic Equipment Control
# Control ovenoven.set_temperature(180)# Celsiusoven.set_mode("bake")oven.set_timer("30m")# Control stovestove.set_burner(1, temperature=100)# Celsiusstove.set_burner(2, temperature=200)# Control blenderblender.set_speed("high")blender.set_duration("1m")
# Set up comprehensive monitoring
with hardware.monitor() as monitor:
# Monitor multiple parameters
monitor.track_temperature(oven)
monitor.track_power_usage(stove)
monitor.track_vibration(blender)
# Get monitoring data
data = monitor.get_data()
print(f"Temperature history: {data.temperature_history}")
print(f"Power usage: {data.power_usage}")
print(f"Vibration levels: {data.vibration_levels}")
Safety Features
Basic Safety Checks
# Perform safety checks
if hardware.check_safety():
# Proceed with operation
oven.start()
else:
print("Safety check failed")
# Check equipment status
status = hardware.check_status()
# Perform basic maintenance
if status.needs_cleaning:
hardware.clean_equipment()
if status.needs_calibration:
hardware.calibrate_equipment()
Advanced Maintenance
# Schedule maintenance
hardware.schedule_maintenance(
oven,
tasks=["clean", "calibrate", "inspect"],
frequency="weekly"
)
# Get maintenance history
history = hardware.get_maintenance_history()
print(f"Last cleaning: {history.last_cleaning}")
print(f"Last calibration: {history.last_calibration}")
Error Handling
try:
# Attempt invalid temperature
oven.set_temperature(1000) # Too hot!
except TemperatureError as e:
print(f"Error: {e}") # "Temperature exceeds safe range"
try:
# Attempt invalid operation
blender.set_speed("invalid_speed")
except OperationError as e:
print(f"Error: {e}") # "Invalid speed setting"
Best Practices
Always Check Equipment Status
# Check status before use
if hardware.check_status().is_ready:
# Proceed with operation
oven.start()
else:
print("Equipment not ready")
Monitor Temperature
# Monitor temperature during operation
with hardware.temperature_monitor() as monitor:
oven.start()
if monitor.get_max() > safety_threshold:
print("Warning: Temperature too high")