Git Product home page Git Product logo

google-home-loxone's Introduction

GOOGLE HOME FOR LOXONE

npm Download License

This project allow you to control your Loxone Server from your Google Home.

Requirements

To use this plugin, you have to create your own SmartHome project in google : https://developers.google.com/assistant/smarthome/develop/create

Set up an OAuth 2.0 server

We suggest to use the free oauth 2.0 server : OAuth0

  1. Create an account or login
  2. Create a new application (Eg : Google Home)
  3. In Allowed Callback URLs section, add https://oauth-redirect.googleusercontent.com/r/YOUR_GOOGLE_PROJECTNAME

### Create an Actions on Google developer project

  1. Use your Oauth0 App ClientId et ClientSecret, created before, in the Account Linking Section Account Linking
  2. In the Fulfillment section, use the google-home-loxone url (Eg : http://YOUR_IP:3000/smarthome). It must be accessible from the cloud.

Request State Config

The Report State feature allows a cloud integration to proactively provide the current state of devices to the Home Graph without a QUERY request. This is done securely through JWT (JSON web tokens).

  1. Navigate to the Google Cloud Console API Manager for your project id.
  2. Enable the HomeGraph API. This will be used to request a new sync and to report the state back to the HomeGraph.
  3. Click Credentials
  4. Click 'Create credentials'
  5. Click 'Service Account'
  6. Create a new service account by folling steps (without specific role)
  7. Edit the service account and add a new JSON key
  8. Download the key and save it in your home directory ~/.google-home-loxone/jwt.json

How to start

Installation

Two options are available. Use the docker image (recommanded)

docker run -p 3000:3000 -v ./jwt.json:/root/.google-home-loxone/jwt.json -v ./config.json:/root/.google-home-loxone/config.json -e GHL_VERBOSE=true --name google-home-loxone -d rtrompier/google-home-loxone:latest

or install the plugin through npm or download the files from here.

$ sudo npm install -g google-home-loxone --unsafe-perm

Or update to latest version when already installed:

$ sudo npm update -g google-home-loxone --unsafe-perm

Configuration

Create a config.json file (usually in ~/.google-home-loxone) to allow the plugin to connect to your loxone server

{
  "loxone": {
    "protocol": "http",
    "url": "LOXONE_IP", // Your loxone IP or hostname
    "user": "LOXONE_USER, // Your loxone username
    "password": "LOXONE_PASSWORD" // Your loxone password
  },
  "oAuthUrl": "https://rtrompier.eu.auth0.com", // Your oAuthUrl provided by Oauth0
  "authorizedEmails": [
    "[email protected]" // The emails of the users will be allowed to call your server
  ],
  "agentUserId": "loxone-12345", // The name of your app
  "log": true // Activate verbose mode
}

Start

$ google-home-loxone

To see all options you can start with help arguments:

$ google-home-loxone --help

You can pass the following params :

  • port The port used by the google-home-loxone server
  • jwt The path of your jwt.json file, created in Google Cloud Console
  • config The path of your config.json file, to configure the application

Weather

If you don't want pay for Loxone Meteo service, you can connect your Loxone Server to the weather information from Netatmo Weather Station near of you. You can find all station here : https://weathermap.netatmo.com/

You just have to start this server, and plug your Loxone Server on it.

  1. Follow the instruction to configure it, and start.
  2. You can retrieve weather informations by calling : http://YOUR_SERVER:3000/weather
  3. You can now configure your loxone server, to parse result and get weather informations for free.

google-home-loxone's People

Contributors

hug-az-pipeline avatar rtrompier avatar stevengoossensb avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

google-home-loxone's Issues

Config help : requested entity was not found

Hi,
I have followed the readme to the letter, unfortunately I can't get it to work.

When starting the app, after the loxone init, I'm getting this :

init sucessfull
Server initialized
(node:14743) UnhandledPromiseRejectionWarning: Error: Requested entity was not found.
at Gaxios._request (/usr/local/lib/node_modules/google-home-loxone/node_modules/gaxios/build/src/gaxios.js:129:23)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async JWT.requestAsync (/usr/local/lib/node_modules/google-home-loxone/node_modules/google-auth-library/build/src/auth/oauth2client.js:345:18)
(Use node --trace-warnings ... to show where the warning was created)
(node:14743) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14743) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The homegraph is activated, service account created, json key placed correctly in ~/.google-home-loxone/jwt.json, auth0 callback configured etc.

