# How to change installed contrib node (IOT Core/MQTT)

**URL:** <https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676>\
**Category:** General\
**Created:** [6 March 2019 18:18 UTC](https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676 "2019-03-06T18:18:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serfempo](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@Serfempo](https://discourse.nodered.org/u/Serfempo)\
**Post date:** [6 March 2019 18:18 UTC](https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676/1 "2019-03-06T18:18:26Z")

</div>

I have been using the [node-red-contrib-google-iot-core](https://github.com/cyberflohr/node-red-contrib-google-iot-core) module to publish to Google's IOT Core MQTT broker and it has been working well.

However I want to subscribe to the broker to receive commands on my device from the cloud also. Google have recently added a new 'command' topic which is different to the config topic which the node red module is set up for.

The topic that the node subscribes to is hardcoded into the modules `google-iot-core.js` file. I have attempted to just edit the string to subscribe to the new topic i.e.

from

`/devices/{device_id}/config`

to

`/devices/{device_id}/commands/#`

but when I saved it and restarted NR it threw up errors

```auto
6 Mar 17:09:38 - [info] Waiting for missing types to be registered:
6 Mar 17:09:38 - [info] - google-iot-core-broker
6 Mar 17:09:38 - [info] - google-iot-core out
6 Mar 17:09:38 - [info] - google-iot-core in

```

Am I going about this the correct way? It seems like it should be a pretty quick fix but I'm not experienced with Node.js so I'm not sure if I'm missing a step or if there's a better way to go about it all, for instance cloning in the git repo and making the change and then linking the module locally instead of installing with NPM?

Any advice from experienced users would be greatly appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [6 March 2019 18:21 UTC](https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676/2 "2019-03-06T18:21:06Z")

</div>

First step should be to open an issue on github to flag the change that’s neede with the author of the node.  
It would be better for the node to work properly than you and anyone else editing the code to get it to work

---

<div class="post-metadata">

**Author:** ![Serfempo](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@Serfempo](https://discourse.nodered.org/u/Serfempo)\
**Post date:** [6 March 2019 18:33 UTC](https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676/3 "2019-03-06T18:33:29Z")

</div>

Correct - done. I think a dropdown in the node properties to select between config/command topics would be very useful.

---

<div class="post-metadata">

**Author:** ![Serfempo](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@Serfempo](https://discourse.nodered.org/u/Serfempo)\
**Post date:** [6 March 2019 18:51 UTC](https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676/4 "2019-03-06T18:51:03Z")

</div>

@ukmoose have you any idea why those errors would occur though? I don't see why such a simple change would break the flow

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [6 March 2019 18:58 UTC](https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676/5 "2019-03-06T18:58:48Z")

</div>

When Node-RED starts it will have logged some errors related to the edited node which has prevented it from being loaded. That's where you should start looking to figure out what has happened.

---

<div class="post-metadata">

**Author:** ![Serfempo](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@Serfempo](https://discourse.nodered.org/u/Serfempo)\
**Post date:** [6 March 2019 19:05 UTC](https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676/6 "2019-03-06T19:05:59Z")

</div>

@knolleary where does node red log to other than the output to the console, is there a default logfile somewhere? I checked in /var/log but nothing there

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [6 March 2019 19:07 UTC](https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676/7 "2019-03-06T19:07:04Z")

</div>

It only logs to the console - so it will depend on how you run Node-RED and if you're redirecting its output anywhere. If you're running on a Pi using the install script we provide, then you should have `node-red-log` command available to see the relevant bits of journald log.

---

<div class="post-metadata">

**Author:** ![Serfempo](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@Serfempo](https://discourse.nodered.org/u/Serfempo)\
**Post date:** [6 March 2019 19:16 UTC](https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676/8 "2019-03-06T19:16:51Z")

</div>

Ok, then yeah the only output is what I pasted above as it's not a Pi.

In theory though, editing the js file and restarting shouldn't cause any abnormal behavior should it? I ask because I am new to the Node/javascript set up and I am interested in how these things should be done. If I wanted to test out adding in the functionality for a changing the sub topic I would need to do so locally and submit a pull request perhaps.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [6 March 2019 19:18 UTC](https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676/9 "2019-03-06T19:18:48Z")

</div>

Can you share the full log from when you start Node-RED up to the point you see those errors?

---

<div class="post-metadata">

**Author:** ![Serfempo](https://avatars.discourse-cdn.com/v4/letter/s/278dde/32.png) [@Serfempo](https://discourse.nodered.org/u/Serfempo)\
**Post date:** [6 March 2019 19:44 UTC](https://discourse.nodered.org/t/how-to-change-installed-contrib-node-iot-core-mqtt/8676/10 "2019-03-06T19:44:09Z")

</div>

I actually re-installed the node and tried again and this time it worked. I must have had a typo in the original attempt at it.

Thanks for the help 👍
