Trigger SmartThings scene from MacroDroid [Please scroll to see Sept 2023 updates]

Yochai

New member
Per https://developer.smartthings.com/docs/automations/getting-started-with-automations, looks like rules created outside of the API aren't visible/available in the API:
View attachment 10522

In general, Rules ("automatic routines") are designed to be triggered by events (time of day, sensor activation, etc.), vs. manually, so maybe that's why this isn't straightforward. If you want to avoid cluttering up your list of scenes with scenes that only exist to trigger a rule, the only thing I can think of would be to
  1. set up virtual switches (one per rule, and accessible from the "Labs" icon in the app on the "Menu" tab)
  2. trigger each rule based on its associated switch being turned on
  3. turn off the switch at the end of the rule
  4. hide the virtual switches in the app's Device display using its "Select Devices to Use" option (in its three-dot menu). Alternatively you could just create a Room called "Virtual Switches" or "Rule Switches" or something and put all the virtual switches there...
Thanks. Your suggestion is pretty much what I had in mind.
 

Dimlos

Well-known member
SwitchBot API requires the use of Python from version 1.1 onwards, but SmartThings-compatible products can be controlled via HTTP requests using the SmartThings API.
This should be good news for users who have difficulty using Python with Termux and Termux:Tasker.
 

Winny57

Active member
Isn't it simpler like this? Just put your key (no addition) then you would get a list of available scenes you just have to click on it to activate it
 

Attachments

  • Smartthing_command.macro
    11.1 KB · Views: 6

Dimlos

Well-known member
I will add a simple way to turn on/off a simple device as this thread explains the use of scenes.
  1. Set a token in authorization.
  2. Obtain device information.
  3. Extract the id of the device you want to control from the device_info.
  4. Set device_id.
  5. Performs turn on/off action.
 

Attachments

  • macro.jpg
    macro.jpg
    720.9 KB · Views: 8
  • SmartThings_API.macro
    4.9 KB · Views: 6
  • Like
Reactions: RSF

md_sgf

Well-known member
3. Extract the id of the device you want to control from the device_info
Which one? I can see 4 "deviceId" values. Or is it "id"? (all are same value).

On make.com site, i get 403 error when try to create connection.
 

Dimlos

Well-known member
If there are multiple deviceIds, there will be a label just after the deviceId, so use that to distinguish between them.
 

Dimlos

Well-known member
Can't you get it with the following syntax?
GEThttps://api.smartthings.com/v1/devices/{lv=device_id}/components/main/capabilities/switch/status
 
  • Like
Reactions: RSF

jabroney

New member
Evening all

I'm trying to use an nfc tag to trigger a garage door open from smartthings

Ive tried to follow steps here but failing miserably

Should this be possible?
 

RSF

Well-known member
Should this be possible?
Yes. You should be able to invoke a SmartThings scene, or use @Dimlos's example from 10/31/24 to control the door directly (assuming the garage door can be configured and controlled in the SmartThings app).

Ive tried to follow steps here but failing miserably
At what point did you get stuck?
  1. Do you have a scene in SmartThings to open the garage door; can you invoke it manually in the SmartThings app and does it work?
  2. Did you get a token from the SmartThings website? It should be a string of about 30 characters including letters, numbers, and dashes.
  3. Did you create the global variable OK, making sure to prefix the token above with the word "Bearer"?
  4. Did both Action Blocks import OK?
  5. Were you able to test-run the "Get Locations" action block manually in MacroDroid? What HTTP response did you get?
  6. etc. ...
 
Top