From d560d88ac9ad68707dd5fd91a7b12e6ccbdc453f Mon Sep 17 00:00:00 2001 From: Luke Ness Date: Wed, 25 Mar 2020 13:50:42 -0500 Subject: [PATCH] Revert "CHAD-3849 Update SmartWeather Station Tile to support the new mobile client (#22345)" This reverts commit 52b5dc534982681f0a76c5774c740cbd79e21b2d. --- ...ty.stsmartweather.apparentTemperature.json | 32 ------- ...ility.stsmartweather.astronomicalData.json | 91 ------------------- ...pability.stsmartweather.precipitation.json | 31 ------- ...apability.stsmartweather.smartWeather.json | 21 ----- ...stsmartweather.ultravioletDescription.json | 21 ----- ...apability.stsmartweather.weatherAlert.json | 35 ------- ...bility.stsmartweather.weatherForecast.json | 63 ------------- ...ability.stsmartweather.weatherSummary.json | 35 ------- ...pability.stsmartweather.windDirection.json | 21 ----- .../capability.stsmartweather.windSpeed.json | 27 ------ .../smartweather-station-tile.groovy | 77 ++++------------ 11 files changed, 16 insertions(+), 438 deletions(-) delete mode 100644 devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.apparentTemperature.json delete mode 100644 devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.astronomicalData.json delete mode 100644 devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.precipitation.json delete mode 100644 devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.smartWeather.json delete mode 100644 devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.ultravioletDescription.json delete mode 100644 devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherAlert.json delete mode 100644 devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherForecast.json delete mode 100644 devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherSummary.json delete mode 100644 devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.windDirection.json delete mode 100644 devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.windSpeed.json diff --git a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.apparentTemperature.json b/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.apparentTemperature.json deleted file mode 100644 index e09e7d0a68b..00000000000 --- a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.apparentTemperature.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "Apparent Temperature", - "attributes": { - "feelsLike": { - "schema": { - "type": "object", - "properties": { - "value": { - "title": "TemperatureValue", - "type": "number", - "minimum": -460, - "maximum": 10000 - }, - "unit": { - "type": "string", - "enum": [ - "F", - "C" - ] - } - }, - "additionalProperties": false, - "required": [ - "value", - "unit" - ] - } - } - }, - "commands": { - } -} diff --git a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.astronomicalData.json b/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.astronomicalData.json deleted file mode 100644 index 580712fe207..00000000000 --- a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.astronomicalData.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "name": "Astronomical Data", - "attributes": { - "localSunrise": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - }, - "localSunset": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - }, - "sunriseDate": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - }, - "sunsetDate": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - }, - "city": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - }, - "timeZoneOffset": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - } - }, - "commands": { - } -} diff --git a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.precipitation.json b/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.precipitation.json deleted file mode 100644 index af66d52e047..00000000000 --- a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.precipitation.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "Precipitation", - "attributes": { - "percentPrecip": { - "schema": { - "type": "object", - "properties": { - "value": { - "title": "IntegerPercent", - "type": "integer", - "minimum": 0, - "maximum": 100 - }, - "unit": { - "type": "string", - "enum": [ - "%" - ], - "default": "%" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - } - }, - "commands": { - } -} diff --git a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.smartWeather.json b/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.smartWeather.json deleted file mode 100644 index fac90437e04..00000000000 --- a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.smartWeather.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Smart Weather", - "attributes": { - "lastUpdate": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - } - }, - "commands": { - } -} diff --git a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.ultravioletDescription.json b/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.ultravioletDescription.json deleted file mode 100644 index 5dc33becb1f..00000000000 --- a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.ultravioletDescription.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Ultraviolet Description", - "attributes": { - "uvDescription": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - } - }, - "commands": { - } -} diff --git a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherAlert.json b/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherAlert.json deleted file mode 100644 index 743bc466e4d..00000000000 --- a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherAlert.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Weather Alert", - "attributes": { - "alert": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - }, - "alertKeys": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - } - }, - "commands": { - } -} diff --git a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherForecast.json b/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherForecast.json deleted file mode 100644 index e8677bb7516..00000000000 --- a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherForecast.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "Weather Forecast", - "attributes": { - "forecastIcon": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - }, - "forecastToday": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - }, - "forecastTonight": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - }, - "forecastTomorrow": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - } - }, - "commands": { - } -} diff --git a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherSummary.json b/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherSummary.json deleted file mode 100644 index a680a801a28..00000000000 --- a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.weatherSummary.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "Weather Summary", - "attributes": { - "weather": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - }, - "weatherIcon": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - } - }, - "commands": { - } -} diff --git a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.windDirection.json b/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.windDirection.json deleted file mode 100644 index d10625d4cd3..00000000000 --- a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.windDirection.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Wind Direction", - "attributes": { - "windVector": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "additionalProperties": false, - "required": [ - "value" - ] - } - } - }, - "commands": { - } -} diff --git a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.windSpeed.json b/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.windSpeed.json deleted file mode 100644 index 9994d651c48..00000000000 --- a/devicetypes/smartthings/smartweather-station-tile.src/capability.stsmartweather.windSpeed.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "Wind Speed", - "attributes": { - "wind": { - "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - }, - "unit": { - "type": "string", - "enum": ["KPH", "MPH"], - "default": "KPH" - } - }, - "additionalProperties": false, - "required": [ - "value", - "unit" - ] - } - } - }, - "commands": { - } -} diff --git a/devicetypes/smartthings/smartweather-station-tile.src/smartweather-station-tile.groovy b/devicetypes/smartthings/smartweather-station-tile.src/smartweather-station-tile.groovy index 46246fbd091..04849e96b6c 100644 --- a/devicetypes/smartthings/smartweather-station-tile.src/smartweather-station-tile.groovy +++ b/devicetypes/smartthings/smartweather-station-tile.src/smartweather-station-tile.groovy @@ -22,21 +22,9 @@ metadata { capability "Temperature Measurement" capability "Relative Humidity Measurement" capability "Ultraviolet Index" - //capability "Wind Speed" // Not in production yet - capability "stsmartweather.Wind Speed" // "Wind Speed" only supports m/s unit, however we want to create both events - capability "stsmartweather.Wind Direction" - capability "stsmartweather.Apparent Temperature" - capability "stsmartweather.Astronomical Data" - capability "stsmartweather.Precipitation" - capability "stsmartweather.Ultraviolet Description" - capability "stsmartweather.Weather Alert" - capability "stsmartweather.Weather Forecast" - capability "stsmartweather.Weather Summary" capability "Sensor" capability "Refresh" - // While we have created a custom capability for these attributes, - // they will remain to support any custom DataManagement based SmartApps using them. attribute "localSunrise", "string" attribute "localSunset", "string" attribute "city", "string" @@ -162,7 +150,7 @@ metadata { state "default", label:'${currentValue}' } - standardTile("refresh", "device.refresh", decoration: "flat", height: 1, width: 2) { + standardTile("refresh", "device.weather", decoration: "flat", height: 1, width: 2) { state "default", label: "", action: "refresh", icon:"st.secondary.refresh" } @@ -223,7 +211,7 @@ def uninstalled() { // handle commands def poll() { - log.debug "WUSTATION: Executing 'poll', location: ${location.name}" + log.info "WUSTATION: Executing 'poll', location: ${location.name}" if (stationId) { pollUsingPwsId(stationId.toUpperCase()) } else { @@ -240,7 +228,7 @@ def pollUsingZipCode(String zipCode) { // Last update time stamp def timeZone = location.timeZone ?: timeZone(timeOfDay) def timeStamp = new Date().format("yyyy MMM dd EEE h:mm:ss a", location.timeZone) - send(name: "lastUpdate", value: timeStamp) + sendEvent(name: "lastUpdate", value: timeStamp) // Current conditions def tempUnits = getTemperatureScale() @@ -254,8 +242,8 @@ def pollUsingZipCode(String zipCode) { send(name: "humidity", value: obs.relativeHumidity, unit: "%") send(name: "weather", value: obs.wxPhraseShort) - send(name: "weatherIcon", value: obs.iconCode, displayed: false) - send(name: "wind", value: obs.windSpeed, unit: windUnits) + send(name: "weatherIcon", value: obs.iconCode as String, displayed: false) + send(name: "wind", value: obs.windSpeed as String, unit: windUnits) // as String because of bug in determining state change of 0 numbers send(name: "windVector", value: "${obs.windDirectionCardinal} ${obs.windSpeed} ${windUnits}") log.trace "Getting location info" def loc = getTwcLocation(zipCode).location @@ -270,7 +258,7 @@ def pollUsingZipCode(String zipCode) { def dtf = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ") def sunriseDate = dtf.parse(obs.sunriseTimeLocal) - log.debug "'${obs.sunriseTimeLocal}'" + log.info "'${obs.sunriseTimeLocal}'" def sunsetDate = dtf.parse(obs.sunsetTimeLocal) @@ -288,14 +276,13 @@ def pollUsingZipCode(String zipCode) { def f = getTwcForecast(zipCode) if (f) { def icon = f.daypart[0].iconCode[0] ?: f.daypart[0].iconCode[1] - def precip = f.daypart[0].precipChance[0] ?: f.daypart[0].precipChance[1] + def value = f.daypart[0].precipChance[0] ?: f.daypart[0].precipChance[1] def narrative = f.daypart[0].narrative - - send(name: "percentPrecip", value: precip, unit: "%") - send(name: "forecastIcon", value: icon, displayed: false) - send(name: "forecastToday", value: narrative[0] ?: "-") - send(name: "forecastTonight", value: narrative[1] ?: "-") - send(name: "forecastTomorrow", value: narrative[2] ?: "-") + send(name: "percentPrecip", value: value as String, unit: "%") + send(name: "forecastIcon", value: icon as String, displayed: false) + send(name: "forecastToday", value: narrative[0]) + send(name: "forecastTonight", value: narrative[1]) + send(name: "forecastTomorrow", value: narrative[2]) } else { log.warn "Forecast not found" @@ -344,8 +331,8 @@ def pollUsingPwsId(String stationId) { send(name: "humidity", value: obs.humidity, unit: "%") send(name: "weather", value: "n/a") - send(name: "weatherIcon", value: null, displayed: false) - send(name: "wind", value: convertWindSpeed(obs[dataScale].windSpeed, dataScale, tempUnits), unit: windUnits) + send(name: "weatherIcon", value: null as String, displayed: false) + send(name: "wind", value: convertWindSpeed(obs[dataScale].windSpeed, dataScale, tempUnits) as String, unit: windUnits) // as String because of bug in determining state change of 0 numbers send(name: "windVector", value: "${obs.winddir}° ${convertWindSpeed(obs[dataScale].windSpeed, dataScale, tempUnits)} ${windUnits}") def cityValue = obs.neighborhood if (cityValue != device.currentValue("city")) { @@ -431,41 +418,9 @@ private localDate(timeZone) { df.format(new Date()) } -// Create the new custom capability event if needed, -// but also send a legacy custom event for any DM-backed SmartApps using them. -private send(Map map) { - def eventConversion = [ - "localSunrise": "stsmartweather.astronomicalData.localSunrise", - "localSunset": "stsmartweather.astronomicalData.localSunset", - "city": "stsmartweather.astronomicalData.city", - "timeZoneOffset": "stsmartweather.astronomicalData.timeZoneOffset", - "weather": "stsmartweather.weatherSummary.weather", - "wind": "stsmartweather.windSpeed.wind", - "windVector": "stsmartweather.windDirection.windVector", - "weatherIcon": "stsmartweather.weatherSummary.weatherIcon", - "forecastIcon": "stsmartweather.weatherForecast.forecastIcon", - "feelsLike": "stsmartweather.apparentTemperature.feelsLike", - "percentPrecip": "stsmartweather.precipitation.percentPrecip", - "alert": "stsmartweather.weatherAlert.alert", - "alertKeys": "stsmartweather.weatherAlert.alertKeys", - "sunriseDate": "stsmartweather.astronomicalData.sunriseDate", - "sunsetDate": "stsmartweather.astronomicalData.sunsetDate", - "lastUpdate": "stsmartweather.smartWeather.lastUpdate", - "uvDescription": "stsmartweather.ultravioletDescription.uvDescription", - "forecastToday": "stsmartweather.weatherForecast.forecastToday", - "forecastTonight": "stsmartweather.weatherForecast.forecastTonight", - "forecastTomorrow": "stsmartweather.weatherForecast.forecastTomorrow" - ] - - //log.trace "WUSTATION: event: $map" +private send(map) { + log.debug "WUSTATION: event: $map" sendEvent(map) - if (map.name && eventConversion.containsKey(map.name)) { - def newMap = map.clone() - newMap.name = eventConversion[map.name] - - //log.trace "WUSTATION: NEW event: $newMap" - sendEvent(newMap) - } } private estimateLux(obs, sunriseDate, sunsetDate) {