Skip to content
Open
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
29 changes: 26 additions & 3 deletions smartapps/stj/mqtt-bridge.src/mqtt-bridge.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ import groovy.transform.Field
capability: "capability.contactSensor",
attributes: [
"contact"
]
],
action: "actionOpenClosed"
],
"doorControl": [
name: "Door Control",
Expand Down Expand Up @@ -228,7 +229,8 @@ import groovy.transform.Field
capability: "capability.relativeHumidityMeasurement",
attributes: [
"humidity"
]
],
action: "actionHumiditySensors"
],
"relaySwitch": [
name: "Relay Switch",
Expand Down Expand Up @@ -316,7 +318,8 @@ import groovy.transform.Field
capability: "capability.temperatureMeasurement",
attributes: [
"temperature"
]
],
action: "actionTemperatureSensors"
],
"thermostat": [
name: "Thermostat",
Expand Down Expand Up @@ -746,6 +749,26 @@ def actionThermostatMode(device, attribute, value) {
device.setThermostatMode(value)
}

//Temperature Sensors don't have commands but a simulated sensor might hence the hasCommand() check.
def actionTemperatureSensors(device, attribute, value) {
if (device.hasCommand("temperature")) {
device.temperature(value as int)
}
if (device.hasCommand("setTemperature")) {
device.setTemperature(value)
}
}

//Humidity Sensors don't have commands but a simulated sensor might hence the hasCommand() check.
def actionHumiditySensors(device, attribute, value) {
if (device.hasCommand("humidity")) {
device.humidity(value as int)
}
if (device.hasCommand("setHumidity")) {
device.setHumidity(value as int)
}
}

def actionTimedSession(device, attribute, value) {
if (attribute == "timeRemaining") {
device.setTimeRemaining(value)
Expand Down