Git Product home page Git Product logo

openhab-google-home's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

mtzro2003

openhab-google-home's Issues

Will not link to google home app

Firstly i want to thank you for starting this project asim so sick of the errors on the official myopenhab method when switching on a light.

I have been at this now for over 2 days, i have followed the guide exactly and everything works as expected (not cert errors, site says 'OK' when visiting) all good.

When i go to add the account from the google home app and press it, it says 'logging in' and then 'adding' and then nothing, its not added no errors.

I'm on openhab 2.4.

I have 1 item set up as follows
Switch Light_GF_Office_Test "Test Light" (GF_Office, GF_Lights, Lights) {channel="mqtt:topic:6a326ec3:esp_32_Thing:PowerSwitch",google="action.devices.types.SWITCH"}

if theres anything you can do to help it would be greatly appreciated.

Thanks,

Couldn't update setting. Check your connection.

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": {}
        }
      ]
    }
  }
}

Similar named items

I have a little bit of trouble when turning ON/OFF similar named items...
With the openHAB's official google connector it's not happening.
So, here are the items:

Switch Kitchen_TV_Switch "Kitchen TV" <television> (gTV_Switch, gNight_Mode_OFF) /*["Switchable"]*/ {google="action.devices.types.TV" [roomHint="Kitchen"]}
Switch Kitchen_TV_Source_TVSource "Kitchen TV Source" (gTV_Sources) /*["Scene"]*/ {google="action.devices.types.SWITCH" [roomHint="Kitchen"]}
Switch Kitchen_TV_Channel_ProTV "Kitchen ProTV" (gTV_Channels) /*["Scene"]*/ {expire="1s, state=NULL", google="action.devices.types.SWITCH" [roomHint="Kitchen"]}

I guess the appellatives for these items would be 'kitchen tv','kitchen tv source' and 'kitchen protv'.
When asking Google (being in the kitchen) to Turn ON TV it replies with Sure, turning ON 3 things and all 3 items receive the ON command:

2019-11-06 11:17:36.923 [vent.ItemStateChangedEvent] - Kitchen_TV_Channel_ProTV changed from NULL to ON
2019-11-06 11:17:36.926 [ome.event.ItemCommandEvent] - Item 'Kitchen_TV_Source_TVSource' received command ON
2019-11-06 11:17:36.931 [ome.event.ItemCommandEvent] - Item 'Kitchen_TV_Switch' received command ON

I guess the logs from the app-only image corresponding to this command are:

Request {
  "inputs": [
    {
      "context": {
        "locale_country": "US",
        "locale_language": "en"
      },
      "intent": "action.devices.EXECUTE",
      "payload": {
        "commands": [
          {
            "devices": [
              {
                "customData": {
                  "itemType": "Switch"
                },
                "id": "Kitchen_TV_Channel_ProTV"
              },
              {
                "customData": {
                  "itemType": "Switch"
                },
                "id": "Kitchen_TV_Source_TVSource"
              },
              {
                "customData": {
                  "itemType": "Switch"
                },
                "id": "Kitchen_TV_Switch"
              }
            ],
            "execution": [
              {
                "command": "action.devices.commands.OnOff",
                "params": {
                  "on": true
                }
              }
            ]
          }
        ]
      }
    }
  ],
  "requestId": "4295158831957456047"
}
Headers {
  "host": "XXXXXXXXXXXXXXX:8443",
  "x-real-ip": "66.102.9.105",
  "x-forwarded-for": "66.102.9.105",
  "x-forwarded-proto": "https",
  "connection": "close",
  "content-length": "459",
  "content-type": "application/json;charset=UTF-8",
  "google-assistant-api-version": "v1",
  "authorization": "Bearer 7113feb8173cdec23cdfc109ebc99524ba39917923cbe506cf9a307186762b7f",
  "user-agent": "Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)",
  "accept-encoding": "gzip,deflate,br"
}
on off execute got true
execution result value ON
execution result states {}
on off execute got true
execution result value ON
execution result states {}
on off execute got true
execution result value ON
execution result states {}
Response {
  "status": 200,
  "headers": {
    "content-type": "application/json;charset=utf-8"
  },
  "body": {
    "requestId": "4295158831957456047",
    "payload": {
      "commands": [
        {
          "ids": [
            "Kitchen_TV_Channel_ProTV"
          ],
          "status": "SUCCESS",
          "states": {
            "on": true
          }
        },
        {
          "ids": [
            "Kitchen_TV_Source_TVSource"
          ],
          "status": "SUCCESS",
          "states": {
            "on": true
          }
        },
        {
          "ids": [
            "Kitchen_TV_Switch"
          ],
          "status": "SUCCESS",
          "states": {
            "on": true
          }
        }
      ]
    }
  }
}

