DaveGut/DEPRECATED-TP-Link-SmartThings

Restructure repo to support direct import into SmartThings

Closed this issue · 11 comments

SmartThings has native GitHub support for importing (and updating) device handlers and smart apps, but requires the repo to be structured slightly differently. By restructuring, the install and update procedures are greatly simplified (the IDE lets you know when there are updates and there is no more copy-pasting of code).

I haven't completed testing, so I'm opening this as an issue for now, but so far everything appears to be working great.

Restructuring procedure

# Create a devicetypes/davegut folder
for i in Device\ Handlers/* ; do file=$(basename "$i" | tr 'A-Z ' 'a-z-' | sed 's/tp-link-/tp-link-smart-/') ; mkdir -p "devicetypes/davegut/${file%%.groovy}.src" ; git mv "$i" "devicetypes/davegut/${file%%.groovy}.src/${file}" ; done

# Manual renames
git mv tp-link-smart-energy{,-}monitor-plug.src/
git mv tp-link-smart-energy-monitor-plug.src/tp-link-smart-energy{,-}monitor-plug.groovy

git mv tp-link-smart-soft{,-}white-bulb.src/
git mv tp-link-smart-soft-white-bulb.src/tp-link-smart-soft{,-}white-bulb.groovy

git mv tp-link-smart-tunable{,-}white-bulb.src/
git mv tp-link-smart-tunable-white-bulb.src/tp-link-smart-tunable{,-}white-bulb.groovy

# Create a smartapps/davegut folder
for i in Service\ Manager/* ; do file=$(basename "$i" | tr 'A-Z ' 'a-z-') ; mkdir -p "smartapps/davegut/${file%%.groovy}.src" ; git mv "$i" "smartapps/davegut/${file%%.groovy}.src/${file}" ; done

New installation procedure

Install device handlers

  • Go to https://graph.api.smartthings.com/ide/devices
  • Click Settings
  • Add a new repository:
    • Owner: davegut
    • Name: TP-Link-SmartThings
    • Branch: master
  • Save
  • Update from Repo
    • Check all the boxes (all the files under New, and Publish)
    • Click Execute Update

Install the SmartApp

Continue as normal

  • In the mobile app, install the SmartApp (listed under My Apps) and register devices

New update procedure

(assuming it is a clean upgrade; applies to both the SmartApp and the Device Handlers)

  • Click Update from Repo
    • Check all the boxes under Obsolete
    • Check the box for Publish
    • Click Execute Update

I think there is some kind of conflict between the duplicately named normal and Lite manager apps. I haven't even looked through yet to figure out what is the difference, but I know the normal one works.

If you want to test against my work-in-progress repo, use the following for the repo configuration:

  • Owner: michaelansel
  • Name: TP-Link-SmartThings
  • Branch: master

Source: https://github.com/michaelansel/TP-Link-SmartThings

Thank you~

Thank you

If you want to test against my work-in-progress repo, use the following for the repo configuration:

  • Owner: michaelansel
  • Name: TP-Link-SmartThings
  • Branch: master

Source: https://github.com/michaelansel/TP-Link-SmartThings

Great thanks.... the Device Handler update from Repo seems to work fine (sits Black, awaiting GitHub update) but the Smart App one, installs and works fine, but in the IDE it stays Magenta, indicating that the local version is different from the Repo version, despite the fact that it's only just downloaded itself from the Repo, so is exactly the same! I've even looked at the side by side comparison, and it's identical, but I cannot get it to go from Magenta to Black as it should be with a Repo connected Smart App..... Any ideas?

I can confirm the same as Frappawotsit - Mine too is stuck on Magenta!

I will work these this week (back to retired).

@Frappawotsit @wendzina Thanks for confirming that! I wasn't sure if that was a result of me messing something up during development or if it would show up for everyone. My untested hypothesis is that there might be some kind of name conflict with the -lite version of the SmartApp, but I haven't gotten around to testing that yet.

Try this link (I use the SmartThings paradigm of using SmartThings Public). Tell me if it works. (PS: This was already active.)

Owner: davegut
Name: SmartThingsPublic
Branch: master

Also, not everyone has enabled GitHub integration, so installation for most is manual.

Thanks for checking. I will close issue.

The naming "SmartThingsPublic" came from the SmartThings recommendation. I like the separate repository from the basic since most (novice) users would find negotiating the directory structure in SmartThingsPublic (or similar) very tedious.

Finally, as far as I am concerned, anyone can access/use any of my effort without restrictions (aside from using my name (DaveGut) in vain.

Dave