Coder Social home page Coder Social logo

kservices / gbridge Goto Github PK

View Code? Open in Web Editor NEW
173.0 19.0 47.0 9.37 MB

gBridge.io allows you to control (almost) anything with Google Assistant, by translating voice commands to MQTT messages.

Home Page: https://about.gbridge.io

License: MIT License

PHP 68.13% Vue 0.16% HTML 19.42% JavaScript 12.30%
mqtt mqtt-message voice-commands smarthome assistant google-assistant google-assistant-api diy homeautomation

gbridge's Introduction

gBridge.io

Kickstarter

Currently, a Kickstarter campaign is running for this project. The funds will be used to ensure future development of gBridge, to improve its user interface and especially to implement support for Amazon Alexa devices! Let's have a look at Kickstarter and consider becoming a backer!

About gBridge.io

gBridge.io allows you to control (almost) any smart home device, any smart home software, with Google Assistant. Therefore, it transforms actions received from Google by voice commands to MQTT messages. Since MQTT is an open, commonly used, widely available and well documented protocol, you can integrate Google Assistant easily.

Got curious?

Sure! Let's find out more about gBridge here:

gBridge is an open source project

... it is available under the MIT license.

You can host your own instance of gBridge. That is really straightforward because we are providing Docker images.

gbridge's People

Contributors

giejay avatar peterkappelt 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

gbridge's Issues

Disable "Could not match topic ${topicuserpart} for user ${userid}"

Question:

Is it possible to disable somehow the log of "Could not match topic ${topicuserpart} for user ${userid}" in index.js line 313. If i comment the line inside docker container, will it work ??

The reason is: I have few ( 7 to be precise) Sonoff devices which post telemetry and status messages in MQTT and my redis-worker Log is filled with "Could not match" messages :(

This makes it really hard to see if a real problem exists :)

BR,

[feature request] Add color trait to lights

I have an IR controlled LED lamp and I made an esp8266 change the brightness and turn it on and off through gBridge but I'd also like to take advantage of it's different colors.

It is no possible to edit Topics and Settings

It is no possible to edit Topics and Settings after I add a device
The web site reacts with “Whoops, looks like something went wrong.”

I’m running the latest version in Docker.

Mqtt connection fails after working for a couple of days.

gBridge.io Issue template

Please read our support guidelines before creating an issue. Provide the information below for each issue you open.


**Instance Type (hosted/ docker/ other):hosted
**User ID (if using hosted service):95
**Steps to reproduce issue:it happens when starting the mqtt broker. No connection is established to the server.
It worked for the past days, and today about 6 hours ago it stopped working.
My mqtt broker is running on a pi in bridge connection.

See below config and error messages in the log when starting the mqtt broker.

Place your local configuration in /etc/mosquitto/conf.d/

A full description of the configuration file is at

/usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

connection kappelt-gbridge
address mqtt.gbridge.io:8883
bridge_attempt_unsubscribe true
bridge_protocol_version mqttv31
cleansession true
remote_username gbridge-u95
remote_password (redacted)
remote_clientid gbridge-u95-raspberry

topic gBridge/u95/+/+ both 0 "" ""
topic gBridge/u95/+/+/set both 0 "" ""
topic cmnd/# in 0 sonoff/ gBridge/u95/
topic stat/# out 0 sonoff/ gBridge/u95/
bridge_capath /etc/ssl/certs/
bridge_tls_version tlsv1.2

pi@raspberrypi:~ $ sudo tail /var/log/mosquitto/mosquitto.log -n 40
1578348398: Opening ipv6 listen socket on port 1883.
1578348398: Connecting bridge kappelt-gbridge (mqtt.gbridge.io:8883)
1578348398: New connection from 192.168.3.139 on port 1883.
1578348398: New client connected from 192.168.3.139 as MaxCube (c1, k15, u'pi').
1578348398: Socket error on client local.gbridge-u95-raspberry, disconnecting.
1578348399: New connection from 192.168.3.152 on port 1883.
1578348399: New client connected from 192.168.3.152 as Ventilation (c1, k10, u'pi').
1578348399: New connection from 192.168.3.147 on port 1883.
1578348399: New client connected from 192.168.3.147 as electric_kettle (c1, k15, u'pi').
1578348399: New connection from 192.168.3.149 on port 1883.
1578348399: New client connected from 192.168.3.149 as bathroom (c1, k10, u'pi').
1578348399: New connection from 192.168.3.145 on port 1883.
1578348399: New client connected from 192.168.3.145 as IRreceiver (c1, k30, u'pi').1578348399: New connection from 192.168.3.144 on port 1883.
1578348399: New client connected from 192.168.3.144 as samsung_tv (c1, k15, u'pi').1578348399: New connection from 192.168.3.158 on port 1883.
1578348399: New client connected from 192.168.3.158 as Vaskemaskine (c1, k15, u'pi').
1578348399: New connection from 192.168.3.136 on port 1883.
1578348399: New client connected from 192.168.3.136 as batterycharger (c1, k15, u'pi').
1578348399: New connection from 192.168.3.141 on port 1883.
1578348399: New client connected from 192.168.3.141 as living-room-floor-lamp (c1, k15, u'pi').
1578348399: New connection from 192.168.3.146 on port 1883.
1578348399: New client connected from 192.168.3.146 as dishwasher (c1, k15, u'pi').1578348399: New connection from 192.168.3.138 on port 1883.
1578348399: New client connected from 192.168.3.138 as kitchen-counter-light (c1, k15, u'pi').
1578348399: New connection from 192.168.3.154 on port 1883.
1578348399: New client connected from 192.168.3.154 as Blind_Controller (c1, k30, u'pi').
1578348400: New connection from 192.168.3.150 on port 1883.
1578348400: New client connected from 192.168.3.150 as shelly1-0587C6 (c1, k60, u'pi').
1578348400: New connection from 192.168.3.142 on port 1883.
1578348400: New client connected from 192.168.3.142 as shelly1-05874F (c1, k300, u'pi').
1578348400: New connection from 192.168.3.157 on port 1883.
1578348400: New client connected from 192.168.3.157 as shelly1-079CBA (c1, k60, u'pi').
1578348400: New connection from 192.168.3.135 on port 1883.
1578348400: New client connected from 192.168.3.135 as shelly1-9F6E0A (c1, k300, u'pi').
1578348403: New connection from 192.168.3.4 on port 1883.
1578348403: New client connected from 192.168.3.4 as pimatic (c1, k180, u'pi').
1578348429: Connecting bridge kappelt-gbridge (mqtt.gbridge.io:8883)
1578348429: Socket error on client local.gbridge-u95-raspberry, disconnecting.
1578348460: Connecting bridge kappelt-gbridge (mqtt.gbridge.io:8883)
pi@raspberrypi:~ $

  • Step 1
  • Step 2
  • ...

