[RELEASE] HubiThings Replica

Oven driver is in final simulation at my house. This next week probably. Washer-dryer will be two weeks out from oven.

Hello I'm trying to install Hubithings Replica I get an error SmartThings API ERROR: groovyx.net.http.ResponseParseException: status code: 403, reason phrase: Forbidden when trying to create API in HubiThings OAuth is there a fix for this?
John

Setting aside the Parse exception for the moment, the 403 forbidden suggests that you might be using an incorrect or not fully authorized Personal Access Token (PAT). That's where I'd start.

1 Like

After i upgraded to the C8 one of my OAuth instances failed for a bit before recovering on it's own.

The OAuth will attempt to update its token every ~three hours. The token is actually good for 24 hours, so it would need to fail updates several times before you have problems. I have seen DNS resolution failure with the SmartThings API as the primary reason.

Update 1/22/24: With the release of Sonos Advanced Controller, which provides a superior feature set, is native to Hubitat, and runs locally, this Replica driver will no longer be actively maintained,

=============================

RELEASE - Replica Sonos Driver

The driver can be imported from this link.

Why create a Replica Sonos driver when Hubitat has a native Sonos integration? The short answer is that the current Hubitat integration lacks certain useful features that are present in SmartThings' implementation. This replica driver provides a way to bridge those gaps until a better solution becomes available.

Advantages

  • This driver makes tracking the system topology easier by more clearly specifying each speaker's groupRole (primary, auxiliary, ungrouped) as well as IDs of the groupCoordinator and the overall group. This is helpful when creating complex automations on larger systems where groupings are frequently modified and/or there are multiple groups to manage. The IDs are particularly useful when using the Sonos Control API to modify group members and more.
  • Your Sonos Favorites (playlists, stations, etc.) can be played by ID, Name, or even randomly if neither ID or Name are specified.
  • The Favorites data is updated whenever there is change in them. By default, they are stored in a State Variable, sorted alphabetically by title. There is, however, a preference setting to create a JSON attribute that can be parsed and used in Rules or webCoRE if desired. This is disabled initially as the Favorites data is quite large and can stretch the length of your device page interminably.
  • The latest Sonos Edge Driver from SmartThings has a frequently requested preference setting (available only in the ST app at this time) to set a default queueAction (Append, Replace, Insert, or InsertNext) for each device. Most people will choose "Replace," thus ensuring that the queue is cleared before a new Favorite is loaded. Again, that selection has to be made in the ST app itself, but the setting is respected by the replica driver.
  • Additional group controls include Set Group Volume, Group Volume Up, Group Volume Down, Group Mute, and Group Unmute are available. Correspondingly, there are attributes that provide the current state of Group Volume and Group Mute.
  • In the same manner as the native HE integration, trackData is provided in an accessible JSON format and provides album, artist, tile, and album art information that can be used in a dashboard tile.

The following capabilities are not supported, as they are not currently available in the SmartThings Edge driver (beta).

  • playModes (Shuffle, Crossfade, Repeat, RepeatOne). These will be hopefully be coming in the future.
  • Join/Leave for creating and managing speaker groups. This is possible via the Control API or by running a local service like the very popular node-http-sonos-api.
  • Play Text (Capability exists in SmartThings, but is not currently exposed by the API).

Known Issues

  • This replica driver is intended for use with Sonos speakers running in SmartThings via the Sonos driver for Edge, which is still technically in beta. As the older groovy DTH driver is being deprecated in the very near future, it will not be supported, even to the extent it may work.

Using this driver will not impact your current Hubitat integration. You may test/run this driver concurrently. Just give your HubiThings Sonos devices unique names and avoid sending duplicate commands to your HE and replica devices.

3 Likes

We had a power outage earlier today and things went a bit sideways with the OAuth and Hubitat Package Manager, so I think it was an issue with Hubitat not being shut down cleanly versus an issue with Replica.

