Closed harymk closed 3 years ago
The "usage" documentation has a section on creating buttons: https://github.com/sweharris/Alexa-Smart-Home-VirtualButtons/blob/main/usage/README.md#createchange-button
Give me an example where am type this
If you're using a command line with curl
then the usage guide provides an example: curl -H "Authorization: $PASS" $URL -d '{comamnd_you_want}'
The install guide also shows how you can create buttons via the command line or via the AWS console: https://github.com/sweharris/Alexa-Smart-Home-VirtualButtons/blob/main/install/README.md#via-the-api-preferred
In that example it was to set one of the "special" buttons, but you can do the same thing for normal buttons; just pick a number under 100 and it'll just work.
C:\Users\Home>curl -H "Authorization: pass" url/default/Smart_Home_Virtual_Buttons -d {"command":"setname","param1":"10", "param2":"Garage Door"} {"Answer:":"Bad JSON passed: invalid character 'c' looking for beginning of object key string"}curl: (3) [globbing] unmatched close brace/bracket in column 19
I don't know about Windows, but on Linux (which I use) I would surround the JSON with '
characters.
So:
curl -H "Authorization: pass" url/default/Smart_Home_Virtual_Buttons -d '{"command":"setname","param1":"10", "param2":"Garage Door"}'
Without them the spaces in the JSON would split the paramters and so the -d
flag wouldn't send the whole string.
Which commant this. Put,post, request
It's a POST; the -d
on curl automatically sets that.
curl -H "Authorization: pass" curl/default/Smart_Home_Virtual_Buttons -d "{\"command\":\"setname\", \"param1\":\"1\", \"param2\":\"Test Button 1\"}"
its worked
OK good. Your \ quoting inside " maybe the best way to handle it in Windows, dunno. The result is the same as the Unix ' ... ' syntax.
Glad you got it working!
{\"error\":\"\",\"error_description\":\"\",\"access_token\":\"Atza|SECRET_STRING\",\"refresh_token\":\"Atzr|ANOTHER_SECRET_STRING\",\"expires_in\":3600,\"TimeSet\":1620265649}
What command did you run that caused that error? This looks like the notification secret that's used to tell Alexa when a button has been pressed. I'm not sure what command path you used to get that response.
(I edited your message to remove secret strings)
Linked to alexa skill
100001 in db showing this
Oh, OK. That's not a problem. That's saying there's no error; error: "", error_description: "", access_token: "secret.."... and so on.
That's a good sign. It means the linking worked correctly.
(EDIT) If you now tell your alexa app to discover new devices your test button should(!) show up
Ok. device not discovered
Give it 5 minutes. I've noticed Alexa doesn't always populate new devices immediately!
ok
one more is this suport colour command, fan speed
No, this emulates a door sensor; Alexa only supports "open" or "closed". Sensors (door or motion) are the only ones that can be used to trigger routines, so other devices like coloured lights or fans can't be emulated and still be used to trigger routines.
why try that too...
By mistake when I was writing this code I did emulate a smart switch. It showed up in the devices, but didn't show up in the triggers for a routine. I dug deeper into the Alexa documentation and found it was only sensors (door, motion) that can be used as a smart home trigger for routines. Since this program's goal was to allow for routines to be triggered I had to emulate a sensor.
ok
How to add devices