Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added endpoint & randomUUID system #88

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion smartapps/ady624/webcore-piston.src/webcore-piston.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5091,6 +5091,8 @@ private Map getVariable(rtData, name) {
result = getIncidents(rtData, name.substring(11))
} else if (name.startsWith('$incidents[') && (name.size() > 11)) {
result = getIncidents(rtData, name.substring(10))
} else if (name == '$endpoint') {
result = [t: 'string', v: "${parent.getEndpoint()}execute/${hashId(app.id)}".toString()]
} else {
result = rtData.systemVars[name]
if (!(result instanceof Map)) result = [t: "error", v: "Variable '$name' not found"]
Expand Down Expand Up @@ -7977,7 +7979,9 @@ private static Map getSystemVariables() {
"\$locationMode": [t: "string", d: true],
"\$shmStatus": [t: "string", d: true],
"\$version": [t: "string", d: true],
"\$temperatureScale": [t: "string", d: true]
"\$temperatureScale": [t: "string", d: true],
"\$endpoint": [t: "string", d: true],
"\$randomUUID": [t: "string", d: true]
].sort{it.key}
}

Expand Down Expand Up @@ -8032,6 +8036,8 @@ private getSystemVariableValue(rtData, name) {
case "\$locationMode": return location.getMode()
case "\$shmStatus": switch (hubUID ? 'off' : location.currentState("alarmSystemStatus")?.value) { case 'off': return 'Disarmed'; case 'stay': return 'Armed/Stay'; case 'away': return 'Armed/Away'; }; return null;
case "\$temperatureScale": return location.getTemperatureScale()
case "\$endpoint": return "${rtData.endpoint}".toString()
case "\$randomUUID": def result = getRandomValue("\$randomUUID") ?: UUID.randomUUID().toString(); setRandomValue("\$randomUUID", result); return result
}
}

Expand Down
5 changes: 5 additions & 0 deletions smartapps/ady624/webcore.src/webcore.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1994,6 +1994,11 @@ public Boolean isInstalled() {
return !!state.installed
}

public String getEndpoint() {
if (!state.endpoint) return null
return state.endpoint
}

public String getDashboardUrl() {
if (!state.endpoint) return null
return "https://dashboard.${domain()}/"
Expand Down