Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SmartThings API V1 driver
#1
Looks like SmartThings released a new API “V1” that can give CQC access to 5,000+ devices.

Was trying to figure out how to add new unsupported devices into CQC and extend my CQC system for many years to come. As everyone knows there is no other HA system out that compares to the configurability of the GUI interface or the back-end control you get from CQC.

Here is a first cut of a driver.
Driver install prompts:
1. SmartThings Personal access token(PAT) (see below)
2. Polling Interval (default is 5)
3. SmartThings Hub Location ID  (driver needs to lookup the device ID)
4. List of devices to poll(cloud) in device type:name,,,,  format(see below)

Note:
  • It polls the SmartThings cloud API. (hopefully a local poll of hub will come soon)
  • It does one small status poll for each device at poll time. (so keep it to a small number of devices not supported by CQC)
  • Current device types supported are: lightswitch,dimmerswitch,doorlock,floodsensor.
  • Driver creates fields based on SmartThings device Names after a one time lookup on the hub. So if no ST_ field is created you may have a typo on your device configuration during driver install.
I have a SmartThings V3 Hub and currently use CQC as a secondary zwave controller.
After a few weeks of testing. Seems to work well at 5 seconds poll times.

You need to Generate a PAT(Personal Access Token)
https://account.smartthings.com/tokens
(as you will need a Bearer Token)

To get your LocationID   (Hub ID)
https://graph.api.smartthings.com/
If you drill down into your Hubs or Devices off that ,locationID, hubID, DeviceID  will be at end of the  url “897ssd87f-bc9d-433ae-d32e-a5bcb0f2xxxx”
This is what my URL looks like.
"https://graph-na04-useast2.api.smartthings.com/device/show/897ssd87f-bb9d-433ae-d32e-a5bcb0fxxxxx"

Devices to Poll:
Format is device type: name (example below)
Note: This is the name in SmartThings app or website.
lightswitch:Garage Lights,Landscape Lights&dimmerswitch:Foyer,Liv Rm Inside&doorlock:Front  Door Lock&floodsensor:Laundry Flood Sensor


.cqcdrvpack   SmartThings_0.5.CQCDrvPack (Size: 20.66 KB / Downloads: 0)

Please feel free to fix, enhance or change driver as needed
    maybe:
  • Do one larger all device stat poll and parse instead of many small polls.
  • Transition to local hub requests.(when available)
  • Add more device types(or a more elegant lookup table of some kind)
More info:
5,000+ devices compatibility on a SmartThings Hub.
www.smartthings.com/products-list
https://developer-preview.smartthings.co...ag/Devices

Postman resources:
www.postman.com/smartthings/workspace/smartthings-s-public-workspace/collection/

Just change in Auth Tab to Bearer Token(and put your token or variable  in)
I had to change in Headers Tab: unclick the Accept KEY.
https://developer-preview.smartthings.co...ns/scenes/
https://github.com/SmartThingsDevelopers...e-RulesAPI
_______________
Denon 3808ci, 2112ci ,Sonos, NoVo Grand Concerto, Z-Wave(Lights,Locks), Hue, SmartThings,
iPads,Tivo,Hikvision,Elk-M1,TED5000,Somfy RTS blinds+ZRTSI, Amazon Echos+Dots, Polk XRT12,
Honeywell Wi-Fi 9000, Caleo Wi-Fi Thermostats, Rainmachine
Reply
#2
That sounds like great news to extend the useful life of CQC, I think. To clarify. You are using just the SH hub and look to be able to communicate to it direct via CQC driver? and then indirectly communicate to the other SH supported devices via the CQC driver? or are you using Z-wave in this equation to make it work somehow too? Sorry, I have neither a SH or Z-wave in my current setup so not too familiar with either.

Sounds like you can get status of things. Assume you can you write to them too? (Like turn something on/off)?

If true I may have to look at getting a Smart Things hub here soon.
-Mike G
Reply
#3
(02-03-2022, 03:02 PM)Shaky Wrote: That sounds like great news to extend the useful life of CQC, I think.  To clarify.  You are using just the SH hub and look to be able to communicate to it direct via CQC driver? and then indirectly communicate to the other SH supported devices via the CQC driver? or are you using Z-wave in this equation to make it work somehow too?  Sorry, I have neither a SH or Z-wave in my current setup so not too familiar with either.

