GoogleCloudPlatform / node-red-contrib-google-cloud

Node-RED nodes for Google Cloud Platform
Apache License 2.0
90 stars 57 forks source link

Add Support For Iot Core Config/Command Receive #99

Closed nated0g closed 3 years ago

nated0g commented 3 years ago

Hello!

Thanks for the wonderful collection of nodes.

Maybe there is already a way of accomplishing this that I'm not aware of, but presently it seems there is not a way to receive "Config" or "Command" messages from IOT Core. I attempted to do this with the default MQTT nodes in NodeRED, but as there is no way to configure the credentials dynamically, I can't send the necessary JWT to authenticate the connection (as you obviously know.)

My desired implementation is to have a Pi running Node-Red act as a gateway for local devices. The Pi Node-RED instance will subscribe to configuration objects/device commands from IOT Core on their behalf, translating the configuration and relaying them along over their respective protocols.

Thanks in advance for any insight.

kolban-google commented 3 years ago

Howdy my friend. I think I'm stuck for a solution too. We want to avoid re-building an MQTT client input node when Node-RED has one already. I think we are likely going to want to petition the MQTT node owners of Node-RED to provide some form of algorithmic mechanism to configure the password that Node-RED supplies when it connects so that it can receive incoming messages. Another thought ... can we "poll" IoT Core to periodically ask it for config/command messages that are awaiting delivery?

nated0g commented 3 years ago

I submitted a PR with an added iot core config-in node. I may have messed up the PR, I forked and then developed on Master and submitted PR for dev branch. What is the best practice here? I'm fairly new to contributing to public projects. I suppose I should have developed on the dev branch in my own fork.

nated0g commented 3 years ago

I think that's better

nated0g commented 3 years ago

If you like the direction of this I'd be happy to do some more refactoring to allow a shared MQTT Bridge connection between IoT Core nodes, as mentioned in #101. I'll also add a "Command Receive" node, which will be trivial

kolban-google commented 3 years ago

Changes merged ... welcome to the club!!!