gytisgreitai / openhab-google-home

13 stars 1 forks source link

Couldn't update setting. Check your connection. #2

Closed mtzro2003 closed 5 years ago

mtzro2003 commented 5 years ago

So, I installed app-only and I set the whole thing up with my already running ningx and let's encrypt certificate. I set up a simple switch in openHAb as a test like this:

Switch SW_TEST (gTest) {google="action.devices.types.SWITCH" [roomHint="Kitchen"]}

and I tried to link my Google Home account with [test] OpenHAB Automation Tried to link numerous times, but every attempt ended with the message Couldn't update setting. Check your connection. Is this a Google problem or...? In the app-only logs I have - I edited the tokens and host IP:

token obj { token_type: 'bearer',
  access_token: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
  expires_in: 86400,
  refresh_token: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' }
Request {
  "inputs": [
    {
      "intent": "action.devices.SYNC"
    }
  ],
  "requestId": "18328017927734011383"
}
Headers {
  "host": "XXXXXXXXXXXXXXXXXXX:8443",
  "x-real-ip": "66.102.9.79",
  "x-forwarded-for": "66.102.9.79",
  "x-forwarded-proto": "https",
  "connection": "close",
  "content-length": "80",
  "content-type": "application/json;charset=UTF-8",
  "google-assistant-api-version": "v1",
  "authorization": "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "user-agent": "Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)",
  "accept-encoding": "gzip,deflate,br"
}
Response {
  "status": 200,
  "headers": {
    "content-type": "application/json;charset=utf-8"
  },
  "body": {
    "requestId": "18328017927734011383",
    "payload": {
      "agentUserId": "",
      "devices": [
        {
          "id": "SW_TEST",
          "type": "action.devices.types.SWITCH",
          "traits": [
            "action.devices.traits.OnOff"
          ],
          "name": {
            "defaultNames": [
              null
            ],
            "nicknames": [
              null
            ]
          },
          "roomHint": "Kitchen",
          "willReportState": false,
          "customData": {
            "itemType": "Switch"
          },
          "attributes": {}
        }
      ]
    }
  }
}
mtzro2003 commented 5 years ago

Dunno if it counts, but nginx is setup up like this:

server {
        listen                          443 ssl;
        server_name                     openHAB;
        root                            /var/www/html;
        ssl_certificate                 /etc/ssl/chained.pem;
        ssl_certificate_key             /etc/ssl/domain.key;

        location /smarthome {
                proxy_pass                              http://XXX.XXX.XXX.XXX:3000/smarthome;
                proxy_set_header Host                   $http_host;
                proxy_set_header X-Real-IP              $remote_addr;
                proxy_set_header X-Forwarded-For        $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto      $scheme;
        }
        location /standalone-auth {
                proxy_pass                              http://XXX.XXX.XXX.XXX:3000/standalone-auth;
                proxy_set_header Host                   $http_host;
                proxy_set_header X-Real-IP              $remote_addr;
                proxy_set_header X-Forwarded-For        $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto      $scheme;
        }
}
gytisgreitai commented 5 years ago

You need to name your item: Switch SW_TEST "Test Switch" (gTest) {google="action.devices.types.SWITCH" [roomHint="Kitchen"]}

mtzro2003 commented 5 years ago

Well, this is just embarrassing... :blush: How could I forgot to add the label?!?

So... right now it works beautifully... The roomHint is marvelous! I have some 150 items exposed to Google Home - many of those are TV channels (so that I can say "Hey Google, turn on Viasat History") in 6 rooms... You can imagine me cursing when having to move them to rooms :laughing: This will be a walk in the park now! Many thanks for all you work! If I encounter issues I'll surely get back to you!

Gotta wrap my head around those actions and traits and see how to set up my items...

gytisgreitai commented 5 years ago

Well if you have questions, ask