I'm sure I could name the items entirely different from each other and, then, the problem will go away, but, as I said, with the official implementation it's not happening. You can see in the items' definition the switchable and scene tags as they were before switch to your implementation...
Also, with another names, I will not sound 'natural' when asking Google...
I'm in the kitchen and I want to start the TV --> Hey Google, turn on TV; change the channel -- Hey Google, turn on ProTV and so on...
Any idea?

Error with complex light

Hello Gytis,

Still maintaining this? ๐Ÿ˜„

I'm trying to replicate the complex light example you gave in the docs.
Here are my items:

Group gLivingroom_Light "Livingroom Light" {google="action.devices.types.LIGHT" [roomHint="Livingroom"]}

Switch Livingroom_Light_Switch "Livingroom Light Switch" <light> (gLivingroom_Light) {channel="hue:group:00178840fd2f:1:switch", google="action.devices.traits.OnOff"}
Dimmer Livingroom_Light_Brightness "Livingroom Brightness" <light> (gLivingroom_Light) {channel="hue:group:00178840fd2f:1:brightness", google="action.devices.traits.Brightness"}
Dimmer Livingroom_Light_ColorTemperature "Livingroom Light Temp." (gLivingroom_Light) {channel="hue:group:00178840fd2f:1:color_temperature"}
Color Livingroom_Light_Color "Livingroom Light Color" (gLivingroom_Light) {channel="hue:group:00178840fd2f:1:color"}

When syncing, I got the following error in the container logs (using 'app-only'):

Request {                                                                                                                                                                                                                                                   
  "inputs": [                                                                                                                                                                                                                                               
    {                                                                                                                                                                                                                                                       
      "intent": "action.devices.SYNC"                                                                                                                                                                                                                       
    }                                                                                                                                                                                                                                                       
  ],                                                                                                                                                                                                                                                        
  "requestId": "14767033563091986596"                                                                                                                                                                                                                       
}                                                                                                                                                                                                                                                           
Headers {                                                                                                                                                                                                                                                   
  "host": "XXXX.XX.XX:8443",                                                                                                                                                                                                                               
  "x-real-ip": "XX.XX.XX.XX",                                                                                                                                                                                                                               
  "x-forwarded-for": "XX.XX.XX.XX",                                                                                                                                                                                                                         
  "x-forwarded-proto": "https",                                                                                                                                                                                                                             
  "connection": "close",                                                                                                                                                                                                                                    
  "content-length": "80",                                                                                                                                                                                                                                   
  "content-type": "application/json;charset=UTF-8",                                                                                                                                                                                                         
  "google-assistant-api-version": "v1",                                                                                                                                                                                                                     
  "authorization": "Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",                                                                                                                                                               
  "user-agent": "Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)",                                                                                                                                                    
  "accept-encoding": "gzip,deflate,br"                                                                                                                                                                                                                      
}                                                                                                                                                                                                                                                           
sync error TypeError: Cannot read property 'google' of undefined                                                                                                                                                                                            
    at Object.toGoogleDevice (/opt/app/sync/sync.js:65:68)                                                                                                                                                                                                  
    at /opt/app/smarthome.js:65:51                                                                                                                                                                                                                          
    at Array.forEach (<anonymous>)                                                                                                                                                                                                                          
    at /opt/app/smarthome.js:61:27                                                                                                                                                                                                                          
    at step (/opt/app/smarthome.js:33:23)                                                                                                                                                                                                                   
    at Object.next (/opt/app/smarthome.js:14:53)                                                                                                                                                                                                            
    at fulfilled (/opt/app/smarthome.js:5:58)                                                                                                                                                                                                               
    at <anonymous>

