From 9cece36d69c5001c2ab1bf7621d75c355f8e993c Mon Sep 17 00:00:00 2001 From: dylanbijnagte Date: Wed, 16 Mar 2016 09:21:24 -0500 Subject: [PATCH] INTL-353 revert non i18n changes --- .../smartpower-outlet.groovy | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy b/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy index ef2b6f4..0dea33e 100644 --- a/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy +++ b/devicetypes/smartthings/smartpower-outlet.src/smartpower-outlet.groovy @@ -3,15 +3,15 @@ * Copyright 2016 SmartThings * * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy + * use this file except in compliance with the License. You may obtain a copy * of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations * under the License. =============================================================================== * Purpose: SmartPower Outlet DTH File @@ -22,7 +22,6 @@ * 1. 20160117 TW - Update/Edit to support i18n translations =============================================================================== */ - metadata { // Automatically generated. Make future change here. definition (name: "SmartPower Outlet", namespace: "smartthings", author: "SmartThings") { @@ -104,8 +103,8 @@ def parse(String description) { log.info "$device updates: ${finalResult.value}" } else if (finalResult.type == "power") { - def value = (finalResult.value as Integer)/10 - createEvent(name: "power", value: value, descriptionText: '{{ device.displayName }} power is {{ value }} Watts', translatable: true ) + def powerValue = (finalResult.value as Integer)/10 + sendEvent(name: "power", value: powerValue, descriptionText: '{{ device.displayName }} power is {{ value }} Watts', translatable: true ) /* Dividing by 10 as the Divisor is 10000 and unit is kW for the device. AttrId: 0302 and 0300. Simplifying to 10 power level is an integer. The exact power level with correct units needs to be handled in the device type @@ -113,10 +112,8 @@ def parse(String description) { */ } else { - if ( finalResult.value == "on" ) - createEvent(name: finalResult.type, value: finalResult.value, descriptionText: '{{ device.displayName }} is On', translatable: true) - else - createEvent(name: finalResult.type, value: finalResult.value, descriptionText: '{{ device.displayName }} is Off', translatable: true) + def descriptionText = finalResult.value == "on" ? '{{ device.displayName }} is On' : '{{ device.displayName }} is Off' + sendEvent(name: finalResult.type, value: finalResult.value, descriptionText: descriptionText, translatable: true) } } else { @@ -177,4 +174,4 @@ def getPowerDescription(descMap) { else { return [:] } -} \ No newline at end of file +}