一键导入
auth-before-dedup
Never let cached-state dedup bypass session validity in cloud-backed Hubitat drivers.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Never let cached-state dedup bypass session validity in cloud-backed Hubitat drivers.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Pattern for keeping a rolling temperature-trend sample buffer in Hubitat state, computing slope over a configurable window, and classifying rising/falling/steady/unknown.
Implement Tuya Local v3.3 Groovy drivers on Hubitat using rawSocket, AES-128-ECB, queued retries, and defensive frame parsing.
Use Hubitat async HTTP plus a request queue to authenticate with Cognito, cache tokens in state, refresh proactively, and replay a single 401-failed request.
When two agents produce overlapping skills in one session, consolidate by merging unique content into the highest-confidence existing skill.
Standard guard pattern for async HTTP response callbacks in Hubitat drivers
Correct formula for converting lat/lng degree differences to miles, with pole clamp for numerical stability
| name | auth-before-dedup |
| description | Never let cached-state dedup bypass session validity in cloud-backed Hubitat drivers. |
| domain | auth |
| confidence | low |
| source | earned |
Use this when a Hubitat driver has command handlers that compare requested values with device.currentValue(...) or cached state, but the actual auth/queue logic lives deeper in sendCommand() / executeOrQueueRequest().
Check session validity before any dedup early-return. If the session is expired, missing, or still discovering the target device, skip the dedup return and fall through to the normal command path so the request can queue itself and trigger re-auth / session setup.
private boolean ensureSession(boolean requiresDevice = true) {
if (hasUsableAccessToken() && (!requiresDevice || state.deviceId)) {
return true
}
continueSessionSetup()
return false
}
def on() {
boolean sessionReady = ensureSession()
if (sessionReady && device.currentValue("switch") == "on") {
return
}
sendCommand(action: "on")
}
A stale access token can hide behind a cache hit: if dedup returns first, the command never reaches the queue/auth layer, so the user sees a silent no-op until some non-deduped path (like refresh()) repairs the session.
if (device.currentValue("switch") == "on") { return } before any auth/session checkdrivers/gemstone-lights/gemstone-lights.groovy v0.4.17: ensureSession() gates switch/level/color/effect dedup so expired Cognito tokens still recover on the next user command.