Yeah, and that's exactly what I did for my standalone implementation for a lot of the same reasons. It was just pretty complex to try and force into node-red (I DID do that, see my first implementation, but it was just more easily managed as a real standalone service).
You raise a point though, my MQTT bridge FORCES you to MY MQTT standard... i.e., you have to have separate command and status topics for each device, must pass simple value payloads not complex message protocols (would be too hard to make that generic / configurable), really SHOULD use retain on all status topics to make sure things don't get out of sync on restarts, etc. You COULD still work with this with a layer of MQTT translation / republish node processes, if it really came to it though and still use mine.
Once you start looking at the details of the implementation, it really starts getting complicated enough that... well that I decided to write a real standalone because it just worked better. I think you probably COULD embed it in node-red, but you might end up doing some odd or heavy handed things to expose things like the OAuth, etc.
On thing to note if you look at my implementation, the device config file is really a 1 to 1 copy of Google's device schema for their API. Each of those is the metadata, per device you need to supply (a bit of a lie, there's some optional pieces there...) and thus configure for each distinct device, and then the traits element is representative of the MAPPING you'll also need to configure to get specific commands, for specific devices as node outputs or something like that, as well as supplying state.
If you wanted to implement the device config part, you could probably do something like this:
- A "set state" node that would take in one (or multiple somehow) states and stores it in the modules internal state representation. Configuration for the node would have those metadata pieces you need to define for representation as a "Google Device".
- Obviously, and OAuth server running somehow.
- The behavior of the QUERY intent is pretty static, and could just be exposed at some agreed upon URL. It's job would be to return that internal state to Google's API correctly.
- A COMMAND intent also could be static in behavior I guess. It's only real job is to take a command(s) (there can be multiple on a single request) and route or drop each one to a specific "command received" node.
- A "command received" node that would receive a single command for a single device intent. The output would let someone process that as need to any command process they need.
As I think about it, it's probably doable, and lets someone wire everything up themselves as they desire. Would be pretty flexible. I'm not sure how you would write any of that, but if someone wants to undertake it and wants to ask questions I'd be happy to help translate some of the requirements.
Note: You'd still have to setup all the Google Actions account stuff and deal with the testing mode management, etc. and supply some way to setup the OAuth server implementation.