Google Home shows my smart devices loading for around 10 seconds - google-cloud-functions

I am using Google smarthome washer code to control my ESP8266 with SSR. Everything works fine but every time I open my Google Home app or Home Control in Nest Hub 2, devices are shown loading for around 10 seconds or more.
But devices from other vendors like Philips Hue are shown in 2-3 seconds.
Any suggestions on what I might be doing wrong.
Here is the link to the code I used.
https://github.com/googlecodelabs/smarthome-washer

I would recommend checking if you are able to handle the Query response in time and in
the correct format. Also, can you check the backend logs for the query requests and
response for the status of all the devices.

I solved the problem, my reportstate function was not updating the states of the devices due to which QUERY intent has to be called everytime I opened Google Home app which increased the loading time. Home Graph viewer is the tool to debug.

You can check the log files and see if you are handling the request and response properly or having any issue in that.

Related

How can I capture the user activity in Firefox or Chrome from a desktop application?

I need to capture the following user activity in the browser (it can be Chrome or Firefox):
What page he/she is seeing: the url and the time stamps of start and end of the focus on that page
And I need to capture it from an Electron application, or at least send the captured data (using another app / extension) to this application.
I think that I might be able to use the Chrome Reporting Extension to obtain this data in JSON, but I'm not sure if it will work, so I wanted gather more ideas for that, while I search for other possible solutions. It could be something to Firefox too.
Thanks!

Not seeing all traffic incoming from a website in the inspector under the network tab?

So when I go to a website like, say https://coinmarketcap.com (that displays the prices of cryptocurrencies), in my Chrome Browser, it looks like I dont see all activity going on in the inspector under the Network tab.
Here is a screenshot to visualize the website:
I see the prices are updated live on the website (without refreshing), but I don't see any activity in the Network inspector.
There is of course activity when I load the page for the first time, but nothing after that even tho the website dynamically updates the prices? My firsts thought was, that it could be fake updates via a JS script on the client-side, but there are many websites I know where you can't see this, so what's going on here? What types of protocols are used to achieve this, because I know that WebSockets and polling (xhr) always shows up.
A screenshot of the network inspector, just be clear what I mean by that (showing traffic for the first 50 ms (loading time) and then nothing afterwards)
It using Web socket, you filter the request by WS and should see the latest ws connection.
Click on it and sees the message for this socket.
it was necessary to use a proxy like burpsuite in order to capture the sockets sent and received by the client / server here is the result it's about 72 request received in a single second
The website you suggested is using Websockets for communication.
To see WebSockets request in WS tab in Network inspector, You will have to open the console first then refresh the page.
The console needs to capture the initial handshakes when communication initializes. So if you open the website first then check the console, you may not find anything in WS.

Google analytics hit returns 302 and second request wont work

So basically the first hit is returning 302 and the user agent (in this case my web browser) is invited to send the SAME hit again to another url but this time even when im getting a 200 the hit is sent incorrectly because lots of the params are not being send. (This happens sometimes not always)
First Hit:
Second Hit:
To clarify a little more im getting this problem with an addToCart (EE) and its causing me to products sales without being added to cart. I checked the dataLayer and everything seems to be ok.
So im in doubt if its a problem with my web browser or its a problem with analytics?
If version of the web browser are needed you can read it on the user-agent of the images.
I had the same issue when I tried to manually insert the google analytics tracking code(gtag) in my .
First step was to remove the Google analytics code from the header. I had used the plugin 'Insert Headers and Footers'.
Afterwards I installed Insights Monster plugin, went through the launch wizard and the 302 redirect disappeared.
I didn't really want to use a heavy plugin to resolve this issue but unfortunately it was the only solution for me.
I copied and answer from here: https://tonnygaric.com/blog/prevent-google-analytics-from-making-requests-to-stats-g-doubleclick-net you need to do a configuration in Google Analytics dashboard.
The answer is pretty simple. Go to GA -> Admin -> Tracking info -> Data Collection -> disable both toggles and click on save. It can take up to 24 hours for the changes to take effect.

How to return from Google Maps App to my app?

From my app I'm calling Google Maps app using Intent and everything works well.
My question is:
how do I get back from Google Maps app to my app?
If I use the device "back" button then I need to press it 4-5 times!
Does anybody have a better solution?
Android does not give you control to the activities you launch. And since it mentioned nothing in the official documentation, it possibility means you can not.
One thing might help is it seems your application can check whether if the navigation is currently running. Look at this post for more information on that: Android application to detect when Google maps direction is finished
My solution is to create an AlarmManager right before you start the Maps Activity, save any variables in sharedPreferences and then let the Map Intent do what it has to do. After x time has passed(You decide how much time needs to pass before returning to your app) in the BroadcastReceiver open up your app in the activity that you want. Then load any needed variables that you stored in the sharedPreferences and done!
In essence it works like an alarm clock, you set the time and after x time you notify the user. I followed this tutorial(I used only the part I needed):
http://stacktips.com/tutorials/android/repeat-alarm-example-in-android

Chrome is accessing links in webpages that were not clicked

I spent the day debugging my website, because I seem to be getting randomly logged out, but just on Chrome on Android.
After reviewing the server logs, I see requests from my Android tablets IP hitting my server for links that I never clicked on. After some experimentation I see every couple of links I click, Chrome will fetch another link at random in the page that was not clicked.
The issue is that there is an a link in the page with an href="logout" which will sign in, and Chrome calls this all on its own, disconnecting the session. I suppose if I changed the link to call a POST operation Google would not fetch it, but I can't see why Google would be fetching links that were not clicked.
This is very odd, and does not occur on Firefox, or Chrome on Windows.
Not sure if this is some sort of virus on the tablet, or some thing Google is doing to check the content of pages that it would not have access to without the session.
I have seen Google do this before, but only when there were Google ads in the page, then Google would fetch the links twice so that it could get the page content to choose the ad. This seems a huge privacy issue, as Chrome is fetching private data from the session.
So the issue is that Chrome is using a new feature "prefetching".
This is a "feature" that will have Chrome randomly fetch any linked URL from the page.
This seems like a very error prone "feature" for Chrome to enable by default. Seems like it could give the user cached or stale data, or change the server's state causing obscure difficult to debug issues. This will also use double the amount of the user's data (and server's CPU), which you would think would not be desirable to most users that pay for their data.
I confirmed this by disabling the feature in Chrome.
My solution was to switch the logout call to use a POST through a element.
See, https://www.technipages.com/google-chrome-prefetch