New Nest-MQTT bridge and full control from SmartThings

I’ve tried nest-manager (https://github.com/tonesto7/nest-manager) but at least for me it was very unreliable and slow so I decided to work on a different solution that works better for me.

I already run the MQTT-SmartThings bridge (https://github.com/stjohnjohnson/smartthings-mqtt-bridge) successfully so I decided to leverage it and do something very similar to bridge Nest and MQTT. You can also use this to control/get information from your nest products, it doesn’t necessarily need SmartThings.

I’ve been testing is and is been working for me. I plan to improve it in the coming days, there’s a couple of bugs and I want to also implement the Protect smoke alarms and a full thermostat (I only have heating). I’m looking for other testers and feedback is anyone finds this useful.

To install it:

  1. You need an mqtt broker, I use Mosca.
  2. You need to install this: https://github.com/stjohnjohnson/smartthings-mqtt-bridge and make sure you can get state from and control devices (light switches are easy to test) make sure this bridge is configured with:
# Preface for the topics $PREFACE/$DEVICE_NAME/$PROPERTY
preface: smartthings
# Suffix for the state topics $PREFACE/$DEVICE_NAME/$PROPERTY/$STATE_SUFFIX
state_read_suffix: state
state_write_suffix: set_state
  1. Clone my repo https://github.com/gandazgul/nest-mqtt-bridge and run yarn && yarn setup (you can use npm if you must)
  2. The setup will guide you through authenticating with Nest and will generate a .env file for the bridge to use. After that run yarn start to start the bridge. You should run this in a sever it can run together with mqtt and the smartthings bridge or you can run it using docker. I can provide a docker-compose file to run them all of you need, I run them on kubernetes.
  3. Install the device handler for the thermostat by using the github integration with my repo from the IDE or manually and create a device with it. Your device name HAS to match the device name from Nest, I can make this configurable later.
  4. You should see output from the bridge indicating that is sending output and/receiving messages. You should see the messages go though on SmartThings bridge as well and the device on SmartThings should be able to control the hvac mode and the heat setpoint as well as match the current temperature.

Looking forward to feedback and answering your questions.

cheers :grinning:

This may be a ‘dumb’ question, but I’m trying to get this working with Home Assistant. Does this require smartthings to work?

I’ve got MQTT setup already on Home Assistant and I know that part works just fine with some MiFlora plant sensors.

I should also mention that I’m trying to get the nest-mqtt bridge setup on a Pi ZeroW.

I was able to get to the setup wizard, and it looks like it blows up when I enter the PIN I received from Nest.

(node:772) UnhandledPromiseRejectionWarning: ReferenceError: URLSearchParams is not defined
    at inquirer.prompt.then (/home/pi/nest-mqtt-bridge-master/src/setup.js:88:46)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)
(node:772) 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(). (rejection id: 1)
(node:772) [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.
Done in 15.45s.

Thanks for any feedback.