Sounds like you can get status of things.  Assume you can you write to them too?  (Like turn something on/off)? 

If true I may have to look at getting a Smart Things hub here soon.

Shaky,
This is just a Proof of concept test driver for now. It currently can turn on/off a one device attached to the smartthing hub. On Smartthings Hub you can attach both Z-wave and ZigBee. Currently this test driver uses the smartthings API V1 call to the cloud but since you can just query the individual capabilities the request is very small. example:

{
    "switch": {
        "value""off",
        "timestamp""2022-02-03T23:21:10.589Z"
    }
}


At the last SDC they did say they wanted to migrate away from a cloud request to a local smartthings hub request. Not sure how that would work but would think they would maintain the new V1 api format.
K
_______________
Denon 3808ci, 2112ci ,Sonos, NoVo Grand Concerto, Z-Wave(Lights,Locks), Hue, SmartThings,
iPads,Tivo,Hikvision,Elk-M1,TED5000,Somfy RTS blinds+ZRTSI, Amazon Echos+Dots, Polk XRT12,
Honeywell Wi-Fi 9000, Caleo Wi-Fi Thermostats, Rainmachine
Reply
#4
BTW, apparently the Hue also now has a local API, or so I read someone talking about. And I think it also provides async notifications, so you don't have to poll it relentlessly.
Dean Roddey
Explorans limites defectum
Reply
#5
(02-05-2022, 03:25 PM)Dean Roddey Wrote: BTW, apparently the Hue also now has a local API, or so I read someone talking about. And I think it also provides async notifications, so you don't have to poll it relentlessly.

Yes, must cost them a fortune for all these API requests. Most of these edge devices are now Linux systems powerful enough to service local queries. We will see if these companies can give up central control of these requests and put up with all the headaches of a distributed architecture.
_______________
Denon 3808ci, 2112ci ,Sonos, NoVo Grand Concerto, Z-Wave(Lights,Locks), Hue, SmartThings,
iPads,Tivo,Hikvision,Elk-M1,TED5000,Somfy RTS blinds+ZRTSI, Amazon Echos+Dots, Polk XRT12,
Honeywell Wi-Fi 9000, Caleo Wi-Fi Thermostats, Rainmachine
Reply
#6
Updated to version 0.5
- lookup of device ID by SmartThings Name
- Implemented general device types(lightswitch,dimmerswitch,doorlock,floodsensor.)
- YMMV, UAYOR and all other Acronyms apply Smile
_______________
Denon 3808ci, 2112ci ,Sonos, NoVo Grand Concerto, Z-Wave(Lights,Locks), Hue, SmartThings,
iPads,Tivo,Hikvision,Elk-M1,TED5000,Somfy RTS blinds+ZRTSI, Amazon Echos+Dots, Polk XRT12,
Honeywell Wi-Fi 9000, Caleo Wi-Fi Thermostats, Rainmachine
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  RainMachine Sprinkler Irrigation Controller Driver kblagron 60 18,782 07-17-2022, 08:36 PM
Last Post: kblagron
  Tesla Driver Driver kfly 14 5,582 02-21-2022, 10:11 AM
Last Post: kfly
  Help on editing existing Driver Spot 5 571 02-03-2022, 06:50 PM
Last Post: kblagron
  New to driver development - where to start? jokermac 2 617 09-22-2021, 04:01 PM
Last Post: Spot
  Yamaha RX-V673 IP control Driver jdmevo123 22 11,303 03-27-2021, 03:02 PM
Last Post: Spot
  Updated SMS Driver gReatAutomation 0 650 01-28-2021, 12:53 PM
Last Post: gReatAutomation
  Sage Media Server driver (beta) Fonceur 698 343,541 07-26-2020, 04:59 PM
Last Post: sic0048
  Russound MCA-66 on TCP driver lapointe.sc@gmail.com 5 2,607 05-24-2020, 06:23 AM
Last Post: gReatAutomation
  Samsung SmartTV Driver George M 0 901 05-20-2020, 09:04 AM
Last Post: George M
  OpenWeatherMap Weather Driver Using OneCall API kblagron 11 4,219 05-18-2020, 04:09 AM
Last Post: dlmorgan999

Forum Jump:


Users browsing this thread: 1 Guest(s)