Hubitat™ SmartThings Integration

Yep °C on both sides. I suspect it simply sends over the value from ST. Then on the receiving side your code probably always assumes the temperature is in °F because it doesn't transfer the unit type. Then it converts this to °C which is my preference here in the UK.

I'll have to look, but as far as I remember, it wouldn't process the temperature value at all.

1 Like

Thanks for looking into. Here some more data....

Here on hubitat:

temperature -5.44 °C Gavin's Bedroom. is -5.44°C DEVICE 2020-09-03 08:35:10.090 BST
temperature -5.38 °C Gavin's Bedroom. is -5.38°C DEVICE 2020-09-03 06:35:20.825 BST
temperature -5.33 °C Gavin's Bedroom. is -5.33°C DEVICE 2020-09-03 06:05:23.511 BST
temperature -5.27 °C Gavin's Bedroom. is -5.27°C DEVICE 2020-09-03 04:35:31.124 BST

Here on smartthings side:

2020-09-04 6:33 AM BST - 7 hours ago temperature 21.6 C C
2020-09-04 6:03 AM BST - 8 hours ago temperature 21.7 C C
2020-09-04 5:33 AM BST - 8 hours ago temperature 21.8 C C

as you can see °C on both sides.

1 Like

Yes I am getting this too

1 Like

I've just enabled this Hub Link app in my Hubitat and added the SmarkApp using the SmartThings IDE and it was available in the new SmartThings Android app (classic no longer works for me)

so far it looks ok except as others have mentioned: the temperature reporting is incorrect.
I have my ST set to use Celsius and my HE also uses Celsius as same as the user above 21 degree in ST gets reported as around -5 in HE.

@bravenel any chance that this might get fixed?

Switch to the user-contributed app Hub Connect.

I saw HubConnect but it looks more difficult to setup and the fact that it needs registration on another website and the dial home features are putting me off installing it

The forum members are willing to help.

I will look into it.

1 Like

What thermostat are you using in SmartThings @alexandruy2k?

Weird this reply didn't get posted, it was just sitting here for a few days.

@Mixweaver
I'm using a Nest thermostat, but I haven't shared that with Hubitat yet. I'll look to bring it in another way as I'll want to be able to also control it, not just monitor it and as it so happens SmartThings can't actually share it anyway.

The problem is with various sensors that I have connected to my SmartThings hub. (SmartThings motion sensors with temperature, multipurpose sensors, contact sensors), they're the ones that have the wrong temperature conversion

Do the sensors have the same units on both hubs? All that's going on is the value of the device is being sent, there are no conversions going on. So logic suggests that both hubs have to be speaking the same language wrt °C vs °F. and both hubs would need the same Temp Scale selected at the hub level (see Settings / Location).

yes for me both hubs are set to use Celcius

image

The other thing I noticed was if I change my motion sensor in the SmartThings Send Hub Events app from Motion Sensor to Omni Sensor the issue is fixed and the temperature is reported correctly.
Is there any chance that the Motion Sensor option does try to do some sort of temperature adjustment that the Omni Sensor doesn't do?
This kinda fixes it, I just need to ignore ignore all the non valid sensor values which is a bit messier in some dashboards and graph apps

I've looked at the code itself and you're right I see no conversion happening,

And I've found what I hope is the same version my hub uses for the Omni Sensor HubitatPublic/virtualOmniSensor.groovy at master · hubitat/HubitatPublic · GitHub

Again I couldn't spot any temperature conversion

I couldn't find any code for the Virtual motion sensor, so I'm wondering is that where the issue could be?

There is one small difference. Try using this Virtual Motion driver below:

metadata {
    definition (name: "Virtual Motion Sensor", namespace: "hubitat", author: "Mike Maxwell") {
        capability "Motion Sensor"
        capability "Temperature Measurement"
        command "active"
        command "inactive"
        command "setTemperature", ["Number"]

    }
    preferences {
        input name: "logEnable", type: "bool", title: "Enable debug logging"
        input name: "txtEnable", type: "bool", title: "Enable descriptionText logging"
    }
}

def logsOff(){
    log.warn "debug logging disabled..."
    device.updateSetting("logEnable",[value:"false",type:"bool"])
}

def installed() {
    log.warn "installed..."
    device.updateSetting("logEnable",[value:"true",type:"bool"])
    device.updateSetting("txtEnable",[value:"true",type:"bool"])
    runIn(1800,logsOff)
}

def updated() {
    log.info "updated..."
    log.warn "debug logging is: ${logEnable == true}"
    log.warn "description logging is: ${txtEnable == true}"
    if (logEnable) runIn(1800,logsOff)
}