What am I doing wrong?
Thanks,
Mihai

Add logging for errors

When I try to sync my devices, Google responds with Sorry, something went wrong..., but nothing get's logged into the container logs.
I know I did some intensive editing to my items and I cannot pinpoint where is the problem...
Looking at the items definitions and metadata everything looks pretty normal.
Only if the app would log somehow what's the problem... ๐Ÿ˜„
I was working on my TV items and I think I didn't change something elsewhere, but... who knows...?
Is it doable?

app.log for `app-only` image

Well, I've upgrade to latest image and I cannot see the log in the am-i-working endpoint.

...............................
       },
        "roomHint": "Livingroom",
        "willReportState": false,
        "customData": {
            "itemType": "Switch"
        },
        "attributes": {}
    }
]

Log file:

Log file coud not be found/read Error: ENOENT: no such file or directory, open '/var/log/app.log'

If I manually create the log file, it gets displayed, but it doesn't log any action from Google.

/opt/app # ls -la /var/log/                                                                                                                                                                                                                                                                                                
total 8                                                                                                                                                                                                                                                                                                                    
drwxr-xr-x    2 root     root          4096 May  9 20:49 .                                                                                                                                                                                                                                                                 
drwxr-xr-x    1 root     root          4096 May  9 20:49 ..                                                                                                                                                                                                                                                                
/opt/app # touch /var/log/app.log                                                                                                                                                                                                                                                                                          
/opt/app # ls -la /var/log/                                                                                                                                                                                                                                                                                                
total 12                                                                                                                                                                                                                                                                                                                   
drwxr-xr-x    1 root     root          4096 Nov  6 07:54 .                                                                                                                                                                                                                                                                 
drwxr-xr-x    1 root     root          4096 May  9 20:49 ..                                                                                                                                                                                                                                                                
-rw-r--r--    1 root     root             0 Nov  6 07:54 app.log                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
/opt/app # echo test >> /var/log/app.log                                                                                                                                                                                                                                                                                   
.............................
        "roomHint": "Livingroom",
        "willReportState": false,
        "customData": {
            "itemType": "Switch"
        },
        "attributes": {}
    }
]

Log file:

test

REMOTECONTROL: add action.devices.commands.mediaStop

I'd like to request to add action.devices.commands.mediaStop to action.devices.traits.MediaState.
Even if openHAB player item does not include a stop command type, the problem could be circumvented using a string item as action.devices.types.REMOTECONTROL and a simple rule.

Docker container works on x86 ubuntu machine but not on Pi (openhabian)

I have my openhabian running on a Pi4 (B) and the docker instance running on my ubuntu server machine. The reason for this is that the docker container will not work on the Pi, do you have any idea why that is?

the logs reads....

[11:34:30] openhabian@openhab:/etc/openhab2/items$ sudo docker logs <redacted>
standard_init_linux.go:211: exec user process caused "exec format error"

Let's Encrypt

Hi!
I'd like to test your implementation which is faaaaar more flexible than the "standard" openhab one :))
However, got some questions about the docker part...
Is there some way to use it without Let's Encrypt?
I already have cert for my domain and I could mount the path to them in the container...
Another one... Would the connection between Google and my domain work with another port than 443? HTTPS - yes, but another port... something like https://your-domain-name:4443/smarthome?

Dockerfile

Any chance you could upload your Dockerfile for the gytisgreitai/openhab-ga-unofficial-demo:app-only, so that we can build our own containers and stay up to date.

Many thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.