**Expected behaviour:Should make a connection to mqtt server.
**Actual behaviour:it keeps failing the connection.

Bonus info. The only change I made today on the system is to install sudo pip install speedtest-cli
And run a couple of speedtest, as far as I know the mqtt connection worked after I installed the speed test.
Can you see anything server side wise?

TLS v1.3 and connection issue

Thanks for gBridge. I have been trying to connect my mosquitto broker to the mqtt broker of gbridge but seem to have 2 issues:

  1. the gbridge profile page at https://gbridge.kappelt.net/profile says that tls v1.3 must be used. But when I set bridge_tls_version tlsv1.3 I have an error message saying that v1.3 is not supported. The error message disappears when I use tlsv1.2. Wrong profile message?

  2. I can ping mqtt.gbridge.kappelt.net but the connection seems to have issues. I get messages such as:

1540078332: Bridge local.odroidule.kappelt-gbridge doing local SUBSCRIBE on topic gBridge/u81/+/+
1540078332: Bridge local.odroidule.kappelt-gbridge doing local SUBSCRIBE on topic gBridge/u81/+/+/set
1540078332: Connecting bridge kappelt-gbridge (mqtt.gbridge.kappelt.net:8883)
1540078332: Bridge odroidule.kappelt-gbridge sending CONNECT
1540078332: Received CONNACK on connection local.odroidule.kappelt-gbridge.
1540078332: Bridge local.odroidule.kappelt-gbridge sending SUBSCRIBE (Mid: 2, Topic: gBridge/u81/+/+, QoS: 0)
1540078332: Bridge local.odroidule.kappelt-gbridge sending SUBSCRIBE (Mid: 3, Topic: gBridge/u81/+/+/set, QoS: 0)
1540078333: Received PUBACK from local.odroidule.kappelt-gbridge (Mid: 1)
1540078333: Received SUBACK from local.odroidule.kappelt-gbridge
1540078333: Socket error on client local.odroidule.kappelt-gbridge, disconnecting.

Any idea ?

Regards

Turn this service into an open-source community project

The project seems to be forgotten and unmaintained. Thus, i suggest turning this project into a open-source project, which will be maintained by a whole community instead of only two persons putting extreme efforts into it. I bet it was a lot of work to get to this point and it should not be a burden you have to carry alone.

The compensation of the costs to keep the servers alive has a lot of room to be discussed.
But please don't let this project die, because it is a hidden gem. By having a whole community maintaining it, it will be up to date and get lots of new functionality, which no one knew they needed.
All commits should run trough a pipeline to achieve a continuous delivery including unit tests to make sure, no one messes up. commits should be reviewed by @peterkappelt to make sure, no one is trying to inject malicious code and make own profits.

But the domain name and product name should not change, to honor the creator of this project.

Sef hosted Setup with Docker - MariaDB on Synology

I was not able to use my existing MariaDB 10.0 DB on synology as the step:
docker-compose exec web php artisan migrate
throw an error:

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email))

This error (and the solution by changing some code) is descibed here:
https://laravel-news.com/laravel-5-4-key-too-long-error

I solved it by using another MariaDB 10.2 Dockerfile as MariaDB 10.2 supports this already. Maybe update the docs in order to have people using 10.2+ or edit the code

br
Mike

Scene does not appear in GH

When I create a new device it will appear in GH after syncing, but when I create an scene it does not appear. This way it is impossible to assign the scene to a room, or to activate it manually. However the scene is available in GH with voice command.

I'm using the hosted gBridge.

Self-Hosted Linking "Invalid Redirect Request"

Everything self hosted running and able to access the gapi and gapi/auth and webserver etc.......but I have difficulty linking.

"The request by Google Home was malformed. Please try again in a few minute. If this problem persists, please contact the team of Kappelt gBridge. Invalid redirect Request!"

The Auth url does in fact have my Client ID correct....this is what the URL looks like where Google Home app takes me to Link...obscured my domain and Client ID

https://domain.com/gbridge/gapi/auth?redirect_uri=https%3A%2F%2Foauth-redirect.googleusercontent.com%2Fr%2Fgbridge-6f7ec&client_id=MY_CLIENT_ID&response_type=token&state=ABdO3MXu5m7eJGAb_WfMPNTMKNYwfMsoNb-rWbNY6-PERfXg20bAf6zqUc0t37ISpw2C-vOR-V4OuN4dZOVF0F_tOXHOQkKcMBYpXfiaPuacfDE_I1oac0tx6lx3s7ZuMXc0d_E6SfRPuUyJke6ZVS_Te6Z5JT6EtPMB9178LNo_TVzVOBCAk1meB0_N6wncQZkKb_abIUnU1al8FOMIGXudce0Vd-cX2nC4mqlwQdazdCDVvn94aT4BEqO9DsOKMXbhVLvfJzJgrNk5jht20MV3172BUk-0i-9fhQh1YG47MQhpkSvcM-dpioEr1IfEYDj0IjXbCUDkwhgyr6nOJWSNwwGnufElFk-t1FK_LHrjHKGLMHwSMnv4p0ixhdXMx7yVj296uXOG9HPgOl0fh2R9YvIwSB7KevmRtTS-rlFB1oPXhsrjr-Q1Dahwl3XweAy3_Fhd6mEcDgSxAvAWLvGAz9lscIMJvNUrYtPC9hqyPyRxCTcQtyFYLexTAhDtGAWcJuNpv7tsU2xEE9SP7SNR4rLbV17CtgLJjbra0RjZsRjXnrQIrFs&user_locale=en-US

Self hosted docker instance redirects to local ip instead of webserver ip

Ive got my self hosted docker instance fully working expect for one thing, and thats a wrong redirect from: https://mydns.gbridge/gapi/auth -> http://192.168.1.10/gapi/auth.

So after logging in when connecting with the Google Home app, it redirects to my local ip auth page which gives an expired message.

I have the default nginx setup (replaced my actual hostname):

server {
listen 80;
listen 443;

    server_name mydns;
    ssl on;
    ssl_certificate /etc/nginx/certs/live/mydsn/fullchain.pem;
    ssl_certificate_key /etc/nginx/certs/live/mydns/privkey.pem;

    ssl_session_timeout 5m;

    ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
    ssl_prefer_server_ciphers on;

    location /gapi/ {
            proxy_pass http://192.168.1.15:8081/gapi/;
    }

}

Do I need some other config in my docker-compose to make sure the redirects also go to my external ip?

Google Account linking fails with 'Invalid ClientID'

I have tried the above fixes to the docker-compose file and ApplicationServiceProvider file and still having issues with the account linking being redirected to /gapi/auth. Is there something else I have missed. I have had a look in the docker-compose logs for errors but everything appears ok, no fatal errors.

To try and get round the proxy issue I used my Sophos firewall WAF function, and stopped apache. I can know add account details as page direct is right but on pressing 'Link Accounts' I get a red error box on the web page saying 'request by Googlehome is malformed .... Invalid ClientID provided'. Checked google console and docker-compose file and clientid entry match. Is this another issue.

Originally posted by @jaseuk73 in #17 (comment)

Bug with Google Home

Hi, I'm having an issue with Google Home app. When I click on the device I'm unable to change the state of my device and it says that's offline. If I click On or Off in the Home (without clicking on the device) it works fine.
Thanks!
photo_2018-10-22_15-20-46

gBridge and Tasmota: Action topic works, status topic does not

Hi Peter,

great work with gBridge, I really do enjoy the experience!

Here's a problem that came up when I integrated my Tasmota-enabled Sonoff S20 power plugs with gBridge. I have a similar setup as the user in #11 and my problem might also have to do with the interpretation of topics between Tasmota and gBridge.

Here's my basis setup:
Tasmota-enabled device <--MQTT-unencrypted--> Mosquitto-Bridge <--MQTT-TLS--> gBridge <---> Google Home

Setup

Here are my configs:

Tasmota

Topic = wallsocket
FullTopic = gBridge/uXX/%prefix%/%topic%/

As mentioned in #11 the prefix can be cmnd or stat and there is also the suffix POWER. Therefore, the resulting topics of my Tasmota are gBridge/uXX/cmnd/wallsocket/POWER and gBridge/uXX/stat/wallsocket/POWER as verified in the log of Tasmota and in the log of the Mosquitto bridge.

Mosquitto

connection kappelt-gbridge
address mqtt.gbridge.kappelt.net:8883
bridge_attempt_unsubscribe true
bridge_protocol_version mqttv31
cleansession true
remote_username gbridge-uXX
remote_password YYY

