Google Home not getting a valid assistant response when executing actions for bulbs - actions-on-google

I have integrated google assistant into my own app. When executing an action for a LIGHT device type, such as turning it on/off, I get an assistant response like "OK, Sorry, I can't reach the Bulb right now. Please try again" but the execution happens anyway. Following is a sample response which will send in response to an execute intent request.
{"payload":{"commands":[{"ids":[12549],"status":"SUCCESS","states":{"online":true,"on":true}}]},"requestId":"15838577278862147328"}
What am I doing wrong here? this works perfectly for other device types (OUTLET, SWITCH).
Also I can use the home app ui for bulb to control it manually and it works perfectly.
The bulb I'm using is a TuyaSmart rgb light bulb.

Looking at the response, it appears that the identifier 12549 is a number and not a string. The platform expects a device ID to be a string. By putting it in quotes it will work.

Related

Google Signin for Unity (Windows standalone build) - invalidGoogleToken when used with Playfab

Hopefully someone can point me in the right direction here, I'm attempting to log into Playfab using a google auth code retrieved from an async call in Unity, the flow is as follows:
Click my login to google button in Unity.
Unity begins to listen for the response and opens a google login browser session.
User clicks email/signs into email they want.
This response is returned to Unity with an auth code.
I have then attempted to use the returned google auth code with playfabs LoginWithGoogleAccount method":
PlayFabClientAPI.LoginWithGoogleAccount(new LoginWithGoogleAccountRequest()
{
TitleId = PlayFabSettings.TitleId,
ServerAuthCode = returnedWindowsGoogleAuthCode,
CreateAccount = true,
}, OnPlayfabGooglePlayAuthComplete, OnPlayfabGooglePlayAuthFailed);
This then fails with a returned response from playfab with "invalidGoogleToken".
From what I've read from what I've come across on google is that this token is possibly in a "used" state by the time I am calling LoginWithGoogleAccount and I possibly need a refreshed token? but I am not too familiar with the Google API so I could be completely off the mark there? But if this is the case what should I do here? How do I re-request a valid token without going back to the browser to do the same thing again?
To give you an idea of pretty much the exact code I'm looking at but I've altered slightly to get it to work in Unity I am following the Google Sample OAuthDesktopApp code:
OAuthDesktopApp Sample Code
I am calling the method "button_Click", this runs and makes the request, Unity then begins listening for the google response at line 72 and the auth code is then output to logs at line 129.
This auth code output at line 129 is what I have then been passing back in to LoginWithGoogleAccount which then results in the failed "invalidGoogleToken", this does also then run a request for user information which does correctly return the name/email of the user you signed in with etc.
Just to add to my previous comments, if I remove the call to performCodeExchange line 132 (I read somewhere that at that point I am swapping the auth code for a token and thus the auth code will no longer work? I'm guessing here) and then if I call PlayFabClientAPI.LoginWithGoogleAccount with the auth code I am presented with:
PlayFabError error:
error.GetHashCode(): 2051826304
error.Error: InvalidGoogleToken
error.ErrorMessage: invalid_grant details: Missing code verifier.
error.ErrorDetails: null
Hopefully this may help someone guide me.
First thanks to those that replied to this, So I've managed to solve this after a comment from a Playfab mod, There appears to be no official way from Google to login using a standlone Unity build nor an official way to then login to Playfab using the same build method.
The solution I've used uses a modified Unity version of one of the Google samples from OAuth 2.0 for Mobile & Desktop Apps .
This will allow you to get the oauth code within Unity then you can pass this oauth code to Playfab for login, BUT Playfab has since deprecated the way to do this (which is silly if its the only solution) so you need to modifiy Playfabs SDK to include the accesstoken then you can use this to finally login.

Google Smart Home action responds "[Service] is not available right now" after the action completed succesfully

My Google SmartHome action is giving an error message "[Service] cannot be reached right now" after having executed the command properly. My device is properly switched on / off, but Google ends with that annoying message.
The input I get from Google:
{"inputs":[{"context":{"locale_country":"NL","locale_language":"nl"},"intent":"action.devices.EXECUTE","payload":{"commands":[{"devices":[{"id":"6"}],"execution":[{"command":"action.devices.commands.OnOff","params":{"on":true}}]}]}}],"requestId":"1389468583286354563"}
The response I give back:
{"requestId":"1389468583286354563","payload":{"commands":[{"ids":["6"],"status":"SUCCESS","states":{"on":true,"online":true}}]}}
Function execution took 2287 ms, finished with status code: 200
Next, I already (async) report state:
{"requestId":"1389468583286354563","agentUserId":"f0524769-7ffb-4ae4-8cec-5d67e6f6aa92","payload":{"devices":{"states":{"6":{"on":true,"online":true}}}}}
The report state API gives back that that was successfull.
I have no clue why Google gets back (even though the action is carried out successfully) that they cannot reach our service?
Thanks to #Devunwired: I overlooked the Google Assistant Action logs. In it, it said the function is returning an empty JSON response. It turned out that the return statement was 1 parenthesis too early, causing the async function to return an empty value.

Google Actions no execute

I have written a simple Java application based on Google example code:
https://github.com/actions-on-google/smart-home-nodejs
and watched a lot of movies, took Google codelabs, but I'm stuck.
My application responses to required actions (intents: action.devices.SYNC, action.devices.QUERY, action.devices.EXECUTE) - chcecked with Google validator, JSON validators. I have also implemeted simple OAuth authorization, created Google Actions projects for Smart Home.
After few hours of debugging I have got:
my test application is listed in Add devices menu,
I can select my application from list and connect it,
Google performs OAuth checking and everythings is OK (I see this in Nginx logs and my application logs),
then Google Actions sends action.devices.SYNC request to my server,
I responde with a test device:
{
"requestId":"14182994871341693427",
"payload":{
"agentUserId":"rysiek",
"devices":[
{
"id":"dev1",
"type":"action.devices.types.LIGHT",
"traits":[
"action.devices.traits.OnOff"
],
"name":{
"name":"główne"
},
"willReportState":false,
"roomHint":"pokój dzienny"
}
]
}
}
I have also tryied with willReportState: true,
then it (Google Assistant) asks me to assign devices to room which I'm doing.
After this nothing more is working.
I'm trying to say to my phone Turn on light główne (in polish "Włącz światło główne", "Włącz światło główne w pokoju dziennym" etc - tried a lot of sentences), but it just shows me web search results. No request is send to my server (action.devices.EXECUTE) - I have everything behind a Nginx proxy, and no requests are done to my server (not request is visible in logs).
I have no idea, what to do to make it work. Any help will be appreciated.
BTW1. Google Assistant is available in Poland from this year (16.01.2019) from few days and I'm wondering if this is my problem or Google problem? Is this even possible?
For example I'm saying Ok Google, synchronize my devices (in polish: Ok Google, synchronizuj moje urządzenia), and I get response in english:
"Sorry, I didn't get any response.".
But I see that there was a request for SYNC, and my server responed.
BTW2. I have connected Google Chromecast to Google Assistant, and it works without a problem - I'm mean I saying Turn on TV (in polish: Włącz telewizor) and TV is started like expected.
Checking the list of supported languages for smart home traits, Polish is currently not included. While it does seem like your SYNC response does work, you won't be able to interact with devices in Polish right now. While this will likely happen in the future, you'll only be able to use one of the languages mentioned above for the moment.
Once Polish support for smart home actions are supported, you shouldn't need to do any extra work for commands to succeed.

Query regarding ColorSetting trait in Google Device Actions

I am not able to query google assistant about "what color is my light", the documentation at the following web page says that ColorSetting trait has the ability for a light to asked about what color it is set to but I am not able to accomplish it. Please help...
URL:
https://developers.google.com/actions/smarthome/traits/colorsetting
1) Check that your sync response is valid in the code validator:
https://developers.google.com/actions/smarthome/traits/colorsetting#validator
2) Open your Google Home app from your phone and select your device: check if the app shows the right device state and check that you received a query request and that you answered with the color.
3) Use Stackdriver logging https://cloud.google.com/logging/?hl=it to view if there's any error in Google Cloud Platform.
4) You can compare your JSON responses with the documentation examples using an on-line file merge tool to be sure that is correct.

wit.ai understanding tab is not resulting expected intent roles

I am developing an app using wit ai and facebook messenger, everything is working as expected but I am stuck on a expression which is always returning wrong role.
I have added similar expression for that intent but when I test the same sentence it returns wrong role. Please see screenshot attached
Below image shows that expression is properly validated, here mumbai is recognized as wit/location:origin
But When I test the same expression, it only returns location against mumbai rather than location:origin..
Any help ?
I checked and your training was stuck for some reason. I just restart it manually and it works now.
Training Status Icon