-
Notifications
You must be signed in to change notification settings - Fork 38
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
Comments
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 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. |
Yes, that is incorrect. The current flow is:
No, it would talk to node red. |
Add support for local execution (#128)
@Zarklord 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”. |
@Chrischi- if you view the node red logs, you'll see log entries using the path /local_smarthome instead of /smarthome. 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... |
@Zarklord I also see the following messages when checking via Chrome with ( |
It's not working for me either! |
Actually, no 😮. I only tested that normal excecution still works and then merged it. I planned to try local execution this weekend. |
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". 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. |
@Paul-Reed are you saying this update broke regular execution? @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... |
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... |
When I added Local execution I asked “Hey google force local” and got the answer "ok". |
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. |
|
Whoops, I accidentally copied the link to mikejac's version of the app, I have updated the link to properly point to my repo... |
@Zarklord 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. |
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- ) |
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 |
Maybe you could add some debug messages? |
There are debug messages for every single intent... |
@Zarklord but I see the following error: Shouldn't the requests come via HTTPS? Requests via HTTP do not work locally in the browser either. |
Couple questions |
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 |
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.
|
Yeah, that's what I expected.
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 |
@Chrischi- 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). |
Hi,
After restarting the Google Home, I get the following logs:
When I ask Google to switch on the light, I get the following logs:
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: |
Hello @ckhmer1 This afternoon I tested again. Node-RED version 2.2.1 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) Switching a light gave no indication of "local_smarthome", but I saw some pointers to the local fulfillment port (18080) 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 |
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. |
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 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. |
@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. |
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 Step 4: I Installed app mDNS Discovery] on my phone and let it search for "nodered-google" This step failed: 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. Is my assumption correct and that this might be the cause? [Edit] No I think not, because according to Wikipedia:
Could there be a conflict between mDNS and the local DNS server on my LAN? If so, how to solve this? |
Im rather new to the topic mDNS myself. So please don't take my answers too serious.
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).
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? |
Hello @Caprico85 Sorry or the somewhat late response, but I did use my time with reading and reading about .... mDNS. But let me answer your questions first.
No need for it. This app discovers other m(ulticast)DNS service perfect. So it is not related to this app.
But I think the issue is somewhere else, but I like to hear other opinions. This is what I did so far.
which gave as result:
You see here already something interesting between [ ] RP11.local. RPi1 is in my case the hostname of my Raspberry Pi.
This gives a utility avahi-browse. If you run
you will get a long list of devices and among them:
"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. I think it will work, if the Raspberry Pi, has no hostname defined, but that is not what I have. Any suggestions, ideas, solutions? |
I don't know if it helps you, but on my (working local Exec) Pi, I get;
My pi's hostname is |
I also get: The mDNS discovery in my network works perfectly but still I'm not able to execute any local fulfilment commands. |
@FireWizard52 , what do you get in the console when you inspect any of your Google Devices with chrome://inspect? |
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 I'm curious, what the command In my case, it is (only the significant part is shown): 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. You wrote:
I know what you want but if I go in the Chrome browser to 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. |
HI @FireWizard52 , when you type "chrome://inspect" you have to wait couple of minutes until you see all your Google Devices listed. After that another window will open which will show you the console of your like below. If you see error messages then you can reboot your Google Device and try again. |
`+ eth0 IPv4 raspberrypi_nodered-google._tcp local
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. |
Thank you very much for your support. You said:
Unfortunately the Google Chrome version I use on my Desktop PC does not display the Google Devices. 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 :( I don't see a big difference between your response and my response, if command I' m convinced that mDNS should work, before I will get something in the Google Console. |
@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. |
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. 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. |
I also had problems finding the Nest Hub first. For me it helped adding the Hub as discovery target.
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.
File lib/SmartHome.js, line 202, method StartMDNSAdvertisement(). |
Thank you, @Caprico85 for your response.
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.
You were 100% correct, Indeed I was inspecting the chrome://inspect page. You mentioned it and then I saw it immediately. 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. Not much, that indicates a functioning "local fulfillment΅. Regards |
Thats interesting. It seems, your host is already advertising itself via mDNS. It just doesn't use the expected name When I do
Maybe, if you set the the mDNS service name in the Actions on Google Console to |
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. |
Hi, While reversing my previous change, I decided to do it the other way around (once again). 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. I want to thank @Caprico85, @Paul-Reed, @rockstar2020 and all others for helping me and preventing giving-up. Thank you guys :) |
Hi, I have one afterburner. Of course the hosts file should match the contents of the hostname file. Perhaps something for the README file. |
Nice! Glad you finally got it working. |
Hello @Caprico85 I noticed that you modified the readme, as follows:
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: So , as you can see, only the host name, without domain name My hosts file look like: 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. The command
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 |
@FireWizard52 |
So, most problems in this thread seems to be fixed now. Thanks everybody and special thanks to @Zarklord. I'm closing this issue now. |
local execution in other node-red implementations is super fast and definitely belongs in this project.
is someone working already on local execution?
The text was updated successfully, but these errors were encountered: