Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is someone working on local execution? #128

Closed
Chrischi- opened this issue Apr 4, 2021 · 155 comments
Closed

is someone working on local execution? #128

Chrischi- opened this issue Apr 4, 2021 · 155 comments
Labels
enhancement New feature or request

Comments

@Chrischi-
Copy link
Contributor

local execution in other node-red implementations is super fast and definitely belongs in this project.

is someone working already on local execution?

@Caprico85
Copy link
Collaborator

Not that I know of.

I have never worked with local execution or have seen how other smarthome projects implement it. I only read about it a while ago. So please correct me if I am wrong.

I am not sure if this will really speed things up. From my understanding local executions changes the path from Smart Speaker -> Google -> Developer Cloud -> Device to Smart Speaker -> Google -> Smart Speaker -> Device. This avoids latencies by eleminating the Developer Cloud. But in our case the Developer Cloud already runs on the local network. So you have almost no latency from Dev Cloud to device.

With local execution you also load some piece of JavaScript to your Smart Speaker. Would that JavaScript talk directly to your device? Then you can't use any Node-Red nodes for device communication (i.e. you have to implement the MQTT stuff yourself instead of using Node-Red's MQTT nodes). Or would that JavaScript talk to Node-Red, which handles the device communication. This would bring your "devloper cloud" back into the execution path.

@Caprico85 Caprico85 added the enhancement New feature or request label Apr 6, 2021
@Zarklord
Copy link
Contributor

Zarklord commented Jan 5, 2022

So please correct me if I am wrong.

Yes, that is incorrect.

The current flow is:
Smart Speaker -> Google Servers -> Node Red -> Device
With local execution that becomes:
Smart Speaker -> Node Red -> Device

Would that JavaScript talk directly to your device?

No, it would talk to node red.
The local execution simply allows the smart speaker to determine where the message goes(it still doesn't take any action itself) without going to the cloud, no actual processing is going on with local execution.

Caprico85 added a commit that referenced this issue Jan 20, 2022
Add support for local execution (#128)
@Chrischi-
Copy link
Contributor Author

@Zarklord
WOW!

Big thanks for adding it.

Is there any way to find out that the user did everything correctly?

I only know “chrome://inspect” to see that local-execution was initiated. Are there log entries in node-red that indicate that the device was accessed locally? It is surely interesting after local-execution was “activated”.

@Zarklord
Copy link
Contributor

Zarklord commented Jan 21, 2022

@Chrischi- if you view the node red logs, you'll see log entries using the path /local_smarthome instead of /smarthome.
you can also say "Hey google force local" to force local execution(you can say "Hey google force default" to revert that).

I have found that the behavior is sometimes very weird unless all devices are restarted after uploading the app, and even then sometimes it still takes the 30 minutes...

Generally if I set the app and go do something else when I come back its sorted itself out.

Also, as far as I can tell you can't have more than one test app running with local execution, so if you have local execution via home assistant(or some other app that has the [Test] prefix, this was just my second app) also neither will work...

@Chrischi-
Copy link
Contributor Author

@Zarklord
Thanks for the clarification. Unfortunately, “Hey google force local” does not seem to be usable in languages other than English.

I also see the following messages when checking via Chrome with (chrome://inspect)

local

@Paul-Reed
Copy link
Contributor

It's not working for me either!
@Caprico85 was this tested, and working before merging and publishing?

@Caprico85
Copy link
Collaborator

Caprico85 commented Jan 21, 2022

@Caprico85 was this tested, and working before merging and publishing?

Actually, no 😮. I only tested that normal excecution still works and then merged it. I planned to try local execution this weekend.

@Paul-Reed
Copy link
Contributor

Paul-Reed commented Jan 21, 2022

Well, followed the readme setup, including waiting an hour & restarting node-RED, and now no voice commands work at all, I just get "Sorry the ### is not available right now".
There is nothing in the node-RED log & no errors reported in the Google Logs Explorer.
I can still control smarthome devices by using the 'Home' phone app, but not by voice.
I am now trying to roll back from using Local Execution, to get back working as I need voice control, but before doing so, here's a screenshot of my setup.

not smart

NOTE: if rolling back and you have used the command “Hey google force local”, you may need to use “Hey google force default” to restore smarthome functionality.

@Zarklord
Copy link
Contributor

Zarklord commented Jan 21, 2022

@Paul-Reed are you saying this update broke regular execution?
Even after telling google "force default"?

@Chrischi- that's actually fairly normal, if you expand down the payload sent, you'll see that the mdns data is actually for some other device(my most common service was googlecast), that is in fact what the error message is saying "Not Node Red Google Smarthome type" it means that the mdns data wasn't the node red device running this node.

when node red sends its broadcast, you'll see a successful IDENTIFY request, followed by a successful REACHABLE_DEVICES request, followed by a successful PROXY_SELECTED request.

Edit: can you also verify that your on 0.2.4? When I tried to update it went to 0.2.3 and I had yo manually install 0.2.4 via an npm command...

@Zarklord
Copy link
Contributor

And I see that I failed to copy my latest changes to local-execution/app.js so it was running out of date(and buggy) code, once #240 is merged this should work properly...

@Paul-Reed
Copy link
Contributor

Paul-Reed commented Jan 21, 2022

@Paul-Reed are you saying this update broke regular execution?

When I added Local execution I asked “Hey google force local” and got the answer "ok".
But then, none of my smarthome verbal commands worked (as I've said above).
So I removed the LE settings & rebooted node-RED, and they still did not work ( because I had forced local), so after googling, the command, I said “Hey google force default”, and my SH devices again accepted verbal commands.
So I'm now back where I started!
The update doesn't break regular execution, but forcing local execution does.
Yes I'm on v0.2.4

@Zarklord
Copy link
Contributor

Zarklord commented Jan 21, 2022

Also because the #240 changes are just for the google home app.js, you can use that app.js without waiting for #240 to be merged.
You can find that app here: https://raw.githubusercontent.com/Zarklord/node-red-contrib-google-smarthome/master/local-execution/app.js

@Chrischi-
Copy link
Contributor Author

Chrischi- commented Jan 21, 2022

Also because the #240 changes are just for the google home app.js, you can use that app.js without waiting for #240 to be merged. You can find that app here: https://raw.githubusercontent.com/Zarklord/node-red-contrib-google-smarthome/master/local-execution/app.js

Looks much better now:

@Zarklord
Copy link
Contributor

Zarklord commented Jan 21, 2022

Looks much better now:

Whoops, I accidentally copied the link to mikejac's version of the app, I have updated the link to properly point to my repo...

@Chrischi-
Copy link
Contributor Author

@Zarklord
I had used yours because I had taken the file from the PR.

But after a "force local" I get the message "'my device name' is not reachable". If i set back to default my devices are available again. Same behavior which also @Paul-Reed had described.

@Paul-Reed
Copy link
Contributor

Paul-Reed commented Jan 21, 2022

I've just applied your last PR, again setup Local Execution, and it's still the same, as soon as I 'force local' none of my SH devices are available. (same as @Chrischi- )

@Zarklord
Copy link
Contributor

Zarklord commented Jan 21, 2022

@Zarklord I had used yours because I had taken the file from the PR.

But after a "force local" I get the message "'my device name' is not reachable". If i set back to default my devices are available again. Same behavior which also @Paul-Reed had described.

can you verify that your getting successful IDENTIFY and REACHABLE_DEVICES intents? if you aren't try restarting both node red and the google smart home device that your using chrome://inspect on? sometimes they don't show up right away for some reason...

@Chrischi-
Copy link
Contributor Author

Chrischi- commented Jan 21, 2022

@Zarklord

This is what i get:
app

Maybe you could add some debug messages?

@Zarklord
Copy link
Contributor

Maybe you could add some debug messages?

There are debug messages for every single intent...
I'm wondering if something is going wrong on node red's side, can you upload a filtered version(IE. without any private data) of the node red log I'll look and see if I can find anything odd with that.

@Chrischi-
Copy link
Contributor Author

Chrischi- commented Jan 21, 2022

@Zarklord
i don't get any request at all in node-red

but I see the following error:
error

Shouldn't the requests come via HTTPS?

Requests via HTTP do not work locally in the browser either.
e.g.: http://hostname:3001/local_smarthome does not work, but https works.
Maybe this is the problem!?

@Zarklord
Copy link
Contributor

Zarklord commented Jan 21, 2022

Couple questions
Do you use ssl offload?
Can you confirm your on 0.2.4?
Can you confirm the app running on the google smart device's line 64 is:
command.path = `${nodeRedData.httpPathPrefix}local_smarthome`;?

@Chrischi-
Copy link
Contributor Author

@Zarklord

Do you use ssl offload?
no
ssl

Can you confirm your on 0.2.4?
version

Can you confirm the app running on the google smart device's line 64 is:?
command.path = ${nodeRedData.httpPathPrefix}local_smarthome
line64

Thanks for your effort and help

@Zarklord
Copy link
Contributor

Zarklord commented Jan 21, 2022

Okay, so if you use don't use ssl offload, there is an issue where it can't connect, since its trying to connect at https://hostname.local:port/ which you likely lack an ssl certificate for, I'm gonna work on a patch that will use http for local execution regardless of ssl's state

@Chrischi-
Copy link
Contributor Author

weird

Actually I use ssl but only have a certificate for my external hostname.

Could it be that you mean the opposite?

With SSL offload enabled, http is used instead of https.

Use external SSL offload: If enabled, the smarthome service will use HTTP instead of HTTPS. Check if you want to do SSL termination on a reverse proxy.

@Zarklord
Copy link
Contributor

weird

Actually I use ssl but only have a certificate for my external hostname.

Yeah, that's what I expected.

Could it be that you mean the opposite?

With SSL offload enabled, http is used instead of https.

Use external SSL offload: If enabled, the smarthome service will use HTTP instead of HTTPS. Check if you want to do SSL termination on a reverse proxy.

No, with ssl offload as false(or off) it will attempt to connect over https, but because its uses mdns its trying to connect over https://hostname.local:port/ which as you said you only have an ssl certificate for your external hostname, so ssl verification fails, and it gets no response from this node.
With ssl offload as true(which is what I have it set to, I have a reverse proxy so I don't have this node handle ssl), it tries to connect over http://hostname.local:port/ which obviously doesn't need an ssl certificate, and succeeds.

@Zarklord
Copy link
Contributor

Zarklord commented Jan 21, 2022

@Chrischi-
I have updated my branch with I believe the fix for ssl offload.
you can test my branch by running npm install git://github.com/Zarklord/node-red-contrib-google-smarthome.git in the .node-red directory and restarting node red.
you will also need to update the app.js.
and restart all your google home devices/wait 30 minutes.

please let me know if this resolves your issue.

@Paul-Reed
Copy link
Contributor

Paul-Reed commented Jan 22, 2022

please let me know if this resolves your issue.

Still not working here using your fix for ssl offload, (I've also updated app.js).
I can force local, but then all of my SH devices are not available.
No debug messages in node-RED.

@Chrischi-
Copy link
Contributor Author

same here

ssl_fix

and no debug messages in node-red log

@ckhmer1
Copy link
Contributor

ckhmer1 commented Feb 15, 2022

Hi,
I have the following logs:

SmartHome:Start(): use the Node-RED server port, path /google SmartHome:Start(): dnssd-Ad: port:1880 SmartHome:Start(): url /google/oauth registered for get SmartHome:Start(): url /google/oauth registered for post SmartHome:Start(): url /google/token registered for all SmartHome:Start(): url /google/smarthome registered for post SmartHome:Start(): url /google/check registered for get SmartHome:Start(): url /google/smarthome registered for options SmartHome:Start(): url /google/local_smarthome registered for post SmartHome:Start(): url /google/local_smarthome registered for options

After restarting the Google Home, I get the following logs:

local_smarthome: request.headers = {"host":"192.168.178.3:1880","connection":"keep-alive","content-length":"5939","content-type":"application/json","user-agent":"Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/SmartSpeaker","accept-encoding":"gzip, deflate","accept-language":"it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7"} HttpActions:httpActionsRegister(/local_smarthome): request.headers = {"host":"192.168.178.3:1880","connection":"keep-alive","content-length":"5939","content-type":"application/json","user-agent":"Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/SmartSpeaker","accept-encoding":"gzip, deflate","accept-language":"it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7"} HttpActions:httpActionsRegister(/local_smarthome): reqdata = {"requestId":"57F265940D840D3EE7EC2A2A97FEFE98","inputs":[{"intent":"action.devices.IDENTIFY","payload":{"device":{"mdnsScanData":{"serviceName":"smart-home._nodered-google._tcp.local","name":"smart-home","type":"nodered-google","protocol":"tcp","data":["clientId=1884daf7.785005"],"txt":{"clientId":"1884daf7.785005"}}},"structureData":{}}}],"devices":[{"id":"c41adf2ee1e26764","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"79b4b5610004be18","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"24f4152351874ac2","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"4d400faf.ef0ac","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"d328e875a0c25264","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"9049e56beb8bcd18","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"fa36407e2b2fac0e","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"6a4f4b500a4cf517","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"6c29672b27579398","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"fc722b51e8799af0","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5c24f2e37badf68a","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"2ca0da14d6d21481","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"ccf83bb5281a401f","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"11d7cf63dd59537d","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5f4494b0ef1486d1","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"052ba584cfe0e3e7","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"35fb1a94143b736b","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"f6bbe59e03f405b4","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"6ecf662b9399105a","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"4fdbca08698ec35c","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"6d3e32f76159dc55","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"e00ab4c02376e8e0","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"749aefeb402f098f","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"b0b5941bd75005e6","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"d40eeaf4ec32749d","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"8477dfe7ac95f34a","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"a1cb9277ce42df81","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5a51c29c01a10c90","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"3240c7d20630874d","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"cc31393a080c7336","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"341681aeb704fc26","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"d07b4f73d90bd269","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5c0f9c865a86f6dc","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5e641b835a4b9052","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"75b80b2157fb0233","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"ea4d1c0f9912787f","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"f3068ed94c71af57","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"e741cab74d5e2bfc","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"1719ccf51e727f7a","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"b5b92342afdc3d66","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"60c1462fa53fb774","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5a6cab8627dfe016","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"698ab1e4b6349699","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"7e71a51bcb0d75d9","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"6594684f3ef60744","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5ef650ac0884d82e","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"fc69f07735bf82a4","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"be72e6bee4d61b68","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"7386f55b780ee214","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}}]} HttpActions:httpActionsRegister(/local_smarthome): IDENTIFY local_smarthome: request.headers = {"host":"192.168.178.3:1880","connection":"keep-alive","content-length":"6036","content-type":"application/json","user-agent":"Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/SmartSpeaker","accept-encoding":"gzip, deflate","accept-language":"it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7"} HttpActions:httpActionsRegister(/local_smarthome): request.headers = {"host":"192.168.178.3:1880","connection":"keep-alive","content-length":"6036","content-type":"application/json","user-agent":"Mozilla/5.0 (X11; Linux armv7l) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.225 Safari/537.36 CrKey/1.56.500000 DeviceType/SmartSpeaker","accept-encoding":"gzip, deflate","accept-language":"it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7"} HttpActions:httpActionsRegister(/local_smarthome): reqdata = {"requestId":"E5CE227FBC4D6AA9BE6B9B31642B5537","inputs":[{"intent":"action.devices.REACHABLE_DEVICES","payload":{"device":{"id":"1884daf7.785005","customData":{},"proxyData":{}},"structureData":{}}}],"devices":[{"id":"c41adf2ee1e26764","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"79b4b5610004be18","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"24f4152351874ac2","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"4d400faf.ef0ac","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"d328e875a0c25264","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"9049e56beb8bcd18","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"fa36407e2b2fac0e","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"6a4f4b500a4cf517","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"6c29672b27579398","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"fc722b51e8799af0","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5c24f2e37badf68a","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"2ca0da14d6d21481","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"ccf83bb5281a401f","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"11d7cf63dd59537d","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5f4494b0ef1486d1","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"052ba584cfe0e3e7","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"35fb1a94143b736b","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"1884daf7.785005","customData":{},"radioType":"WIFI","scanData":{"mdnsScanData":{"serviceName":"smart-home._nodered-google._tcp.local","texts":["clientId=1884daf7.785005"],"serviceInstance":"smart-home._nodered-google._tcp.local"}}},{"id":"f6bbe59e03f405b4","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"6ecf662b9399105a","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"4fdbca08698ec35c","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"6d3e32f76159dc55","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"e00ab4c02376e8e0","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"749aefeb402f098f","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"b0b5941bd75005e6","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"d40eeaf4ec32749d","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"8477dfe7ac95f34a","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"a1cb9277ce42df81","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5a51c29c01a10c90","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"3240c7d20630874d","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"cc31393a080c7336","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"341681aeb704fc26","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"d07b4f73d90bd269","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5c0f9c865a86f6dc","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5e641b835a4b9052","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"75b80b2157fb0233","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"ea4d1c0f9912787f","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"f3068ed94c71af57","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"e741cab74d5e2bfc","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"1719ccf51e727f7a","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"b5b92342afdc3d66","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"60c1462fa53fb774","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5a6cab8627dfe016","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"698ab1e4b6349699","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"7e71a51bcb0d75d9","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"6594684f3ef60744","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"5ef650ac0884d82e","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"fc69f07735bf82a4","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"be72e6bee4d61b68","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}},{"id":"7386f55b780ee214","customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880}}]} HttpActions:httpActionsRegister(/local_smarthome): REACHABLE_DEVICES HttpActions:_reachable_devices() HttpActions:_reachable_devices(): reachableDevices = {"requestId":"E5CE227FBC4D6AA9BE6B9B31642B5537","payload":{"devices":[{"verificationId":"d40eeaf4ec32749d"},{"verificationId":"fa36407e2b2fac0e"},{"verificationId":"5a6cab8627dfe016"},{"verificationId":"be72e6bee4d61b68"},{"verificationId":"5c0f9c865a86f6dc"},{"verificationId":"d328e875a0c25264"},{"verificationId":"24f4152351874ac2"},{"verificationId":"1719ccf51e727f7a"},{"verificationId":"5ef650ac0884d82e"},{"verificationId":"b5b92342afdc3d66"},{"verificationId":"4fdbca08698ec35c"},{"verificationId":"f6bbe59e03f405b4"},{"verificationId":"79b4b5610004be18"},{"verificationId":"9049e56beb8bcd18"},{"verificationId":"c41adf2ee1e26764"},{"verificationId":"6c29672b27579398"},{"verificationId":"f3068ed94c71af57"},{"verificationId":"75b80b2157fb0233"},{"verificationId":"7386f55b780ee214"},{"verificationId":"5c24f2e37badf68a"},{"verificationId":"6d3e32f76159dc55"},{"verificationId":"5f4494b0ef1486d1"},{"verificationId":"6ecf662b9399105a"},{"verificationId":"749aefeb402f098f"},{"verificationId":"fc69f07735bf82a4"},{"verificationId":"ccf83bb5281a401f"},{"verificationId":"a1cb9277ce42df81"},{"verificationId":"5e641b835a4b9052"},{"verificationId":"cc31393a080c7336"},{"verificationId":"6594684f3ef60744"},{"verificationId":"8477dfe7ac95f34a"},{"verificationId":"ea4d1c0f9912787f"},{"verificationId":"11d7cf63dd59537d"},{"verificationId":"3240c7d20630874d"},{"verificationId":"341681aeb704fc26"},{"verificationId":"6a4f4b500a4cf517"},{"verificationId":"e00ab4c02376e8e0"},{"verificationId":"35fb1a94143b736b"},{"verificationId":"60c1462fa53fb774"},{"verificationId":"052ba584cfe0e3e7"},{"verificationId":"e741cab74d5e2bfc"},{"verificationId":"698ab1e4b6349699"},{"verificationId":"d07b4f73d90bd269"},{"verificationId":"2ca0da14d6d21481"},{"verificationId":"7e71a51bcb0d75d9"},{"verificationId":"b0b5941bd75005e6"},{"verificationId":"5a51c29c01a10c90"},{"verificationId":"fc722b51e8799af0"},{"verificationId":"4d400faf.ef0ac"}]}}

When I ask Google to switch on the light, I get the following logs:

HttpActions:httpActionsRegister(/smarthome): request.headers = {"host":"***********.com","x-forwarded-for":"***************","connection":"upgrade","content-length":"372","content-type":"application/json;charset=UTF-8","google-assistant-api-version":"v1","authorization":"Bearer *****************","user-agent":"Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)","accept-encoding":"gzip, deflate, br"} HttpActions:httpActionsRegister(/smarthome): reqdata = {"inputs":[{"context":{"locale_country":"IT","locale_language":"it"},"intent":"action.devices.EXECUTE","payload":{"commands":[{"devices":[{"customData":{"clientId":"1884daf7.785005","httpPathPrefix":"/google/","httpPort":1880},"id":"6d3e32f76159dc55"}],"execution":[{"command":"action.devices.commands.OnOff","params":{"on":true}}]}]}}],"requestId":"13494537816463525063"} HttpActions:httpActionsRegister(/smarthome): user: ****************@gmail.com HttpActions:httpActionsRegister(/smarthome): EXECUTE HttpActions:_exec() HttpActions:_execDevice(): command = {"command":"action.devices.commands.OnOff","params":{"on":true}} Device:execCommand(): device = {"id":"6d3e32f76159dc55","states":{},"command":"action.devices.commands.OnOff"} google-smarthome:DeviceNode[Luce Camera di Nonna] .execCommand: command {"command":"action.devices.commands.OnOff","params":{"on":true}} google-smarthome:DeviceNode[Luce Camera di Nonna] .execCommand: states {"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true} Device:execCommand(): result = {"params":{"on":true},"executionStates":["online","on"]} Device:execDevice(): this._devices[device.id] = {"states":{"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true},"properties":{"type":"action.devices.types.LIGHT","traits":["action.devices.traits.Brightness","action.devices.traits.ColorSetting","action.devices.traits.LightEffects","action.devices.traits.OnOff"],"name":{"defaultNames":["Node-RED Light"],"name":"Luce Camera di Nonna"},"roomHint":"Camera di Nonna","willReportState":true,"notificationSupportedByAgent":false,"attributes":{"commandOnlyBrightness":false,"commandOnlyColorSetting":false,"colorModel":"rgb","colorTemperatureRange":{"temperatureMinK":2000,"temperatureMaxK":9000},"defaultSleepDuration":1800,"defaultWakeDuration":1800,"supportedEffects":["colorLoop","sleep","wake"],"commandOnlyOnOff":false,"queryOnlyOnOff":false},"deviceInfo":{"manufacturer":"Node-RED","model":"nr-device-light-v1","swVersion":"1.0","hwVersion":"1.0"},"otherDeviceIds":[{"deviceId":"6d3e32f76159dc55"}],"customData":{"httpPort":1880,"httpPathPrefix":"/google/","clientId":"1884daf7.785005"},"id":"6d3e32f76159dc55"},"executionStates":[],"command":"action.devices.commands.OnOff"} google-smarthome:DeviceNode[Luce Camera di Nonna] .updated: device.command = "OnOff" google-smarthome:DeviceNode[Luce Camera di Nonna] .updated: device.states = {"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true} google-smarthome:DeviceNode[Luce Camera di Nonna] .updated: params = {"on":true} google-smarthome:DeviceNode[Luce Camera di Nonna] .updated: original_params = {"on":true} google-smarthome:DeviceNode[Luce Camera di Nonna] CCHI updateState state_types {"online":129,"brightness":{"type":2,"min":0,"max":100},"color":{"type":544,"attributes":{"spectrumRgb":{"type":130,"exclusiveStates":["temperatureK","spectrumHsv"]},"temperatureK":{"type":130,"min":2000,"max":9000,"exclusiveStates":["spectrumRgb","spectrumHsv"]}}},"activeLightEffect":{"type":136,"values":["","colorLoop","sleep","wake"]},"lightEffectEndUnixTimestampSec":2,"on":1} google-smarthome:DeviceNode[Luce Camera di Nonna] updateState current state {"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true} google-smarthome:DeviceNode[Luce Camera di Nonna] .updateState: new State [] = {"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true} modifyUpdateMessage Basisklasse: {"device_name":"Luce Camera di Nonna","command":"OnOff","params":{"on":true},"payload":{"online":true,"brightness":1,"color":{"temperatureK":9000},"activeLightEffect":"","on":true},"topic":"luce/camera nonna/1/set"} Device:getStatus(): deviceIds = ["6d3e32f76159dc55"] Device:getStatus(): devices = {"6d3e32f76159dc55":{"states":{"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true},"properties":{"type":"action.devices.types.LIGHT","traits":["action.devices.traits.Brightness","action.devices.traits.ColorSetting","action.devices.traits.LightEffects","action.devices.traits.OnOff"],"name":{"defaultNames":["Node-RED Light"],"name":"Luce Camera di Nonna"},"roomHint":"Camera di Nonna","willReportState":true,"notificationSupportedByAgent":false,"attributes":{"commandOnlyBrightness":false,"commandOnlyColorSetting":false,"colorModel":"rgb","colorTemperatureRange":{"temperatureMinK":2000,"temperatureMaxK":9000},"defaultSleepDuration":1800,"defaultWakeDuration":1800,"supportedEffects":["colorLoop","sleep","wake"],"commandOnlyOnOff":false,"queryOnlyOnOff":false},"deviceInfo":{"manufacturer":"Node-RED","model":"nr-device-light-v1","swVersion":"1.0","hwVersion":"1.0"},"otherDeviceIds":[{"deviceId":"6d3e32f76159dc55"}],"customData":{"httpPort":1880,"httpPathPrefix":"/google/","clientId":"1884daf7.785005"},"id":"6d3e32f76159dc55"},"executionStates":[],"command":"action.devices.commands.OnOff"}} HttpActions:_execDevice(): execDevice = {"6d3e32f76159dc55":{"states":{"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true},"properties":{"type":"action.devices.types.LIGHT","traits":["action.devices.traits.Brightness","action.devices.traits.ColorSetting","action.devices.traits.LightEffects","action.devices.traits.OnOff"],"name":{"defaultNames":["Node-RED Light"],"name":"Luce Camera di Nonna"},"roomHint":"Camera di Nonna","willReportState":true,"notificationSupportedByAgent":false,"attributes":{"commandOnlyBrightness":false,"commandOnlyColorSetting":false,"colorModel":"rgb","colorTemperatureRange":{"temperatureMinK":2000,"temperatureMaxK":9000},"defaultSleepDuration":1800,"defaultWakeDuration":1800,"supportedEffects":["colorLoop","sleep","wake"],"commandOnlyOnOff":false,"queryOnlyOnOff":false},"deviceInfo":{"manufacturer":"Node-RED","model":"nr-device-light-v1","swVersion":"1.0","hwVersion":"1.0"},"otherDeviceIds":[{"deviceId":"6d3e32f76159dc55"}],"customData":{"httpPort":1880,"httpPathPrefix":"/google/","clientId":"1884daf7.785005"},"id":"6d3e32f76159dc55"},"executionStates":[],"command":"action.devices.commands.OnOff"}} HttpActions:_exec(): executionResponse = {"status":"SUCCESS","states":{"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true},"executionStates":["online","on"]} HttpActions:_exec(): resBody = {"requestId":"13494537816463525063","payload":{"commands":[{"ids":["6d3e32f76159dc55"],"status":"SUCCESS","states":{"online":true,"on":true}}]}} Device:getStates(): deviceIds = ["6d3e32f76159dc55"] Device:getStates(with-deviceIds): deviceId = "6d3e32f76159dc55" Device:getStates(with-deviceIds): states[deviceId] = {"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true} HttpActions:reportState(): deviceId = 6d3e32f76159dc55 HttpActions:reportState(): states = {"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true} HttpActions:reportState(): postData = {"requestId":"6klkillORHzDfhrGsBjWrW","agentUserId":"0","payload":{"devices":{"states":{"6d3e32f76159dc55":{"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true}}}}} google-smarthome:DeviceNode[Luce Camera di Nonna] .input: topic = luce/camera nonna/1/set google-smarthome:DeviceNode[Luce Camera di Nonna] .input: some other topic google-smarthome:DeviceNode[Luce Camera di Nonna] CCHI updateState state_types {"online":129,"brightness":{"type":2,"min":0,"max":100},"color":{"type":544,"attributes":{"spectrumRgb":{"type":130,"exclusiveStates":["temperatureK","spectrumHsv"]},"temperatureK":{"type":130,"min":2000,"max":9000,"exclusiveStates":["spectrumRgb","spectrumHsv"]}}},"activeLightEffect":{"type":136,"values":["","colorLoop","sleep","wake"]},"lightEffectEndUnixTimestampSec":2,"on":1} google-smarthome:DeviceNode[Luce Camera di Nonna] updateState current state {"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true} google-smarthome:DeviceNode[Luce Camera di Nonna] .updateState: new State [] = {"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true} GoogleSmartHomeNode:setState(): state = {"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true} Devices:SetState(): state = {"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true} HttpActions:reportState(): deviceId = 6d3e32f76159dc55 HttpActions:reportState(): states = {"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true} HttpActions:reportState(): postData = {"requestId":"4Jr61FJXoSe3cts1SlquwB","agentUserId":"0","payload":{"devices":{"states":{"6d3e32f76159dc55":{"online":true,"color":{"temperatureK":9000},"activeLightEffect":"","brightness":1,"on":true}}}}} HttpActions:reportState(): success HttpActions:reportState(): success

No Local execution :(

My node-red is on a docker image with macvlan, so it has its own IP address.

In the Chrome chrome://inspect/#devices I see:

image

@FireWizard52
Copy link
Contributor

Hello @ckhmer1

This afternoon I tested again.

Node-RED version 2.2.1
Google Smarthome version 0.2.10

I started with uploading the app.js file of 0.2.10 to Google Actions. This has been copied from /home/pi/.node-red/node_modules/node-red-contrib-google-smarthome/local-execution. The link in the documentation does not function,

After a reboot of Node-RED I see the same in the log, as you do (See my post 5 days ago)
It looks promising, but after a reboot of my Google Nest Hub, I got a lot of log information, but was unable to see if it also contained "local_smarthome".

Switching a light gave no indication of "local_smarthome", but I saw some pointers to the local fulfillment port (18080)
Local Execution does not work.

A first thought was, that I had been caught by the NAT Loopback (hairpinning) trap as mentioned in #241. However I did solve that issue by adding the domain in the local (caching) DNS server.

Currently I ran out of ideas. I don't know of any other place to verify things.

Regards

@Paul-Reed
Copy link
Contributor

The link in the documentation does not function

Should be fixed with #261

Out of interest... last night my pi was shut down for an hour (rewiring & relocation). Upon restarting it, I had no mention of 'local_execution' in my logs, despite also restarting my devices, and not for the remainder of the evening.
First thing this morning, I again checked my logs, and LE was back working again, and has worked consistently all day since!!
It seems that the google servers don't like change....

@Caprico85
Copy link
Collaborator

Made some changes:

The app.js now declares its version at the beginning of the file (see https://github.com/mikejac/node-red-contrib-google-smarthome/blob/master/local-execution/app.js#L3). Version number is also shown in the chrome://inspect console. This should make it easier for users to see if they have an outdated version.
I have increased the version number of the app.js to 2.0. There were several different 1.0, now we have one "clean" version 2.0. There are no changes except the version declaration, so you don't necessarily need to update if local fulfillment works for you.

I also added a section on [Troubleshooting local fulfillment](https://github.com/mikejac/node-red-contrib-google-smarthome#troubleshooting-local-fulfillment to the Readme. These are some of the steps I tried while getting local execution to work here. Not sure if it helps in your case, but you might still want to try.

@Caprico85
Copy link
Collaborator

@ckhmer1 That's interesting. In your chrome://inspect logs you have all the expected messages. Mine looks the same. That means the local fulfillment path should have been established correctly. Yet Google still sends only normal, no local requests. Did you try "Hey Google, force local"? Remember to switch back to "Hey Google, force default" after testing.

@FireWizard52
Copy link
Contributor

FireWizard52 commented Feb 17, 2022

hello @Caprico85,

Thank you very much for adding the section "Troubleshooting local fulfillment".

As my "local fulfillment" is still not working this step-by-step guide was very welcome.

Step 1: I postponed this step to later and decided to test other things first.

Step 2: Set a port for local fulfillment in the management node's config. I did already and selected port 18080.

Step 3: Ran curl -X POST http://:18080/local_smarthome
Indeed this results in {"error":"missing inputs"} So this is correct.

Step 4: I Installed app mDNS Discovery] on my phone and let it search for "nodered-google"

This step failed:

Screenshot_mDNS_Discovery

What attracted my intention was that the Service Type is _nodered-google._tcp

I had expected _nodered-google._tcp.local as configured in the Google Action page.

Screenshot_Local_Fulfillment

Is my assumption correct and that this might be the cause?

[Edit] No I think not, because according to Wikipedia:

By default, mDNS exclusively resolves hostnames ending with the [.local](https://en.wikipedia.org/wiki/.local) top-level domain. This can cause problems if .local includes hosts that do not implement mDNS but that can be found via a conventional unicast DNS server. Resolving such conflicts requires network-configuration changes that mDNS was designed to avoid.

Could there be a conflict between mDNS and the local DNS server on my LAN?

If so, how to solve this?

@Caprico85
Copy link
Collaborator

Im rather new to the topic mDNS myself. So please don't take my answers too serious.

I had expected _nodered-google._tcp.local as configured in the Google Action page.

Same as me. I tried several variants of the hostname. The full name, without "local", without "_tcp", without the underscores. "nodered-google" was the only thing that worked. mDNS Discovery seems to append the underscores and domains itself.

You can also try other mDNS apps. Just search for mDNS in the Play Store. Service Browser finds my device too. Others like Bonjour Browser or Local Finder don't find anything (not even the smart speaker which also responds to mDNS).

Could there be a conflict between mDNS and the local DNS server on my LAN?

Do you have a DNS server on your network? I only have the DNS server on my home router (AVM FritzBox). This doesn't cause any problems. To be honest I don't think other DNS servers will cause problems. mDNS is a (more or less) well known standard. DNS servers should take this into account. But I don't know if tools like Pi-Hole have features to block out "unwanted" (m)DNS traffic

One thing to note is mDNS is not routable. It can not cross network boundaries. How is your network built? Is this a simple network with only one subnet? Different subnets? Do you use some kind of isolation or virtualization like VMware or Docker? Do you have a firewall which may block mDNS?

@FireWizard52
Copy link
Contributor

FireWizard52 commented Feb 19, 2022

Hello @Caprico85

Sorry or the somewhat late response, but I did use my time with reading and reading about .... mDNS.
And I have learned a lot and think I understand the issue..

But let me answer your questions first.

Same as me. I tried several variants of the hostname. The full name, without "local", without "_tcp", without the underscores. "nodered-google" was the only thing that worked. mDNS Discovery seems to append the underscores and domains itself.

  1. "local" is required, as the domain name .local is a special-use domain name (SUDN) and reserved. It will never be in conflict with other TLD domain names. "_tcp" is also required. It indicates the protocol. You will also see that in the mDNS discovery app.
    Indeed mDNS appends the underscores.

  2. Another name than "nodered-google" will also work, but with "_tcp" and "local".

  3. You can also try other mDNS apps.

No need for it. This app discovers other m(ulticast)DNS service perfect. So it is not related to this app.

  1. Do you have a DNS server on your network?
    Yes, I have, like you, and according what I found, they can excellent live together. So there are no conflicts.

  2. But I don't know if tools like Pi-Hole have features to block out "unwanted" (m)DNS traffic
    I do not use Pi-Hole, but what I found it should not have any effect.

  3. One thing to note is mDNS is not routable. It can not cross network boundaries.
    Yes, it can with special configuration.

  4. Is this a simple network with only one subnet? Different subnets?
    It has only one subnet (192.168.10.0/24)

  5. Do you use some kind of isolation or virtualization like VMware or Docker? Do you have a firewall which may block mDNS?
    None of these and no firewall blocking

But I think the issue is somewhere else, but I like to hear other opinions.

This is what I did so far.

  1. On my Raspberry Pi, which has Node-RED (and the Google Smarthome node), Mosquitto, Domoticz and several scripts installed, I checked, if the avahi-daemon.service was running.

sudo systemctl status avahi-daemon.service

which gave as result:

● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
   Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2022-02-18 15:29:48 CET; 23h ago
 Main PID: 277 (avahi-daemon)
   Status: "avahi-daemon 0.7 starting up."
    Tasks: 2 (limit: 877)
   CGroup: /system.slice/avahi-daemon.service
           ├─277 avahi-daemon: running [RPi1.local]
           └─345 avahi-daemon: chroot helper

You see here already something interesting between [ ] RP11.local.

RPi1 is in my case the hostname of my Raspberry Pi.

  1. Next step was to install avahi-utils
sudo apt-get install avahi-utils 

This gives a utility avahi-browse.

If you run

avahi-browse -a 

you will get a long list of devices and among them:

+   eth0 IPv4 RPi1                                                              example.com._nodered-google._tcp.local

"example.com" is the domain name I use. (example)

This is different than other services, discovered by the app.

The Question:

How is this service "nodered-google" added . Where does it comes from?

I tried to change the hostname and the /etc/host file of the Raspberry Pi, but this has as side effect, that I loose all my flows, because the localhost.localdomain name is included in the name of the flow file (default) of NR.
So I reversed that.

I think it will work, if the Raspberry Pi, has no hostname defined, but that is not what I have.

Any suggestions, ideas, solutions?

@Paul-Reed
Copy link
Contributor

I don't know if it helps you, but on my (working local Exec) Pi, I get;

   CGroup: /system.slice/avahi-daemon.service
           ├─410 avahi-daemon: running [raspberrypi-2.local]
           └─440 avahi-daemon: chroot helper

My pi's hostname is raspberrypi

@rockstar2020
Copy link

I also get:
CGroup: /system.slice/avahi-daemon.service
├─20379 avahi-daemon: running [raspberrypi.local]
└─20380 avahi-daemon: chroot helper

The mDNS discovery in my network works perfectly but still I'm not able to execute any local fulfilment commands.

@rockstar2020
Copy link

@FireWizard52 , what do you get in the console when you inspect any of your Google Devices with chrome://inspect?

@FireWizard52
Copy link
Contributor

@Paul-Reed, @rockstar2020

Paul and Rockstar, thank you for your response, as this issue is starting to cause a headache, everyresponse is more than welcome. Hopefully it gives me an idea.

@Paul-Reed
The default hostname of a Raspberry Pi is raspberrypi. So if you never changed that, the avahi-daemon will detect raspberrypi.local, as shown in @rockstar2020 's example. The drawback of course is, that in case you have more than 1 Raspberry Pi running in your local LAN, all Raspberries has the same hostname and this is confusing.
Probably this might be the reason that yours is indicated with raspberrypi-2.local

I'm curious, what the command avahi-browse -at shows. You have to install avahi-utils.

In my case, it is (only the significant part is shown):
+ eth0 IPv4 RPi1 example.com._nodered-google._tcp.local
where example.com is the domain. My (example) hostname of this Pi is RPi1.example.com

Do you have more than 1 Raspberry Pi running in your LAN?

The mDNSDiscovery app works okay, so that is not an issue.

E.g. + eth0 IPv4 Philips Hue - 2B7573 _hue._tcp local shows:

Screenshot_mDNS_Discovery-succes

@rockstar2020,

You wrote:

what do you get in the console when you inspect any of your Google Devices with chrome://inspect?

I know what you want but if I go in the Chrome browser to chrome://inspect, I see the following:

Screenshot_Chrome_Inspect

Can you give a guideline? I do not use Chrome frequently as Firefox is my default browser.

I do not think that it will ever functioning, before I have the mDNS discovery working.

@rockstar2020
Copy link

HI @FireWizard52 , when you type "chrome://inspect" you have to wait couple of minutes until you see all your Google Devices listed.
Then you click on "Inspect", see below:

image

After that another window will open which will show you the console of your like below.
If you don't see any red text error messages then your setup is complete and your Google Device has completed the IDENTIFY and REACHABLE devices commands successfully.

If you see error messages then you can reboot your Google Device and try again.

image

@Paul-Reed
Copy link
Contributor

I'm curious, what the command avahi-browse -at shows

`+ eth0 IPv4 raspberrypi_nodered-google._tcp local

Do you have more than 1 Raspberry Pi running in your LAN?

No I don't, I do have more Pi's (in fact every model so far in my bottom drawer!!!), and may have had a second Pi running at the same time, especially when I set this current Pi up, but then replaced the old with the new. So only one Pi running currently.

@FireWizard52
Copy link
Contributor

@rockstar2020

Thank you very much for your support.

You said:

when you type "chrome://inspect" you have to wait couple of minutes until you see all your Google Devices listed.

Unfortunately the Google Chrome version I use on my Desktop PC does not display the Google Devices.
Perhaps another version. Fortunately I had also a Laptop PC.
There it displayed after a few seconds (not minutes) "Remote Target" (Localhost) and also my Google Nest Hub with IP address.
Sometimes this one disappears. Unlike you, I do not get the "inspect" (your red indication).
However with the Right Mouse Button I can activate Inspect, that also gives me the new Window.
Unfortunately I do not get anything under the "Console" tab. I shows the prompt (>) and that is it.

I tested it also with the latest Chrome on Windows 10, but with the same result.

I think I am pretty close to the end of my ideas :(

@Paul-Reed,

I don't see a big difference between your response and my response, if command avahi-browse -at is used.

I' m convinced that mDNS should work, before I will get something in the Google Console.

@Paul-Reed
Copy link
Contributor

@FireWizard52 When I tried to inspect the console (some weeks ago) I used my laptop, but I could not get access either, until I connected a ethernet cable, instead of using WiFi.
I don't know what you are using.

@FireWizard52
Copy link
Contributor

Hello @Paul-Reed

Thanks Paul for trying to support me and sharing your experiences.

My Desktp PC is hardwired with Ethernet cable to a switch.
This is the one rhat didn' t the Google devices.

My laptop PC is in a docking station which is also hardwired with Ethernet cable.

So in both cases Wifi is not involved, except the Google Nest Hub.

@Caprico85
Copy link
Collaborator

I also had problems finding the Nest Hub first. For me it helped adding the Hub as discovery target.

image
image

However with the Right Mouse Button I can activate Inspect, that also gives me the new Window.

I think you are not actually inspecting the Nest Hub. You are only inspecting the chrome://inspect page. You are inspecting the inspector, so to say.

How is this service "nodered-google" added . Where does it comes from?

File lib/SmartHome.js, line 202, method StartMDNSAdvertisement().

@FireWizard52
Copy link
Contributor

Thank you, @Caprico85 for your response.

I also had problems finding the Nest Hub first. For me it helped adding the Hub as discovery target.

I did exactly the same, with the same ports as indicated and this afternoon it worked for me and I had the possibility to inspect the response from my Google Nest Hub. Disappointing.

I think you are not actually inspecting the Nest Hub. You are only inspecting the chrome://inspect page. You are inspecting the inspector, so to say.

You were 100% correct, Indeed I was inspecting the chrome://inspect page. You mentioned it and then I saw it immediately.
Thanks

Screenshot_Nest_Hub_inspect

After selecting "inspect" I got the real page of the Google Nest Hub.

I activated and deactivated a number of Lights and that gives the following result.

Screenshot_Nest_Hub_inspect_result

Not much, that indicates a functioning "local fulfillment΅.

Regards

@Caprico85
Copy link
Collaborator

I'm curious, what the command avahi-browse -at shows. You have to install avahi-utils.
In my case, it is (only the significant part is shown): + eth0 IPv4 RPi1 example.com._nodered-google._tcp.local

Thats interesting. It seems, your host is already advertising itself via mDNS. It just doesn't use the expected name _nodered-google._tcp.local, but includes its domain.

When I do avahi-browse -at, I don't have the example.com:

+   eth0 IPv4 nodered                                       _nodered-google._tcp local

Maybe, if you set the the mDNS service name in the Actions on Google Console to example.com._nodered-google._tcp.local (and reboot the Nest Hub of course), it works?

@FireWizard52
Copy link
Contributor

Thanks @Caprico85

Probably the reason, you have only nodered, is that your hostname of the device (Raspberry Pi?) is "nodered"

I changed the mDNS service name. as suggested rebooted and tested, but the result was the same. No local fulfillment and no extra information in the Google Chrome console..

I reverse the change now.

@FireWizard52
Copy link
Contributor

Hi,

While reversing my previous change, I decided to do it the other way around (once again).
So instead of adding the domain name in the Google actions console, I decided to remove the domain name from my hostname and to use only RPi1. You have to change your /etc/hosts file as well and remove the domain name there as well.

While testing this change I discovered it and I feel ashamed to tell it, but to learn for everybody, I tell it.

In the hosts file the hostname (and previous also the domain name) pointed to IP Address 127.0.1.1 instead of 127.0.0.1.
It has been there for years (about 4-5 years). Correcting this "small" issue, made the mDNS Discovery app working and also local fulfillment. No errors in the Google Chrome console.

Screenshot_Local_fulfillment_working

I want to thank @Caprico85, @Paul-Reed, @rockstar2020 and all others for helping me and preventing giving-up.
This simple thing has cost me a lot of time, but I also have learned a lot.

Thank you guys :)

@FireWizard52
Copy link
Contributor

FireWizard52 commented Feb 21, 2022

Hi,

I have one afterburner.
It is important, that the contents of the hostname file is only the hostname and NOT hostname.domain.name.
If it contains also the domain name, mDNS does not work.

Of course the hosts file should match the contents of the hostname file.

Perhaps something for the README file.

@Caprico85
Copy link
Collaborator

Nice! Glad you finally got it working.
Added a note to the readme.

@FireWizard52
Copy link
Contributor

FireWizard52 commented Feb 23, 2022

Hello @Caprico85

I noticed that you modified the readme, as follows:

If you have set a domain on your host, check the configuration. /etc/hostname must only contain the hostname without the domain. /etc/hosts must contain a line for your hostname including the domain.

The first sentence is correct, but the second is not.

On the device, which has Node-RED installed (Raspberry Pi 1), I have following host name:

Screenshot_RPi_hostname

So , as you can see, only the host name, without domain name

My hosts file look like:

Screenshot_RPi_hosts

Also here, only the host name, without domain name.

After I modified the IP address (from 127.0.1.1 into 127.0.0.1), I did another test and reversed the hostname and hosts contents, to include the domain name. That did not work for me, so I configured it as shown. But it was a very quick test.
Did you test it, with the domain name in only the hosts file?

The command avahi-browse -at gives:

+ eth0 IPv4 RPi1 _nodered-google._tcp local

So this is also without domain name. The mDNS Discovery app discovers the RPi1, while with domain name RPi1.example.com will not be discovered.

I suggest to replace "including the domain" into "excluding the domain", unless other users has other experience.

Regards

@Caprico85
Copy link
Collaborator

@FireWizard52
I read setting the domain like this somewhere on the internet. I updated myinstructions regarding domains.

@Caprico85
Copy link
Collaborator

So, most problems in this thread seems to be fixed now. Thanks everybody and special thanks to @Zarklord. I'm closing this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants