sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
Other
230 stars 124 forks source link

Sinric Pro Google Home IFTTT #70

Closed laxmru closed 4 years ago

laxmru commented 4 years ago

I am following the steps mentioned for Google Home and IFTTT for my TV device which already set up for Alexa.

I am unable to run onPowerState event. Below mentioned code I am using in IFTTT app.

"payload" :{ " api_key":"my key from webhook", "device_id":"my device ID from Sinric Pro", "action":"onPowerState", "value":{ "state":"On" } }

It will be really helpful if you can provide me code for other events as I don't know json.

kakopappa commented 4 years ago

" api_key":"my key from webhook

API key is from Sinric Pro not IFTTT key. You can create an API key from credentials

On Sun, 14 Jun 2020 at 9:27 PM laxmru notifications@github.com wrote:

I am following the steps mentioned for Google Home and IFTTT for my TV device which already set up for Alexa.

I am unable to run onPowerState event. Below mentioned code I am using in IFTTT app.

"payload" :{ " api_key":"my key from webhook", "device_id":"my device ID from Sinric Pro", "action":"onPowerState", "value":{ "state":"On" } }

It will be really helpful if you can provide me code for other events as I don't know json.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/70, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZVJ3ET6SPMMMKDDOY3RWTM6RANCNFSM4N5PEWOQ .

laxmru commented 4 years ago

" api_key":"my key from webhook

API key is from Sinric Pro not IFTTT key. You can create an API key from credentials

On Sun, 14 Jun 2020 at 9:27 PM laxmru notifications@github.com wrote:

I am following the steps mentioned for Google Home and IFTTT for my TV device which already set up for Alexa.

I am unable to run onPowerState event. Below mentioned code I am using in IFTTT app.

"payload" :{ " api_key":"my key from webhook", "device_id":"my device ID from Sinric Pro", "action":"onPowerState", "value":{ "state":"On" } }

It will be really helpful if you can provide me code for other events as I don't know json.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/70, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZVJ3ET6SPMMMKDDOY3RWTM6RANCNFSM4N5PEWOQ .

I have made the changes as suggested by you. However, it is not running.

Please note this is already link with Alexa which is working fine.

Also as your Sinric Pro tv example, I am using "onPowerState". Hope that is correct. On Google home I say "turn on tv" which is not working. However, it works fine with Alexa

kakopappa commented 4 years ago

action is wrong it should be "setPowerState",

{ "api_key":"API key from Portal -> Credentails -> API Key", "device_id":"device id from Portal -> Devices", "action":"setPowerState", "value":{ "state":"On" } }

laxmru commented 4 years ago

Will I require to create App secret. Because, the program doesn't accept appy key alone?

laxmru commented 4 years ago

I have tried correct action as it is by just replacing api key and device id. Also created new api key with api secret. However, it is not working

laxmru commented 4 years ago

APIinArduinoCode apikeyinsinricpro Iftt1 Iftt2 I am adding some screenshot of your understanding

kakopappa commented 4 years ago

Hi, sorry about the late response.

Your IFTTT configurations looks correct. Just make sure API key is correct in IFTTT.

  1. Can you do a simple post request using curl or postman with the same URL and check the output?

CURL:

curl --location --request POST 'https://ifttt.sinric.pro/v1/actions' \ --data-raw '{ "api_key" : "xxxx", "device_id": "xxx", "action": "setPowerState", "value": { "state": "On" } }'

POSTMAN

image

laxmru commented 4 years ago

Hi I have tried this in POSTMAN. Below mentioned is the result { "success": false, "message": "API Key is invalid or unauthorized!" } Let me explain my set up

1. How I set up IFTTT ? Ans : Webbook key is updated in API integration. Rest of the things as mentioned in screenshot in my previous comment.

2. When my TV devices in in Sinric Pro Dashboard shows online? Ans: In Arduino IR TV example code I have used API key and API secret from "Your App Keys and Secrets" in Credentials section in https://portal.sinric.pro/credential/list

3. Why I have created one more API key (which does not have API secret)? Ans : This is done because it is shown in documentation in IFTTT documentation.

4. Which API Key I am using in IFTTT body? Ans : I have used API key from "Your API Keys" in Credentials section in https://portal.sinric.pro/credential/list

kakopappa commented 4 years ago

seems your API key is wrong.

{ "api_key" : "aa3b98f2-xxxxxxxx-48c93200537c", "device_id": "5eexxxxa", "action": "setPowerState", "value": { "state": "On" } }

This works. I just tried it

laxmru commented 4 years ago

Hi There is nothing wrong in API key. I tried using "Copy" button beside API key. Also I have tried selecting and copying This I tried in POSTMAN also. Please note this Key in not my Arduino sketch.

laxmru commented 4 years ago

Hi This is just worked now. I did two things.

  1. I deleted a device "TV" in sinric.com
  2. In IFTTT I have changed the sentence from "turn on tv" to "turn on TV"
sivar2311 commented 4 years ago

Due to inactivity I assume that the problem has been solved. For this reason, the issue will be closed now. If there are still errors or questions related to this topic, please reopen this issue.