Maybe my agentUserId is wrong, it's not clear what this value should be and I have tried many values. My best guess is that it's the ID of the Google Action, the same that I find in the URL while configuring the Google Action, is that correct ? If my project is called loxone, it's something like loxone-a2c3e.

Same with auth0 callback, is the url correct ? https://oauth-redirect.googleusercontent.com/r/loxone-a2c3e

Do I have to create a release of the Google Action ? alpha, beta..

setup help

Hello

I would like to try, but unfortunately I don't know how to use it?
Can you help integrate Google into Loxone?
At least a little more detailed instructions...

Thank you
Swoby

How to deploy this?

Hi @rtrompier,

Am interested to try and implement this (have been trying OpenHab but it has no heating functionality) and also keen to learn more about the voice services from Google Home.

However, reading the readme I am quite unclear on how to set this up to be used.

Is there any pre-reading I should do or basic actions that I can try before trying to implement this?

Initial configuration & setup

I've managed to get everything up & running after some fiddling around. Also thanks for the great work you've accomplished so far.

However it seems there is still something wrong in my configuration when performing the initial SYNC request. I'm receiving the following response: "Requested entity was not found."

Can you give some additional information about what exactly should be in the configuration file for the "agentUserId" & "token" properties?

Once up & running, I would be happy to help with adding some additional features to the codebase.

Compilation issues and unsafe dependencies

Hi, I wanted to try out this package, but compilation failed.
Next to that some dependencies are on old versions that have high security vulnerabilities, does the package not work with the patched versions?

npm WARN notice [SECURITY] systeminformation has the following vulnerabilities: 2 moderate. Go here for more details: https://www.npmjs.com/advisories?search=systeminformation&version=4.27.8 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] set-value has the following vulnerability: 1 high. Go here for more details: https://www.npmjs.com/advisories?search=set-value&version=2.0.1 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] node-forge has the following vulnerability: 1 high. Go here for more details: https://www.npmjs.com/advisories?search=node-forge&version=0.8.5 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] mem has the following vulnerability: 1 low. Go here for more details: https://www.npmjs.com/advisories?search=mem&version=1.1.0 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] lodash has the following vulnerability: 1 high. Go here for more details: https://www.npmjs.com/advisories?search=lodash&version=4.17.20 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] y18n has the following vulnerability: 1 high. Go here for more details: https://www.npmjs.com/advisories?search=y18n&version=4.0.0 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] yargs-parser has the following vulnerability: 1 low. Go here for more details: https://www.npmjs.com/advisories?search=yargs-parser&version=7.0.0 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] axios has the following vulnerability: 1 high. Go here for more details: https://www.npmjs.com/advisories?search=axios&version=0.18.1 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] axios has the following vulnerability: 1 high. Go here for more details: https://www.npmjs.com/advisories?search=axios&version=0.19.2 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
/usr/local/bin/google-home-loxone -> /usr/local/lib/node_modules/google-home-loxone/bin/global.js

> [email protected] install /usr/local/lib/node_modules/google-home-loxone/node_modules/mdns
> node-gyp rebuild

make: Entering directory '/usr/local/lib/node_modules/google-home-loxone/node_modules/mdns/build'
  CXX(target) Release/obj.target/dns_sd_bindings/src/dns_sd.o
In file included from ../src/dns_sd.cpp:1:
../src/mdns.hpp:32:10: fatal error: dns_sd.h: No such file or directory
 #include <dns_sd.h>
          ^~~~~~~~~~
compilation terminated.
make: *** [dns_sd_bindings.target.mk:165: Release/obj.target/dns_sd_bindings/src/dns_sd.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/google-home-loxone/node_modules/mdns/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 5.10.17-v7+
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/google-home-loxone/node_modules/mdns
gyp ERR! node -v v10.24.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/google-home-loxone/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm"})

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.