Hubitat™ SmartThings Integration

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

The truly smart thing would be to port over any groovy code you need and move everything you can to the HE. Sansung TV have been a problem but most ST devices can be moved to HE. HE was developed by former ST employees who obviously decided to make the hub ST should have made which is why the deliberately included .groovy code support making driver and app support able to utilize the already large base of user make code. Additionally, ST has done the opposite and disabled the ability by first removing if from their app and then disabling the Classic app which still could have code added so that Samsung could force users to not be able to use any devices other than what they sell. ST will die soon and Wink is dying also. HE is picking up all the users they tossed aside. I expect the influx of new adopters to continue to rise. I had already been looking at HE for awhile but found it too good to be true but when Wink started charging a fee I jumped ship. HE knew this which is why it went from $99 to $149, it is now $129, last I checked. Personally, I am glad I waited, The C-7 is nice improvement over the C-5. Many C-4 and C-5 user have now bought a C-7 as well. The majority of HE users using two hubs are those that bought a newer one and still use the older one too, some use a ST also but almost all use and older HE.

:thinking:

2 Likes

Wrong. No Hubitat principal (or employee that I know of) was ever a SmartThings employee.

I’m flagging your post because it’s ripe with misinformation.

7 Likes

Thank you for your continued support and kind words. None of the Hubitat employees are former SmartThings employees. Many of us were among the most prolific posters in the SmartThings community, so perhaps that is where the confusion may be coming from.

14 Likes

Hey it was told to me, in either case the design is clearly what ST should have been and the decision to support .groovy code now mean it can take over where ST left off now that Samsung has completely abandoned the idea and blocked adding code. ST Classic no longer works. I was trying to integrate my dusty ST so I could control my Samsung TV's with Hubitat Elevation and went back at some point and saw it was disabled. Using my Logitech Harmony integration instead. I bought it long ago but could never get it to work great. It still has bugs but now I have figured out how to make it mostly work. Their device support is impressive too.

At this point one of the best options to bring Smartthings devices into HE would be using Node red with the Samsung Automation Studio Pallet and the Hubitat pallet. The samsung automation studio works with the new API's so isn't currently at risk of being decommissioned.

1 Like