viewof useLocalControl = Inputs.toggle({
label: "Enable Local LAN Control",
value: false
})
viewof deviceProtocol = Inputs.select(["Zigbee", "Wi-Fi", "Thread"], {
label: "Device Protocol",
value: "Zigbee"
})
wakeWordMs = 150
cloudNLUMs = 1200
deviceLatency = deviceProtocol === "Zigbee" ? 250 : deviceProtocol === "Thread" ? 100 : 300
cloudToCloudMs = useLocalControl ? 0 : 350
natTraversalMs = useLocalControl ? 0 : 600
lanDirectMs = useLocalControl ? 200 : 0
totalLatency = wakeWordMs + cloudNLUMs + cloudToCloudMs + natTraversalMs + lanDirectMs + deviceLatency
html`<div style="background: #f8f9fa; padding: 20px; border-radius: 8px; border-left: 4px solid #3498DB;">
<h4 style="color: #2C3E50; margin-top: 0;">Voice Command Latency Breakdown</h4>
<div style="margin-bottom: 15px;">
<div style="font-size: 14px; color: #7F8C8D;">Total Response Time</div>
<div style="font-size: 32px; font-weight: bold; color: ${totalLatency < 2000 ? '#16A085' : totalLatency < 3000 ? '#E67E22' : '#E74C3C'};">
${totalLatency}ms
</div>
</div>
<div style="display: grid; gap: 8px;">
<div style="display: flex; justify-content: space-between; padding: 8px; background: white; border-radius: 4px;">
<span style="color: #7F8C8D;">Wake Word Detection</span>
<span style="font-weight: bold; color: #2C3E50;">${wakeWordMs}ms</span>
</div>
<div style="display: flex; justify-content: space-between; padding: 8px; background: white; border-radius: 4px;">
<span style="color: #7F8C8D;">Cloud NLU Processing</span>
<span style="font-weight: bold; color: #2C3E50;">${cloudNLUMs}ms</span>
</div>
${cloudToCloudMs > 0 ? html`<div style="display: flex; justify-content: space-between; padding: 8px; background: #fff3cd; border-radius: 4px;">
<span style="color: #7F8C8D;">Cloud-to-Cloud Hop</span>
<span style="font-weight: bold; color: #E67E22;">${cloudToCloudMs}ms</span>
</div>` : ''}
${natTraversalMs > 0 ? html`<div style="display: flex; justify-content: space-between; padding: 8px; background: #fff3cd; border-radius: 4px;">
<span style="color: #7F8C8D;">NAT Traversal</span>
<span style="font-weight: bold; color: #E67E22;">${natTraversalMs}ms</span>
</div>` : ''}
${lanDirectMs > 0 ? html`<div style="display: flex; justify-content: space-between; padding: 8px; background: #d4edda; border-radius: 4px;">
<span style="color: #7F8C8D;">LAN Direct Control</span>
<span style="font-weight: bold; color: #16A085;">${lanDirectMs}ms</span>
</div>` : ''}
<div style="display: flex; justify-content: space-between; padding: 8px; background: white; border-radius: 4px;">
<span style="color: #7F8C8D;">${deviceProtocol} Device Response</span>
<span style="font-weight: bold; color: #2C3E50;">${deviceLatency}ms</span>
</div>
</div>
${useLocalControl ? html`<div style="margin-top: 15px; padding: 10px; background: #d4edda; border-radius: 4px; color: #155724;">
✓ Local control eliminates ${cloudToCloudMs + natTraversalMs}ms of cloud latency
</div>` : html`<div style="margin-top: 15px; padding: 10px; background: #fff3cd; border-radius: 4px; color: #856404;">
Local control could save ${cloudToCloudMs + natTraversalMs}ms (${(((cloudToCloudMs + natTraversalMs) / totalLatency) * 100).toFixed(0)}% reduction)
</div>`}
</div>`Voice Assistant Latency Calculator
Voice Assistant Latency Calculator
animation
applications
smart-home
Try Toggle Enable Local LAN Control, then press Calculate latency.
Observe After Calculate latency, watch Total Response Time and LAN Direct Control.
Explain Describe how Device Protocol changes Total Response Time after Calculate latency.
Technical boundaries. Wake Word Detection and Cloud NLU Processing use fixed times. Local control removes Cloud-to-Cloud Hop and NAT Traversal but adds LAN Direct Control.