[RELEASE] HubiThings Replica

I have several smart bulbs that I've brought in from SmartThings which have the ability to change the white colour temperature.

They are defined as Replica Dimmer devices in Hubitat.
The options to change the colour temperature are not present.

If I switch the device type to Virtual RGBW or Virtual Color Temperature Light, the option to change the colour temperature becomes available, but nothing happens when the value or levels are set.

Is there currently a device type available that would allow adjustment of the colour temperatures?

Did you try configuring rules for your bulbs when using the Virtual devices you mentioned? If not, clear any existing rules and try building rules manually. Ask if you need help.

If that doesn't work, go to one of your bulbs on the "Devices" pages and scroll down. In the data section, you will see something like this:

Cut & Paste the 'capabilities' portion of the JSON and PM it myself and @Bloodtick_Jones and we'll see if a driver can be built. He's on travel through the end of the year and has more than a bit on his plate, but we'll try to get you an answer as to if and/or when a drive can be done.

1 Like

I started playing around with this today and it looks fantastic. I have a suggestion: how hard would it be to add the ability to manually update the linkage between a Hubitat device and a SmartThings device?

The use case I have in mind is for using smartphones with ST presence detection. If I get a new phone, I would have to delete the existing Hubitat device and create a new one with HubiThings. This would mean all my automations based on the Hubitat device would break. Instead, I'd like to have somewhere in the HubiThings app where I can go to reassign a new SmartThings device to an existing Hubitat device.

2 Likes

This should be possible. Let me think about it and will put it on the todo list. Good suggestion.

1 Like

New Driver Available: Replica Thermostat

2 Likes

Great work guys, this is an awesome alternative to hubConnect.

I agree with the device swap suggestion, especially for something like a phone based presence device.

Can I also suggest the minor addition of optional descriptive text/info logging at the device level? Not a big deal but something I like to turn off once I get devices working as expected.

1 Like

In the app, if you enable Advanced Configuration
image1

Additional Logging Options are available.
image2

Let us know if you're looking for something more/different.

I have Enable Event and Status Info Logging disabled and Disable Info logging turned on. That tones down the logging from the app itself. However the devices have some logging in the driver itself that isn't affect by those settings. For example, the presence driver has an info log for every presence event, just logs the descriptionText. Again not a big deal, but not something I care to see every time.

I manually added a preference option to disable those in driver.

/**
*  Copyright 2022 Bloodtick
*
*  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.
*
*/
@SuppressWarnings('unused')
public static String version() {return "1.2.0"}

metadata 
{
    definition(name: "Replica Presence", namespace: "replica", author: "bloodtick", importUrl:"https://raw.githubusercontent.com/bloodtick/Hubitat/main/hubiThingsReplica/devices/replicaPresence.groovy")
    {
        capability "Actuator"
        capability "Battery"
        capability "Configuration"
        capability "PresenceSensor"
        capability "Refresh"
        
        attribute "healthStatus", "enum", ["offline", "online"]
    }
    preferences {
        input "infoOutput", "bool", title: "Enable descriptive text logging", defaultValue: true
    }
}

def installed() {
	initialize()
}

def updated() {
	initialize()    
}

def initialize() {
    updateDataValue("triggers", groovy.json.JsonOutput.toJson(getReplicaTriggers()))
    updateDataValue("commands", groovy.json.JsonOutput.toJson(getReplicaCommands()))
}

def configure() {
    log.info "${device.displayName} configured default rules"
    initialize()
    updateDataValue("rules", getReplicaRules())
    sendCommand("configure")
}

// Methods documented here will show up in the Replica Command Configuration. These should be mostly setter in nature. 
Map getReplicaCommands() {
    return ([ "setBatteryValue":[[name:"battery*",type:"NUMBER"]], "setPresenceValue":[[name:"presence*",type:"ENUM"]], "setPresenceNotPresent":[], "setPresencePresent":[], "setHealthStatusValue":[[name:"healthStatus*",type:"ENUM"]]])
}

def setBatteryValue(value) {
    String descriptionText = "${device.displayName} battery level is $value %"
    sendEvent(name: "battery", value: value, unit: "%", descriptionText: descriptionText)
    if (infoOutput) log.info descriptionText
}

def setPresenceValue(value) {
    String descriptionText = "${device.displayName} is $value"
    sendEvent(name: "presence", value: value, descriptionText: descriptionText)
    if (infoOutput) log.info descriptionText
}

def setPresenceNotPresent() {
    setPresenceValue("not present")
}

def setPresencePresent() {
    setPresenceValue("present")    
}

def setHealthStatusValue(value) {    
    sendEvent(name: "healthStatus", value: value, descriptionText: "${device.displayName} healthStatus set to $value")
}

// Methods documented here will show up in the Replica Trigger Configuration. These should be all of the native capability commands
Map getReplicaTriggers() {
    return ([ "refresh":[]])
}

private def sendCommand(String name, def value=null, String unit=null, data=[:]) {
    parent?.deviceTriggerHandler(device, [name:name, value:value, unit:unit, data:data, now:now])
}

void refresh() {
    sendCommand("refresh")
}

