100%
python
routine_learner.py
1# ShorelineDB — Routine Learner Monitor
2# Edge AI · deployed to device via OTA
3
4from shoreline import Monitor, Device
5from shoreline.ai import BaselineLearner
6import numpy as np
7
8monitor = Monitor(
9 device_id="hvac-zone-a",
10 window="14d",
11 confidence_threshold=0.85
12)
13
14learner = BaselineLearner(
15 model="routine_learner.onnx",
16 inputs=["temp", "occupancy", "weather"]
17)
18
19@monitor.on_cycle
20async def analyze(data: Device.Frame):
21 prediction = await learner.infer(data)
22 if prediction.efficiency_gain > 0.1:
23 await monitor.propose(prediction)
24
25@monitor.on_anomaly
26async def alert(event):
27 await monitor.notify(event, severity="high")
10:42:01shoreline $ deploy smart_hvac.shore --fleet all
10:42:02✓ Workflow validated — 5 nodes, 4 connections
10:42:02✓ Cloud sync: pushing to shorelinedb.io/fleet/smart_hvac_fleet
10:42:03✓ AI monitor deployed — routine_learner.onnx (edge inference on 3 devices)
10:42:03✓ Telemetry stream active — MQTT → cloud broker
10:42:08⚠ Firmware v2.4.2 available — staged deploy ready
10:43:11AI insight: routine pattern detected — compressor cycle can shift 18min earlier
10:43:11Projected savings: 2.3 kWh/day · confidence 93%
shoreline $