MMM-Assistant: Register your Mirror as Google Assistant related device invalid JSON



  • Hi,

    I tried to get my Mirror to show in the Google Home app and followed the instructions here: https://github.com/eouia/MMM-AssistantMk2/blob/master/USAGE.md

    After i ran the command:

    curl -s -X POST -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ACCESSTOKEN" -d @deviceInstance.json \
    https://embeddedassistant.googleapis.com/v1alpha2/projects/YOUR_PROJECT_ID/devices/
    

    (replacing the YOUR_PROJECT_ID with my project ID) I got an error:

    {
      "error": {
        "code": 400,
        "message": "Invalid JSON payload received. Expected a value.\n“magicmirror”,  \n^",
        "status": "INVALID_ARGUMENT"
      }
    }
    
    

    My best guess is that I didn’t use the correct value for my model_id or project_id but I tried different values and still run into dead ends.

    Any pointers?


  • Module Developer

    @jck
    Show me the deviceInstance.json.



  • Hi, thanks for replying!

    Here’s the file:

    
    {
        "id": “my_mirror_001”,
        "model_id": “mirror-5a142-magicmirror-nz3frj”,
        "nickname": “Magic Mirror”,
        "client_type": "SDK_SERVICE"
    }
    
    

  • Module Developer

    @jck

    curl -s -X POST -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ACCESSTOKEN" -d @deviceInstance.json \
    https://embeddedassistant.googleapis.com/v1alpha2/projects/YOUR_PROJECT_ID/devices/
    

    did you modified YOUR_PROJECT_ID for your real project?
    And in that project your model_id is registered? (not to other project?)



  • @sean yes, I did.

    Just to be sure I just did the whole thing over again, trying to make sure I didn’t miss a step. But got the same results. As far as I can tell, it sends out the JSON alright, together with the right ACCESSTOKEN. But it seems to misread the value given at the id line.



  • @Sean

    I found the problem! As always, it was very simple as soon as you see it. The error did precisely report the problem but I was to blind to spot it! It said it expected a value, and it could’t read the one I provided.

    I used the wrong kind of " to make the input seen as STRING. If I had used the sample you provided in the module, all would have been good, but I copied the example on the github… and that one uses the slanted version of ".

    My mirror now shows up on the Google Home app! Thanks for all the hard work!



  • @jck hello mate
    did you follow any step by step tutorial to install google assistant? or can you write one up as I tried to install it but failed miserably.

    thanks.