def parse(String description) {
    if (logEnable) log.debug "parse ${description}"
    if (description == "active") active()
    else if (description == "inactive") inactive()
    else setTemperature(description)
}

def active() {
    def descriptionText = "${device.displayName} is active"
    if (txtEnable) log.info "${descriptionText}"
    sendEvent(name: "motion", value: "active", descriptionText: descriptionText)
}

def inactive() {
    def descriptionText = "${device.displayName} is inactive"
    if (txtEnable) log.info "${descriptionText}"
    sendEvent(name: "motion", value: "inactive", descriptionText: descriptionText)
}

def setTemperature(temp) {
    def unit = "°${location.temperatureScale}"
    def descriptionText = "${device.displayName} is ${temp}${unit}"
    if (txtEnable) log.info "${descriptionText}"
    sendEvent(name: "temperature", value: temp, descriptionText: descriptionText, unit: unit)
}
1 Like

Set up your Hub Link to use a motion sensor, not Omni, and then change out the driver to the one above for the Virtual Motion Sensor device created on the hub.

There is a bug in our built-in Virtual Motion Sensor driver wrt °C. We will get that fixed.

I can confirm that the virtual motion sensor code that you pasted here works correctly.

Is there a chance that the same error could be present with the virtual multi sensor as well?
I seem to recall that it also was showing the wrong temperatures.
I can swap my multi sensors from Omni back to Virtual Multi sensor if needed for debug purposes.
Or if the error is easy to spot could you share the fixed Multi Sensor as well?

Thanks very much for your time Bruce :heart: @bravenel

Yes, same bug in that driver.

metadata {
    definition (name: "Virtual Multi Sensor", namespace: "hubitat", author: "Mike Maxwell") {
        capability "Acceleration Sensor"
        capability "Contact Sensor"
        capability "Temperature Measurement"
        command "active"
        command "inactive"
        command "open"
        command "close"
        command "setTemperature", ["Number"]

    }
    preferences {
        input name: "logEnable", type: "bool", title: "Enable debug logging", dafaultValue: true
        input name: "txtEnable", type: "bool", title: "Enable descriptionText logging", dafaultValue: true
    }
}

def logsOff(){
    log.warn "debug logging disabled..."
    device.updateSetting("logEnable",[value:"false",type:"bool"])
}

def installed() {
    log.warn "installed..."
    inactive()
    close()
    setTemperature("70")
    runIn(1800,logsOff)
}

def updated() {
    log.info "updated..."
    log.warn "debug logging is: ${logEnable == true}"
    log.warn "description logging is: ${txtEnable == true}"
    if (logEnable) runIn(1800,logsOff)
}

def parse(String description) {
    if (logEnable) log.debug "parse ${description}"
    def items = description.tokenize(":")
    if (items.size() == 2){
        def name = items[0]
        def value = items[1]
        if (name == "acceleration" && value == "active") active()
        else if (name == "acceleration" && value == "inactive") inactive()
        else if (name == "contact" && value == "open") open()
        else if (name == "contact" && value == "closed") close()
        else if (name == "temperature") setTemperature(value)
    } else {
        if (description == "active") active()
        else if (description == "inactive") inactive()
        else if (description == "open") open()
        else if (description == "closed") close()
        else setTemperature(description)
    }
}

def active() {
    def descriptionText = "${device.displayName} is active"
    if (txtEnable) log.info "${descriptionText}"
    sendEvent(name: "acceleration", value: "active", descriptionText: descriptionText)
}

def inactive() {
    def descriptionText = "${device.displayName} is inactive"
    if (txtEnable) log.info "${descriptionText}"
    sendEvent(name: "acceleration", value: "inactive", descriptionText: descriptionText)
}

def open() {
    def descriptionText = "${device.displayName} is open"
    if (txtEnable) log.info "${descriptionText}"
    sendEvent(name: "contact", value: "open", descriptionText: descriptionText)
}

def close() {
    def descriptionText = "${device.displayName} is closed"
    if (txtEnable) log.info "${descriptionText}"
    sendEvent(name: "contact", value: "closed", descriptionText: descriptionText)
}

def setTemperature(temp) {
    def unit = "°${location.temperatureScale}"
    def descriptionText = "${device.displayName} is ${temp}${unit}"
    if (txtEnable) log.info "${descriptionText}"
    sendEvent(name: "temperature", value: temp, descriptionText: descriptionText, unit: unit)
}
1 Like

I can confirm that the 2 drivers do indeed work correctly now for temperature reporting,

Thanks again Bruce.

2 Likes