1) Give a description of the problem
I have a custom device handler and Webcore running which is a simulated temp and humidity sensor pulling in data from a lora sensor from The Things Network. My issue is that I can get my temperature variable to command and it works correctly, but the humidity variable never is sent to the device.
2) What is the expected behaviour?
Humidity should be displayed. Webcore is executing the command.
3) What is happening/not happening?
Webcore executes command to sethumidity but value never shows up. I suspect an issue with my device handler. I am not an expert here.
**4) Post a Green Snapshot of the piston!
5) Attach logs after turning logging level to Full
5/20/2020, 11:22:23 PM +72ms
+0ms ╔Received event [Home].time = 1590031344519 with a delay of -1447ms
+95ms ║RunTime Analysis CS > 18ms > PS > 43ms > PE > 33ms > CE
+97ms ║Runtime (40035 bytes) successfully initialized in 43ms (v0.3.110.20191009) (96ms)
+98ms ║╔Execution stage started
+107ms ║║Cancelling statement #11’s schedules…
+114ms ║║Sending external web request to: environmentsensors.data.thethingsnetwork.org/api/v2/query?last=25m
+522ms ║║Executed virtual command httpRequest (408ms)
+528ms ║║[[device_id:lairdtemphumidity, digital_out_3:5, raw:AWcA0QJogwMBBQ==, relative_humidity_2:65.5, temperature_1:20.9, time:2020-05-21T03:09:55.3092241Z]]
+529ms ║║Executed virtual command log (2ms)
+536ms ║║Comparison (dynamic) [2020-05-21T03:09:55.3092241Z] is_different_than (datetime) 1589958540000 = true (1ms)
+537ms ║║Condition #13 evaluated true (5ms)
+538ms ║║Condition group #12 evaluated true (state did not change) (7ms)
+540ms ║║Cancelling statement #2’s schedules…
+548ms ║║Executed virtual command setVariable (3ms)
+554ms ║║Executed virtual command setVariable (2ms)
+560ms ║║Executed virtual command setVariable (4ms)
+563ms ║║Cancelling statement #17’s schedules…
+744ms ║║Executed physical command [loratemphum].setTemperature([69.62]) (177ms)
+745ms ║║Executed [loratemphum].setTemperature (178ms)
+761ms ║║Executed physical command [loratemphum].SetHumidity([65.5]) (13ms)
+762ms ║║Executed [loratemphum].SetHumidity (15ms)
+765ms ║╚Execution stage complete. (667ms)
+767ms ║Setting up scheduled job for Wed, May 20 2020 @ 11:22:34 PM EDT (in 10.681s)
+776ms ╚Event processed successfully (776ms)
Here is my device Handler code.
/**
- Copyright 2014 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 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 under the License.
*/
metadata {
// Automatically generated. Make future change here.
definition (name: “Simulated Temperature Sensor Brant”, namespace: “smartthings/testing”, author: “SmartThings”) {
capability “Temperature Measurement”
capability “Relative Humidity Measurement”
capability “Sensor”
command "SetHumidity"
command "setTemperature"
}
// UI tile definitions
tiles {
valueTile("temperature", "device.temperature", width: 2, height: 2) {
state("temperature", label:'${currentValue}', unit:"dF",
backgroundColors:[
[value: 31, color: "#153591"],
[value: 44, color: "#1e9cbb"],
[value: 59, color: "#90d2a7"],
[value: 74, color: "#44b621"],
[value: 84, color: "#f1d801"],
[value: 95, color: "#d04e00"],
[value: 96, color: "#bc2323"]
]
)
}
standardTile("humidity", "device.humidity", width: 2, height: 2) {
state ("humidity", label: '${currentValue}',
icon: "st.Weather.weather12", backgroundColors:[
[value: 40, color: "#153591"],
[value: 50, color: "#1e9cbb"],
[value: 60, color: "#90d2a7"],
[value: 70, color: "#44b621"],
[value: 80, color: "#f1d801"],
[value: 90, color: "#d04e00"],
[value: 95, color: "#bc2323"]
]
)
}
main "temperature", "humidity"
details(["temperature", "humidity"])
}
}
def setTemperature(value) {
sendEvent(name:“temperature”, value: value)
}
private getTemperature() {
def ts = device.currentState(“temperature”)
Integer value = ts ? ts.integerValue : 72
return value
}
def setHumidity(value) {
sendEvent(name:“humidity”, value: value)
}
private getHumidity() {
def hs = device.currentState(“humidity”)
Integer value = hs ? hs.integerValue : 55
return value
}