SmartThings integration - flip a virtual switch to run a command
-
@russ Thanks for checking! Unfortunately, re-creating the device via the SmartApp didn't make a difference. Turns out MY problem is that I only have one trigger I'm testing on...
I spent a few hours troubleshooting the SmartApp code and found the root cause around line 249. When a single trigger comes back from the api, the conditional looks like it assumes the type will be a Map, but it actually just returns a List with a single item at index 0. Changing the "devices?.name" and "devices?did" to "devices[0].name" and "devices[0].did" fixes the issue for me. I only realized the problem because the trigger list kept creating devices with brackets around the name, making me expect a typing problem.
It's working great for me now, hope my digging helps!
-
@mthiel, wow, that's interesting. I'm glad you found that. you send me the code snippet you changed? I want to test it myself, then I'll update the code. Sorry for the trouble, and thank you for finding a fix.
EDIT:
I was able to reproduce the problem. I tested the change and updated the code. Thanks @mthiel for the fix!// deviceList += ["name" : "${roomName} ${devices?.name}", "did" : "${devices?.did}", "type" : "bulb"] <- this logic doesn't work when there's only 1 command // Thanks to mthiel for finding this fix. deviceList += ["name" : "${roomName} ${devices[0].name}", "did" : "${devices[0].did}", "type" : "bulb"]
-
hello guys can you please give me some help
i have triggercmd installed in my pc so i can open kodi, but i have a 32bit version so thats why (i suppose) i dont have the option to parse a cmd so the smartthings switch knows when its on or off.
that beeing said when i press the switch it open kodi but it stays on (green), then if i close but manually it stays green forever, if i flip it again it goes off but it opens kodi, cause im not using the script.
well what i want is, can i switch the smartthings switch to a switch that doesnt stay on, it just pushes and goes back to initial state?
thanks in advance
-
@putefabio, checkout this post:
https://www.triggercmd.com/forum/topic/86/actiontiles-tile-with-triggercmd-bookmark-url/14
It says you can make a small modification to the SmartThings code to make it so the switch goes back off after you flip it on.
-
thanks a lot for a so quick awnser, that did the trick
-
@TigoleBitties, I just tried it and it's working for me. Can you verify your phone has Internet access?
Also, you installed both the SmartApp and the Device Handler, correct?
-
I am getting an Error saving unnamed page when I click Done on last page.
Also I am using an account from Google, how shall I skip entering the credentials as you propose? -
@George-Hatzisymeon, you mentioned you're using an account from Google. If you do that, then before you can log SmartThings into your TRIGGERcmd account you also need to set your password in your profile in your TRIGGERcmd account. To get to your profile, click your name in the upper-right.
You installed the device handler and SmartApp, correct?
Here's a video showing the process: https://www.youtube.com/watch?v=dq-loAiKAgo
If you still get that error, please post a screenshot. It might help me understand what's happening.
-
@Russ said in SmartThings integration - flip a virtual switch to run a command:
Handler
It works like a charm!
I have just follow the instructions, and had it immediately working. Still good at 2021 -
This post is deleted!