topic gBridge/uXX/+/+/POWER both 0 "" ""
bridge_capath /etc/ssl/certs/
bridge_tls_version tlsv1.2

Nothing spectacular here. Compared to the section on bridge configuration in the gBridge Docs I only changed the topic to match my topic format.

gBridge

Light with on/off trait
ActionTopic = gBridge/uXX/cmnd/wallsocket/POWER
StatusTopic = gBridge/uXX/stat/wallsocket/POWER

gBridge was configured to match the Tasmota topics. I hope that I interpreted it correctly that cmnd is the action topic and stat is the status topic, see https://github.com/arendst/Sonoff-Tasmota/wiki/MQTT-Overview

Google Home
Has been linked with gBridge and sees the device.

Problem

The setup described above seems to work just fine. Google Home sees the device in gBridge. The bridge also works and successfully connecty the Tasmota to gBridge. I can toggle the light in the Google Home app or via voice commands.

However, Google Home always reports the light as being turned on. I can toggle it off but as soon as i close the Home app and reopen the device it is again shown as switched on. Therefore, I think the issue is with the status topic.

Possible things that could be wrong:

  • I did not define the status topic in gBridge correctly? However, after re-reading https://github.com/arendst/Sonoff-Tasmota/wiki/MQTT-Overview I do think that I got it right.
  • gBridge does not interpret the result of the status topic correctly? The gBridge Docs state that for the onoff trait, the values 0, off, false, as well as 1, on, true are allowed. However, In the logs of my Tasmota it says MQT: gBridge/uXX/stat/wallsocket/POWER = OFF. I know that topics are case senstive. But are results also case-sensitive?
  • Something else entirely since I am kinda new to the the MQTT protocol.

Do you know what could be the issue? Can you suggest ways how I can better debug what went wrong?

Thanks in advance!

Can't get Gbridge to work with Node-Red

@peterkappelt
I am using node-red inside Hassio with ssl encryption & latest version of HA.

gbridge is connected to the server but the debug node is not reporting anything

I tried several ways but no luck

any help will be greatly appreciated
thanks.

Invalid client ID

Hi,
I get this message while trying to link my account with the linking function. Client ID is correct, I checked this 3 times.

An error occured
The request by Google Home was malformed. Please try again in a few minute. If this problem persists, please contact the team of Kappelt gBridge. Invalid Client ID has been provided!

Do you have any idea?
Thanks

Self hosted setup with dockerfiles - Time Error Token

The access tokens generated had a time stamp of 1 hour ago and were therefore not usable and instantly too old as you set the token validity to 1 hour. My guess is that it is some time zone (maybe summer/winter) bug.

I solved it by increasing the time to 2 hours in the according php of the docker app

Other device types?

First of all, thank you very much, I've finally found a Homebridge analogue for Google Home / Google Assistant. I've tried to implement mqtt device provider for my own smart home and it was sooo hard comparing to Apple Homebridge!

Will you add support for other device types, for example, temperature and humidity sensors?

[doku] can you provide an example for Node-Red

I was not able to get a mqtt connection of gbridge with node-red.

To rule out whether this is a local problem, it would be nice if someone could point out an example of a working node-red configuration that you might also be able to include in the documentation.

My (not working) configuration is:
TLS:
image

MQTT 1:
image

MQTT 2:
image

Many Thanks

send update notification to GH

I don't know if this an option in google, but at this moment the status in the GH app is only updated when the device is opened. This status does not change anymore, even when the staus is changed. Is it possible to send an update notification to inform the app that the status is changed?

Unable to link to gBridge using new Google Home App

I did originally manage to link my google account to gBridge, but had to change accounts. Since the original account linking there has been a new version of the Google Home app which has a different interface. These instructions are no longer correct.

To add the gBridge service you now need to navigate:

Main Home Screen -> Add -> Set up Device -> Works with Google -> Search for gBridge

Trying to add the service by putting in my email address and the Access Key looks to authenticate, but then fails with a brief error message "Could not update settings, check connection"

The gBridge app is not linked to the phone and I cannot see any of my devices. I have attempted this a number of times generating a new Access Key for each attempt. still no success.

Allow disabling registration

It would be nice to have a environment variable (or otherwise) to completely disable registrations.
Right now the page is hidden, but still accessible.

Instance Type (hosted/ docker/ other): docker
Steps to reproduce issue:

  • go to /register

Expected behaviour: see a 404 page
Actual behaviour: you can register a new account

Cannot seem to have @ symbol in password

Tried my initial password reset, but it keeps failing when I try to reset the password, I checked the regex from git and it worked fine.
Password example
gBridgePass@20

Responds:
An error occured
The password must be at least 8 characters long and must contain at least one number (0-9), letters, and at least one special char.

Removing the @ for another symbol fixes it.

Server Down?

Is the server down? Openssl gets refused.

openssl s_client -connect mqtt.gbridge.io:8883
connect: Connection refused
connect:errno=111

Self-hosted version tutorial (w/o Docker)

I've managed to get the whole system up and running without Docker, so here's more of an outline on what you need to do. The whole thing works fine on a Raspberry Pi 4, should work on any modern Linux system, all the things used are very basic programs.