After a proper Hubitat restart, I was able to get both of my OAuth entries working again (as well as HPM).

2 Likes

@Bloodtick_Jones
After migrating to the C8, some of the replica devices (in particular motion sensors, it seems) are not updating in HE. (I'm one of the unlucky few whose migration experience has in general not been a good one.)
I have two instances of the Authentication app, and I've re-authorized both. I have refreshed both the devices in the Authentication app and the Replica app. Most of the replica devices show no activity in the event log.
Any suggestion on what else I could try?
Thank you.

Yea, I feel for you. Between SharpTools and Zwave (which I had ghosts and had to reset everything) and changing a bunch of webCoRE endpoints, it wasn't smooth for me either.

BUT, Replica doesn't really know the difference and shouldn't care if the OAuths are working correctly (you do need to delete the API and rebuild). The only thing that comes to mind is the stability of your ethernet network. Did you change to WiFi on the C-8 or using the ethernet port?

The Hubitat endpoint in the cloud that ST sends events, must have a solid connection to your device in the home. Otherwise the event from ST can be missed. At one point, I had a bad ethernet internet connection that caused incoming problems (it was webCoRE, not Replica) which would be the same here.

I thought you got access to the migration tool we quickly put together and that worked well for you? Feel free to shoot me a note if something didn't work as expected. :grinning:

All good with the SharpTools C-8 migration tool and big thanks for the incredible same day response from the SharpTools team [you].

It was the fact all the 'do gooders' in the HE forum saying 'everything is awesome with my C-8' when in fact, the small print said otherwise and required something so obvious to be overlooked. I hope next time they give you a heads up something that big is coming. I had no reason to jump that quickly.

3 Likes

I am probably guilty of this - I failed to do this. How do I do this? Create a new PAT on the Samsung website and replace the existing token with the new one?

My hub is connected via ethernet.

In OAuth you will see 'Delete API'. Press that and follow the prompts. Your devices will not be lost and will subscribe again when you complete the cycle. The PAT is fine.

image

Thank you! Once again, you are the man. This resolved the issue.

1 Like

Thanks, I'll try that as well.

Also having an issue between my ST and my new C8.
Not sure if it's related to yesterday's power outage and related OAuth issue I had, or the C8 migration (or both).

A switch in ST that is used to control some lights when I have days off was set at midnight, but did not get updated in HE, so the lights came on with their usual schedule.

I'm on an ethernet connection, but did change IPs on my C8 device, as I intend on using the C7 for other purposes.

EDIT: Definitely an odd issue. The particular switch is shared between ST, HE, and HA.

HA updated the switch via a Calendar automation (Need something like this native to HE) and it was reflected in HA and ST, but didn't show the correct value in HE.
After using Delete API it still wasn't being reflected. Pressed the refresh button in HE, and now it's showing the correct value.

1 Like

You should delete the API and rebuild as described above. ST would still have the old hub ID as part of the event path. Similar to any webCoRE piston that uses 'external endpoints'.

What you are probably seeing is the periodic refresh 'true-up' every three hours that doesn't use events.

1 Like

Hi
I'm getting this message when going to the Replica app -

" Unexpected Error

An unexpected error has occurred trying to load the app. Check [Logs] for more information.

Error: Cannot get property 'deviceId' on null object"

I think this is something to do with me deleting a Tuya device from ST before I removed it from Replica in HE, but not certain of that.

This is the error in the logs -
"java.lang.NullPointerException: Cannot get property 'deviceId' on null object on line 344 (method pageMain)"

Although I'm not sure what device it's referring to.

Any suggestions?

Thanks

if you reboot your hub, it probably will correct.

But this should be the code fix. Put the "?" on lines 344 & 345 as shown:

deviceIds.remove(smartDevice?.deviceId)
List hubitatDevices = getReplicaDevices(smartDevice?.deviceId)
1 Like

A reboot worked... I probably should've tried that!

Thanks

1 Like