String getReplicaRules() {
    return """{"version":1,"components":[{"trigger":{"type":"attribute","properties":{"value":{"title":"HealthState","type":"string"}},"additionalProperties":false,"required":["value"],"capability":"healthCheck","attribute":"healthStatus","label":"attribute: healthStatus.*"},"command":{"name":"setHealthStatusValue","label":"command: setHealthStatusValue(healthStatus*)","type":"command","parameters":[{"name":"healthStatus*","type":"ENUM"}]},"type":"smartTrigger","mute":true},{"trigger":{"type":"attribute","properties":{"value":{"title":"PresenceState","type":"string"}},"additionalProperties":false,"required":["value"],"capability":"presenceSensor","attribute":"presence","label":"attribute: presence.*"},"command":{"name":"setPresenceValue","label":"command: setPresenceValue(presence*)","type":"command","parameters":[{"name":"presence*","type":"ENUM"}]},"type":"smartTrigger"}]}"""

}

2 Likes

Firstly, @Bloodtick_Jones, thank you for this app!! ST via Hubconnect has been broken for me for a few months now…so really needed this!

Secondly, just wanted to point out that I was initially deterred by this statement..

…as I would not describe my knowledge of either HE or ST as advanced.

However, it was all quite easy to get running….especially compared to my relatively painful experience with Hubconnect a year or so ago.

I suspect I’m still not using the full capability of this integration (because of my relatively basic understanding of everything HE)….but the important thing for me is I now have my necessary ST devices and ST Presence available to me in HE.

Thank you!

3 Likes

On behalf of @Bloodtick_Jones Thank you for those words, It's pretty neat right! Smooth and fast syncing. Best to put the caveat about installing under Beta with the proviso of the need to know where which code goes where. In the next few days this will come out of Beta and go onto HPM which will make the install process easier for everyone.

2 Likes

Thanks for this driver - was waiting for this one.
With the rules that are created automatically, I can't seem to turn off the HVAC with either the either the "Off" button or the "Set Thermostat mode" function.
I'm not sure why some of the auto created rules are in red and if it has anything to do with that?

1 Like

What Thermostat and driver are you using? As all the "red" is on the SmartThings side of the rules, my first thought is that the capabilities of your thermostat driver are different from those of the stock EDGE driver upon which I modeled the Replica driver, though it's hard to imagine they could be that different.

Once I know which device/driver you're using, I may have you PM me with the capabilities data from your ST device.

I think I misunderstood the purpose of the driver. I was waiting for the replica driver to replicate Smartthings' own driver and when I saw your driver, I immediately accepted that the purpose of your driver is to deal with the Smartthings appliance. In other words, the driver on the Smartthings side is the one which Smartthings use when adding a Samsung A/C. Does that make sense?

1 Like

Ah, yes, that makes sense. This particular driver is a generic Replica driver for use with a thermostat using a standard SmartThings EDGE driver.

Specific drivers for the Samsung AC and other Samsung appliances will be forthcoming soon from @Bloodtick_Jones. I forgot you were in need of the Samsung-specific driver for the AC.

Quick question...
I have my Arlo cameras linked to Smartthings (don't think there is any direct integration for HE)

I want to:

  1. turn the cameras on/off via HE
  2. capture 'motion active' on HE

I can do 1 by creating a replica switch (in HE) using the ST Arlo camera. The replica switch in HE turns the camera on/off in ST. This works.

How do I do 2?

I've tried linking a camera to a replica motion sensor...doesn't detect motion in HE.

Also, I've figured I can't link an ST device to more than one replica driver...so would need a combined driver that has both switch and motion capability. Is this feasible?

I know, as a workaround, could probably achieve this by creating some virtual switches within ST - that switch based on motion (via a routine) and then replicate those switches in HE. As an aside - will the ability to create virtual devices in ST cease when they get rid of the IDE? And is that happening at the end of this year? If so, what happens to my virtual devices I already have in ST?

Am I missing a more straightforward solution?

Hi,

@dsegall posted this driver for Arlo cameras:
https://raw.githubusercontent.com/dds82/replica/main/replica-arlo-camera.groovy

He did report that SmartThings is not reporting correctly:

3 Likes

First OCF driver for Samsung ACs.

Thanks @amithalp and @hendrec for testing.

https://raw.githubusercontent.com/bloodtick/Hubitat/main/hubiThingsReplica/devices/replicaSamsungOcfAirCon.groovy

2 Likes

That is a great start. Depending on which camera you have it also can trigger as a siren, or have button press if it is the doorbell.

For users with Arlo you may want to check if Smartthigs is still seeing your cameras properly. I just logged in this morning for the first time in ages and all but one of my cameras weren't showing up properlly. I had to unlink and relink my Arlo account to get them to show up again properly.

@Bloodtick_Jones this is a fantastic job on this man. I had worked out a whole thing with Node-Red to get these updates moved to HE, but this is a much easier option. Fantastic work. I am going to play with this on my Dev hub

3 Likes

When I migrated from ST to HE, I left a GardenSpot RGB string on ST (my memory is a bit foggy but I recall these devices were known to cause problems on the Zigbee mesh). I am using the vanilla Replica dimmer to control it from HE. I'm just getting familiar with HubiThings Replica and don't understand 1) is there an RGB dimmer that would work? 2) is there a process to "build my own" that I should learn?

1 Like

Not at present, although there has been some discussion on the subject. As for building your own driver, we are encouraging community contributions. There is no "how to" guide as yet, but you can look at the code for the Replica Drivers on this page to get an idea on these are built.

In the meantime, is your GardenSpot RGB string on a stock EDGE driver? If so, let me know which one, then go to the Devices page on Hubitat, choose the replica device you created for the string, then scroll down to the data section, where you willl see something like this:

Copy the 'capabilities' portion of the JSON, open a PM to me, and paste it into a code block using this button
Screenshot 2023-01-01 at 11-11-59 BETA HubiThings Replica - ⚙️ Custom Apps and Drivers - Hubitat
and I'll take a closer look at it.

3 Likes