Follow the gBridge tutorial up to the 'docker' parts and then follow the steps below. I'll try to do a more detailed tutorial with commands, but this is for people having trouble with the recent server outage. There's two parts you need to get running for this to work: an admin website which handles creating accounts/devices and the oAuth part required by Google, and two nodejs apps that handle the actual bridging of commands from the Homekit API to the MQTT server. The admin app is just a normal PHP website built in Laravel. Here's some basic steps you have to follow:

First you need to setup a basic webserver WITH PHP, MYSQL AND SSL (apache/nginx + mariadb/mysql + letsencrypt's certbot) to serve the Laravel website (in the /web folder) just like any other website. Laravel's public stuff is in the /web/public folder, so you either need to add a .htaccess in the /web root to rewrite everything to /public, or you can setup the directory in your webserver's config (in Apache it's a VirtualHost directive). You also need some sort of domain name, a dynamic DNS if you have a dynamic ip, or just a classic domain if you're on a static IP. You'll also need some PHP extensions installed: php-xml, php-mysql.

(If you already have a webserver with PHP up and running, then you're absolutely gold. Just copy the /web folder and do a redirect. Make sure you have a domain name and SSL certificate.)

All the settings for the Laravel app are in the .env.example file, which you have to rename to .env for it to work. The actual values you can copy from the docker generator mentioned in the gBridge tutorial (the part about docker). You'll have to run your database locally, so the link to it would be 'localhost', same for any other services. You also have to skip the whole Proxy setup in Apache/Nginx that is mentioned in the main tutorial. This will be a run of the mill, basic PHP+MYSQL setup, just like for Wordpress or any other website.

(For this whole webserver part you can google individual tutorials for each piece 'php mysql ssl server setup raspberry pi' for example, or 'apache php install debian', 'certbot install debian' etc. Since it's Laravel, you can also find tutorials on how to install a Laravel app/website on a server, it should be pretty straightforward.)

Next step is to navigate to the root folder of the website in SSH or console (not browser) and run the 'artisan' script using php's commandline tool. The command is php artisan migrate. 'artisan' is part of the Laravel (the framework used to build this admin website). It's a php script that can do various tasks in Laravel, like importing database entries. This will create all the necessary database tables for the website. That might give you errors about various PHP extensions missing on your machine, just install and enable those until it all works (usually it's just apt-get install <extension name>).

You'll know the whole website part is correct when you can access the website on your own server and log in (artisan will ask you for an e-mail, it will create a first account and setup a password for you). Once logged in everything on the web side is exactly like the hosted solution, you can make multiple accounts, add devices for each of them, setup mqtt topics etc.

During device creation you'll get some errors, this is because you're still missing 2 nodejs apps. (these are not required for linking your account, but it's better to just install them too before linking, less errors). These two apps handle the sending and receiving of the actual actions, in essence these do all the hard work magic that makes the system work.

To run these you need to first install nodejs, if you have node-red you already have it (nodered is a nodejs app). You also need Redis, a caching system, install that too. After all this you need to run npm install in each of the 'redis-worker' and 'rs-worker' folders. This will install all the required nodejs libraries for each app. You then need to add the Redis server's IP to each 'config.sample.js' file in these folders and rename them to 'config.js'. To run a node app as a test do node index.js and the app should start, it should output some text and tell you it's connected. You only need the 'redis-worker' to actually control devices, so just run that in the console for testing at first. The rs-worker will handle sending the state of the devices back to google so you see the device state there too, it's not 100% required to just turn stuff on/off etc. You can create systemd services to keep these running in the background on most Linux distros that have systemd (ubuntu, debian, rasbian etc.). Google 'nodejs systemd' and you'll find tutorials, it's just making a text file and running some commands, then you can run them on startup just like any other service (there's also pm2 as a way to turn nodejs apps into services, but that's way more involved, it's a separate app).

If you managed to get all that crap working, it should work just like the hosted solution. Whatever issues you encounter, just google search and hope for the best. It is 100% running with the code here on a Raspberry Pi 4, I've done it today, i can confirm it. All the required pieces should be available as 'apt-get' packages, easy to install on any common linux system.

Confirming linking does not work on self hosted

Awesome work with gBridge!
I have configured gBridge as described in the self-hosted section. I got stuck at account linking. When I navigate to https://my-url/gbridge/gapi/auth and click Confirm linking, I am getting error message: The request by Google Home was malformed. Please try again in a few minute. If this problem persists, please contact the team of Kappelt gBridge. Invalid Client ID has been provided!

How should I complete account linking in self-hosted scenario? Should I trigger account linking somewhere from Google Actions Console?

ColorSetting RGB documentation missing

I have been implementing a device on GBridge, and wanted to read about the RGB colour control, but there doesnt appear to be any documentation for those traits?

Can you check/add/update/point me in the right direction please? the documentation on the other traits is great! Just looks like none of the colorsetting traits are there, JSON, RGB or Temperature?

https://doc.gbridge.io/traits/about.html

gBridge : status topic is not working.

Hi,

I am trying one node red flow with gBridge. the problem is, when i change the light status through node red it's not reflecting in google home.

Here's is my setup
Google Home <---> gBridge <--->Mosquitto(Local) <---> Node-Red

gBridge
Features and MQTT-Topics:
On and Off
gBridge/u--/light1/onoff
gBridge/u--/light1/onoff/set

Node-Red flow
image

I am new to Node red and gBridge, please suggest.

Thanks in advance.

Missing mysql migration steps on synology MariaDB server

Hi Kappelt,

Have done a new installation on my sysnology.
The Scene and Thermostat are not in the database.

xxxx@nas:/volume1/docker/gbridge$ sudo docker-compose exec web php artisan migrate
Password:


  • Application In Production!     *
    

Do you really wish to run this command? (yes/no) [no]:

yes

Migration table created successfully.
Enter your E-Mail address: [email protected]
A new user with the mail "[email protected]" and the password "123456" has been created.
Please change the password immediately!

Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table
Migrating: 2018_05_21_221047_create_device_type_table
Migrated: 2018_05_21_221047_create_device_type_table
Migrating: 2018_05_21_221542_create_trait_type_table
Migrated: 2018_05_21_221542_create_trait_type_table
Migrating: 2018_05_21_221801_create_device_table
Migrated: 2018_05_21_221801_create_device_table
Migrating: 2018_05_21_222234_create_trait_table
Migrated: 2018_05_21_222234_create_trait_table
Migrating: 2018_05_21_222514_create_google_accesskey_table
Migrated: 2018_05_21_222514_create_google_accesskey_table
Migrating: 2018_06_23_124841_seed_device_type_table
Migrated: 2018_06_23_124841_seed_device_type_table
Migrating: 2018_06_23_125533_seed_trait_type_table
Migrated: 2018_06_23_125533_seed_trait_type_table
Migrating: 2018_06_23_130524_create_first_user
Migrated: 2018_06_23_130524_create_first_user
Migrating: 2018_09_22_125215_fix_foreign_ondelete
Migrated: 2018_09_22_125215_fix_foreign_ondelete
Migrating: 2018_09_22_130425_add_user_name_column
Migrated: 2018_09_22_130425_add_user_name_column
Migrating: 2018_09_22_131146_add_user_language_column
Migrated: 2018_09_22_131146_add_user_language_column
Migrating: 2018_09_24_125634_add_mqtt_topic_column
Migrated: 2018_09_24_125634_add_mqtt_topic_column

confirmation email yet

I have not received the confirmation email yet.
It has been 24hr
Does anyone know how long it takes
and yes I looked in my Spam folder

Setup self-hosted gBridge without Docker

Can you provide some example how to setup self-hosted gBridge without Docker?
I have all other prerequisites, like own HTTPS server with Let’s Encrypt certificate.

Support contact emails?

Been sending support emails for months now (paid, hosted account), no ones replying?

project dead?

Connecting MQTT to iobroker (or other smarthome hub)

Working like a charm BUT it would make things much easier if there would be an option to enter a customizable objectID (the ID from the corresponding smarthome hub) per gbroker device.

Currently I have to link each device by its own because no recognized smarthome hub device name is given

br
Mike

responded number of devices wrong when switching all lights in a room

I have 4 devices in the Attic. 2 Of which there are lights with the corresponding icon. When i tell gbridge to turn on all lights, google responds with, ok turning on 6!! devices, but turns on 2 lights only. offcourse, this is the favoured result, but the correct response should be, ok turning on 2 lights.

when switching on all devices, the answer is 8!! and result are 4 devices turned on.

the total amount of devices in gbridge is 8....

edit: after a new push from domoticz, i have a response with more devices currently 8, was 6 before and 4 before that... (only 2 lights still in the attic)

Device mode does not match

Hey all,
Currently, I am using the hosted solution an have found a bug.

The device modes for an Air Conditioner are not as defined on the web page as seen below.

To get the topic to publish correctly, you have to send the command as Cool,Eco
/tempset-mode/set","Eco"
/tempset-mode/set","Cool"

As seen in the image the modes are Cooling, Energy Saving

image

Code not up to date

Instance Type (hosted/ docker/ other): self-hosted (apache, php 7.29)
Steps to reproduce issue:
Create a light device in the admin panel
Expected behaviour:
Lights have the RGB trait selectable
Actual behaviour:
Lights have less features selectable, RGB isn't one of them.

Guessing the code on github is not the latest version that is deployed on your hosted service. Would be nice to get the latest. Thanks

Fan speed setting causes a page error

Hey all,

I am currently using the gbridge service and when going to set the fan speeds, there is an error as seen in the pictures. The error was reported in the docker image but this is also an issue on the hosted webservice.

image

image

Not able to change the topic name on self hosted docker instance

I'm running this awesome bridge on my raspberry pi 3 with Docker.

Had some troubles at first with getting it all up and running but now it works quite well. The only thing which is not working, is changing the topic name of a device.

For example, I created a test light, changed the "d1" into "Dinner_Light" so: gBridge/u1/Dinner_Light/onoff but it still keeps on posting message to the gBridge/u1/d1/onoff topic:

{'Verb': 'PUBLISH', 'Retain': False, 'Topic': 'gBridge/u1/d1/onoff', 'DUP': 0, 'QoS': 0, 'Payload': b'1'}

Another thing I noticed is that the redis client is always subscribing to the default topics:

redis-worker_1_2301abc11820 | Redis client (subscribe) successful subscribe to gbridge:u*:d*:*

Edit: The reason I want to change the name is that I'm developing a plugin for domoticz, and I want the index of the device, or the friendly name of the device in the topic name, so I can easily toggle a device by id/name in the Python plugin.

One thing I should mention is that I wasn't able to change the topic names in the frontend at first, due to possibly an old version of the ARM image, and that I pulled the git repo, and "manually" coupled the /var/www of the image to the newer sources.

volumes:
         - /home/pi/gbridge/gBridge/web:/var/www

Maybe the redis container is also outdated?

Mqtt connection via PubSubClient on ESP12/32 fails

ESP has an arduino library called PubSubClient.h which can be used to connect, publish and subscribe via mqtt.

Documentation of PubSubClient

Problem is, it just won't connect to mqtt.gbridge.io

Steps to reproduce issue:

  • #include <PubSubClient.h>
  • connect using your credentials

Code used in ESP32 to connect:

#include <PubSubClient.h>
#include <WiFi.h>
#include <WiFiClient.h>

#include "./Credentials/Wifi.h"

const char* GBRIDGE_MQTT_SERVER = "mqtt.gbridge.io";
const int GBRIDGE_MQTT_SERVER = 8883;
const char* GBRIDGE_MQTT_USERNAME = "gbridge-uXXXX";
const char* GBRIDGE_MQTT_PASSWORD = "***";  // mqtt-password i set in "my account" page
const char* GBRIDGE_MQTT_CLIENTID = "uXXXX_esp32_randomstring"

WiFiClient wifiClient;
PubSubClient client;

void setup() {
// Serial Setup
Serial.begin(115200);

// Wifi Setup
WiFi.begin(ssid, wifipw);
while (WiFi.status() != WL_CONNECTED) {   // Wait until wifi is connected.
}
Serial.println("Connected to Wifi: Byte");
client.setClient(wifiClient);
client.setServer(GBRIDGE_MQTT_SERVER, GBRIDGE_MQTT_PORT);

// MQTT Setup
client.setCallback(mqttSubscribtionHandler);
while (!client.connected()) {  // wait until connected to mqtt server
  Serial.println("Connecting to MQTT...");
  if (client.connect(GBRIDGE_MQTT_CLIENTID, GBRIDGE_MQTT_USERNAME,
                     GBRIDGE_MQTT_PASSWORD)) {
    Serial.println("connected to gbridge");
  } else {
    Serial.println("failed with state ");
    Serial.println(client.state());
    delay(2000);
  }
}
}

Expected behaviour:
State Code 0 (MQTT_CONNECTED)

Actual behaviour:
State-Code -2 (MQTT_CONNECT_FAILED)

Self-hosted (docker + Windows IIS) authentication problem

Instance Type (hosted/ docker/ other):

Docker

Steps to reproduce issue:

  • I troubleshooted this issue
  • Successfully found my [test] Google Action in Google Home
  • When I selected my Google Action, I was brought to my self-hosted gBridge instance, and authentication was a success (I think?)
  • Was redirected to https://<SITE-URL>/r/<GOOGLE-PROJECT-NAME>#access_token=<REDACTED>&token_type=bearer&state=<etc...>
  • At this point, my web server returned an error "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

Expected behaviour:

Successful authentication, browser closes, and Google Home lets me configure devices

Actual behaviour:
Receives error message: "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

Additional info:
I am using Windows IIS v10.0.18362.1. It is likely to be a configuration error on my part, but I can't figure out where could be the problem.

Thank you for your time!

Unable to set Thermostat tempset

Hi, first of all I really appreciate your work and I'd like to say thanks.
I'm having an issue when I try to set the Temperature and Humidity values with Temperature Setting's trait.
I tried to cast to int and float but it didn't work... The funny part is that if I change the device to Lamp and the trait to Brightness, it works but, if I try with Thermostat and Brightness as trait, it still doesn't work.

Thanks!

gBridge and Tasmota: an internal "babel fish" would be nice

Dear Peter,

I'm trying to control my tasmota (firmware for ESP8266 based wifi switch sold by Sonoff) devices using gBridge but there is a topic issue. Tasmota has some flexibility in choosing the topics that are used to receive commands and send status but for a switch, setting it on requires a topic that ends with a /Power 1 (or On) as in:
gBridge/u2/mysonoff-light/cmnd/Power 1

while the device will send its status with:
gBridge/u2/mysonoff-light/stat/Power 1

(cmnd and stat can be changed to something else but not the fact that "Power" is last).

It would be great if, instead of having to rely on a local babelfish (as http://va.nce.me/Google_Home_light_control_via_mqtt.html), we could have even more control on the topic that gBridge uses and listens too.

Ok for an imposed prefix with gBridge/ which , Ican imagine, is required for rerouting.

But would it be possible to control the suffix for sending commands and for receiving status. One could imagine this could be written as

gBridge/userid/%dev/%cmd

and

gBridge/userid/%dev/%stat

where the strings
%dev = place where the device name will be inserted
%cmd = string for sending a command to the device
%stat = string that the device uses for reporting status

currently
%cmd = onoff
%stat = onoff/stat

but I would be happy to set instead

%cmd = cmnd/Power
%stat = stat/Power

One could even consider that the string for ON/OFF could be customized.

These are just suggestions, of course, the python babelfish of http://va.nce.me/Google_Home_light_control_via_mqtt.html should work but it would be so good to avoid the extra software component :-)

Keep up the good job!

Kind regards
T. Reepleks

Can't set notification topic using mosquitto bridge

Instance type: hosted
User ID: u22

Previously, I've used the following lines in my mosquitto gbridge config:

notifications true
notification_topic bridge/gbridge

Expected behaviour:
Topic bridge/gbridge gets '1' message, when my mosquitto connected to hosted service.
Actual behaviour:
mosquitto gets "Socket error" message and connection fails.

Is this behaviour now due your MQTT server settings?

Connecting mosquitto broker to gBridge: socket error - Do we really need TLS V1.3?

I thought I had my connection from a local mosquitto broker to the hosted gBridge working about a month ago, but coming back to the project now I can't get my mosquitto broker to connect to the hosted gBridge. The mosquitto log shows these errors looping around, repeating the following excerpt:

1539898641: Bridge local.u37 doing local SUBSCRIBE on topic gBridge/u37/d73/onoff/set
1539898641: Bridge local.u37 doing local SUBSCRIBE on topic gBridge/u37/d74/onoff/set
1539898641: Bridge local.u37 doing local SUBSCRIBE on topic gBridge/u37/d75/onoff/set
1539898641: Connecting bridge gbridge (mqtt.gbridge.kappelt.net:8883)
1539898672: Connecting bridge gbridge (mqtt.gbridge.kappelt.net:8883)
1539898672: Bridge u37 sending CONNECT
1539898672: Received CONNACK on connection local.u37.
1539898672: Bridge local.u37 sending SUBSCRIBE (Mid: 85, Topic: gBridge/u37/d73/onoff, QoS: 0)
1539898672: Bridge local.u37 sending UNSUBSCRIBE (Mid: 86, Topic: gBridge/u37/d73/onoff/set)
1539898672: Bridge local.u37 sending SUBSCRIBE (Mid: 87, Topic: gBridge/u37/d74/onoff, QoS: 0)
1539898672: Bridge local.u37 sending UNSUBSCRIBE (Mid: 88, Topic: gBridge/u37/d74/onoff/set)
1539898672: Bridge local.u37 sending SUBSCRIBE (Mid: 89, Topic: gBridge/u37/d75/onoff, QoS: 0)
1539898672: Bridge local.u37 sending UNSUBSCRIBE (Mid: 90, Topic: gBridge/u37/d75/onoff/set)
1539898672: Received SUBACK from local.u37
1539898672: Socket error on client local.u37, disconnecting.

I note that in my account connection details it says that it REQUIRES TLS V1.3, but my mosquitto broker only supports up to TLS V1.2. Do we really REQUIRE TLS V1.3? and if so which version of mosquitto supports this? I am not sure that this is the problem as I seem to establish a connection, get a CONNACK, subscribe to a number of topics, receive a SUBACK and THEN get a socket error.

Any other advice on troubleshooting this would be appreciated.

Repeating messages (Spam from gbridge)

Instance Type : hosted
UserID: u2682

1, Create an outlet device
2, Register a MQTT listener in node_red for said device
3, Connect MQTT to debug
4, "Okay google, turn on DeviceName power"
5, Observe the debug window

18/09/2019, 22:35:24node: e62bf2ac.5a06a gBridge/u2682/dxxxx/onoff : msg.payload : string[14] "{"state":"ON"}" 18/09/2019, 22:35:24node: e62bf2ac.5a06a gBridge/u2682/dxxxx/onoff : msg.payload : string[14] "{"state":"ON"}" 18/09/2019, 22:35:25node: e62bf2ac.5a06a gBridge/u2682/dxxxx/onoff : msg.payload : string[14] "{"state":"ON"}" 18/09/2019, 22:35:25node: e62bf2ac.5a06a gBridge/u2682/dxxxx/onoff : msg.payload : string[14] "{"state":"ON"}" 18/09/2019, 22:35:25node: e62bf2ac.5a06a gBridge/u2682/dxxxx/onoff : msg.payload : string[14] "{"state":"ON"}" 18/09/2019, 22:35:26node: e62bf2ac.5a06a gBridge/u2682/dxxxx/onoff : msg.payload : string[14] "{"state":"ON"}"

Expected Behavior
Receive one payload from gBridge

Actual Behavior
gBridge spams the mqtt server as fast as it can send

mosquito_sub Connection Refused: not authorised.

i just found out about kappelt, but i have no idea what i am doing wrong with my first test device:

i try to subscribe to my topic:
mosquitto_sub --username gbridge-ux --pw xxx --capath /etc/ssl/certs/ --host mqtt.gbridge.io --port 8883 --topic gBridge/u146/x/onoff

but i keep getting
Connection Refused: not authorised.

what am i doing wrong here?

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.