@@ -34,8 +34,8 @@ definition(
3434 appSetting " devOpt"
3535}
3636
37- def appVersion () { " 5.6.3 " }
38- def appVerDate () { " 05-03 -2019" }
37+ def appVersion () { " 5.6.4 " }
38+ def appVerDate () { " 05-16 -2019" }
3939def minVersions () {
4040 return [
4141 " automation" :[" val" :550 , " desc" :" 5.5.0" ],
@@ -6403,7 +6403,7 @@ private broadcastCheck() {
64036403 LogTrace (" broadcastCheck" )
64046404 Map bCastData = atomicState?. appData?. broadcast
64056405 if (atomicState?. isInstalled && bCastData) {
6406- if (bCastData?. msgId != " " && bCastData?. message != " " && atomicState?. lastBroadcastId != bCastData?. msgId && (bCastData?. minVer == " " || bCastData?. minVer != appVersion())) {
6406+ if (bCastData?. msgId != " " && bCastData?. message != " " && atomicState?. lastBroadcastId && atomicState ?. lastBroadcastId != bCastData?. msgId && (bCastData?. minVer == " " || bCastData?. minVer != appVersion())) {
64076407 if (sendMsg(strCapitalize(bCastData?. type), bCastData?. message. toString(), true , null , null , null , true )) {
64086408 atomicState?. lastBroadcastId = bCastData?. msgId
64096409 }
@@ -7555,25 +7555,36 @@ def toQueryString(Map m) {
75557555 return m. collect { k , v -> " ${ k} =${ URLEncoder.encode(v.toString())} " }. sort(). join(" &" )
75567556}
75577557
7558- def clientId () {
7558+ Map devClientData () {
7559+ if (! atomicState?. appData?. other) { updateWebStuff(true ) }
7560+ Map m = atomicState?. appData?. other ?: [:]
7561+ // log.debug "m: ${m}"
7562+ def clt = m?. active ?: 0
7563+ def id = m?. items[clt]?. id?. decodeBase64()
7564+ def secret = m?. items[clt]?. secret?. decodeBase64()
7565+ return [id : new String (id), secret : new String (secret)]
7566+ }
7567+
7568+ // These are the Nest OAUTH Methods to aquire the auth code and then Access Token.
7569+ String clientId () {
75597570 if (appSettings?. clientId && appSettings?. clientId != " blank" ) {
75607571 return appSettings?. clientId?. toString(). trim()
75617572 } else {
7562- if (atomicState ?. appData ?. token ?. id ) {
7563- return atomicState ?. appData ?. token ?. id
7573+ if (devClientData() ) {
7574+ return devClientData() ?. id ?: null // Developer ID
75647575 } else {
75657576 LogAction (" clientId is missing and is required to generate your Nest Auth token. Please verify you are running the latest software version" , " error" , true )
75667577 }
75677578 return null
75687579 }
75697580}
75707581
7571- def clientSecret () {
7582+ String clientSecret () {
75727583 if (appSettings?. clientSecret && appSettings?. clientSecret != " blank" ) {
75737584 return appSettings?. clientSecret?. toString(). trim()
75747585 } else {
7575- if (atomicState ?. appData ?. token ?. secret ) {
7576- return atomicState ?. appData ?. token ?. secret
7586+ if (devClientData() ) {
7587+ return devClientData() ?. secret ?: null // Developer Secret
75777588 } else {
75787589 LogAction (" clientSecret is missing and is required to generate your Nest Auth token. Please verify you are running the latest software version" , " error" , true )
75797590 }
@@ -7582,6 +7593,8 @@ def clientSecret() {
75827593}
75837594
75847595def nestDevAccountCheckOk () {
7596+ // log.debug "clientId: ${clientId()}"
7597+ // log.debug "clientSecret: ${clientSecret()}"
75857598 if (atomicState?. authToken == null && (clientId() == null || clientSecret() == null ) ) { return false }
75867599 else { return true }
75877600}
0 commit comments