How do I send a command to Google Home with an ESP8266? - c++

I have been looking for a way to send commands to my google home by pressing a button connected to an ESP8266. What I am trying to do is have my Google home turn off / on my Smart lights by pressing a button rather than saying the command.
I have some generic Wi-Fi controlled smart lights that are connected to my Google Home and I control them with the basic on/off commands (turn them on I say "OK Google, turn on my lights." and for off "OK Google, turn off my lights."). I would like to be able to press a physical button and have the ESP8266 push the command to my Google Home and have it execute it. Essentially a light switch that uses code to toggle the lights on and off rather than cutting the power, or go into an app, or say a verbal command.
I would prefer it not to use IFTTT but if that is necessary I will oblige to doing so. I have seen countless people send commands TO an ESP8266 FROM a google home, but I have never seen it accomplish way around besides 1 GitHub post showing that you can send voice commands using his Library called Google Home Notifier. While this does work for having my Google say something I don't know how (if even possible) to use it to have Google receive and execute a command.
As I stated earlier I don't know if this is even possible. I believe there is some way to do this I just don't know-how. I would really appreciate any help that can be given or a point in the right direction on how to accomplish this.

Why do you even want to use your Google Home ?
What if you connect your ESP8266 to home-assistant, and trigger an automation when the button is pressed ? This automation could turn off the lights, or call a Google API if that's what you want
N.B: I guessed you have a home assistant setup because of the tags in your question. If that's not the case, please edit

Related

AWS Device Farm - Disable tutorials on devices

I am doing automated tests [Android / Appium Java JUnit] with the AWS Device Farm service, but they are interrupted by the use tutorials that appear on the devices, for example, the tutorial of how to use the camera. I want to know if there is a way to disable the tutorials of the use of the device. Thanks.
I work for the AWS Device Farm team.
We detected and root caused this issue where a one-time tutorial popup appears on some phone's camera apps. We've corrected it, so feel free to try again and let us know if this problem is still affecting you.
Looks like there is also a script you can run from this AWS forum post
https://forums.aws.amazon.com/thread.jspa?threadID=294719
Hi,
I'm so sorry this keeps happening to you. We do currently only have the dismissal running on some devices like the Samsung S9, and are going to be enabling it for other devices soon, in the coming weeks. What I can do now is provide you a script to verify that theyre dismissed yourself at the beginning of your test. If you're using "custom environment mode", add the following 2 lines to the pre-test section of your test spec file:
curl https://s3-us-west-2.amazonaws.com/aws-devicefarm-support/chrome_initialization_and_popup_detection.py -o chrome_initialization_and_popup_detection.py
- python chrome_initialization_and_popup_detection.py -v --retries 2 --output-dir $DEVICEFARM_TEST_PACKAGE_PATH/popup_dismissal
This will run our popup dismissal script in your own code to verify that any device you run on gets all popups dismissed. It shouldn't be necessary for some devices like the S9, but just in case any do happen to creep up, this will dismiss them for you. I'll also double-check on our end why some popups like the S9 popup aren't getting dismissed properly.

AWS IoT Button Won't Connect to AWS IoT

I recently bought an AWS IoT Button generation 2, and I'm trying to set it up.
I followed the steps in this tutorial: http://docs.aws.amazon.com/iot/latest/developerguide/iot-gs.html
I can connect to the wifi network generated by the button. I went to the .../index.html, attached my certs, etc.
Everything seemed fine, until I tried to use the button. When using the desktop-based instructions, I went to the MQTT Client and subscribed to it, but saw nothing when I clicked the button. When I tried to use the iOS app setup, I set the button action to send me a text message. I never got the text message. In both cases, the below occurred:
When I click the button, it blinks white for about a minute, then 3 short red blinks (meaning there was an error connecting to the wireless network).
I've tried these steps in my secure home network as well as the open network at my local library. Same results.
I've also tried starting over, repeating all steps from the tutorial and creating new certificates, etc. Same results.
Seems I'm not the only one having this problem.
Any help is much appreciated.
My button is now connected, although I have no idea why it wasn't working. I just followed the exact same steps I had been following on the same wifi network and everything, and all of a sudden it connected. Still looking for insight if anyone has some!

How to avoid Outlook Security Alert

So I'm interning at a company and essentially self teaching myself C++ to get a head start on classes this fall.
The problem I have that I cannot find a solution for, is how to send an email without user interaction and avoid the security prompts by outlook. I have tried different ways to send the email like with simplemapi, cmd, vb, cdo, etc but nothing I do seems to get rid of that 'please wait 5 seconds because someones trying to send an email' prompt, and I can't have that.
I also can't install any third party software because I need this program to work on all the company computers.
I'm about to try with System.Net.Mail.MailMessage and see if I can figure that out.
End goal is that they click a button, and an email sends without their knowledge, with no security prompts. If it needs authentication to execute without the prompt I can implement that too. I'm using winapi on 64 bit systems, and have the exe run from sharepoint by pulling from a network drive if that matters. And please don't be closeminded about using MS office, I'll do anything to make it do what I want it to
In the meantime, if I could get a code sample or a link in the right direction (NOT MSDN FFS) that would be greatly appreciated.
See http://www.outlookcode.com/article.aspx?id=52 for a list of your options.
Note that System.Net.Mail.MailMessage will only work against an SMTP server, so it really has nothing to do with Outlook.

Can Web Applications detect local printers?

I was wondering if it is possible for a Web Application (hosted on a remote server) able to detect printers connected to a host(the one accessing the Web Application)?
Also, is it also possible to be able to send print-jobs (mainly images) to the host's printer?
For instance, assume you have a local WPF application (Windows Presentation Foundation, C#) running on the desktop.
To print an image:
Select an Image on the WPF application (loaded from a directory on the local harddisk)
Click the "Print Button"
This will run this line of C# code:
e.Graphics.DrawImage(image, x-coordinate, y-coordinate, imageWidth, imageHeight);
And it will send a print job of the image to the default printer of the local computer.
So now, instead of a WPF application, you have a Web Application. The user will:
Type in the URL of the Web Application
The Web-App will load a page similar to the WPF application
The Web-App will display images that are loaded from say, a database.
User select image he wants to print
User clicks "Print Image"
However, in order to Print the image, I would imagine the Web-App would need to recognise the printers the user has on his local computer, and be able to communicate with the printer.
Of course, the Web-App does not need to be in .NET. I was just using WPF/C# as an example.
Bluntly, the answer is no. Server-side code can't talk with client-side resources in that manner.
A possible solution might be to embed some client-side component into your web app which does what you
want, such as a Java applet or Silverlight item. I don't know off the top of my head whether they're capable of printing, but it might be an option worth investigating.
However, I would suggest the best way to handle it (if your use-case allows), is to serve up something capable of printing via native browser methods. You are able to serve a stylesheet which applies to printing specifically using the media="print" attribute on your link element. If that remains too imprecise (you'd have no control over the browser's paper size, margins, headers/footers etc), perhaps another option might be to serve a print-specific file such as a PDF. Ultimately though, what you are asking is not possible and it is a case of finding another way to fulfil your requirements.
I have a similar issue, which I haven't programmed, but, I have found that HP printers can receive print jobs, through the HP network. If you are WiFi enabled, there should be a way to email the print job to the printer. I'm still researching this. But, I have a friend who did something similar using AWS.
Been a while, but I have learned that HP printers can be WiFi enabled. Which means, they get an email address and can be printed to, at that address, through the internet, if they are connected to a WiFi net connected to the internet. The email goes through the internet directly to the printer, where it is then printed. So, you can email a print doc.

Do I want an embedded web-server, or what?

So, someone want me to hack some code for him. He has a 42" TFT display on which he will display some application/business related data.
However, 75% of the screen real estate is unused, so he wants to fill it with "TV/adverts/flash/you know, that kind of thing... web based....".
Any advice? Do I want an embedded web-server? If so, which? (he wants free & open source, or as cheap as possible) Do I display it in a browser? (duh! probably, dude) But I don't want/need a menu, address bar, toolbar, etc - it should be full screen (does that mean "kiosk mode"?).
Sorry, folks, the requirements are not clear, but I hope that you can guess what he probably means (he is not very techie). How should I proceed with this? Thanks.
I am working on such a display system, although ours already quite evolved, with support for multi-screen, multi-user and a lot more.
A few hints :
We use firefox with the "full fullscreen" extensiton (https://addons.mozilla.org/fr/firefox/addon/1568) that allows to not display any menu bar, status bar etc. and to automatically start Firefox in that mode. Then you just need a startup script to launch firefox specifying the right URL when the machine is started.
Our system is web based, but as a multiscreen system it has one server and several client PCs connected to the server via HTTP, and each one to a TFT screen via VGA cables. If you have only one screen you could install the browser and the web server on the same machine. Only restriction : we use wake-on-lan from the server to the clients to automatically start the display every morning. This will not be possible with a single machine system !
To give you some ideas, the display mechanism basically works like that : first, the browser loads a html page with lots of javascript (that javascript constitutes what we will call the "client application".) This client application is written using the Prototype.js library (just an indication, there are many other possibilities). Then the client application asks the server for the content to be displayed. That content is passed as a JSON stream representing a playlist of objects (images, videos, text news, etc.). The client app displays each object in the playlist sequentially. The objects stay displayed for a specific duration (lots of setTimeout in the code). The transitions use effects from the Scriptaculous library (fade-in, fade-out...). When all objects have been shown, the client asks the server again for the playlist (in case changes have been made), and the process starts again. There is actually never a full reload of the page.
Then we also have a multi-content mode, where the screen is separated in various zones that are updated separately.
For one machine and a realtively static system (i.e. no GUI to add content), maybe you could implement that mechanism in a local site accessed via file://... The whole "intelligence" of the system would be in the javascript. That would save you the server part. I see one possible restriction : I think flash can't play video files from the client's machine (security restriction) so check this if you plan to use flash videos.
Well, I hope these few ideas can help you. Good luck !
Get one these
They offer a VESA mount for it I think if the screen your using supports that.
Full screen firefox would be one option.
A more flexible option would be a full screen QT app written in the language of your choice using the webkit widget for display, this would likely make flash content more difficult.
As for the content, i would put a LAMP setup on the fit pc. Build the web page using whatever feeds you want and just display the web page aka http://localhost
Alternatively you could host the "web parts" of the display on a standard web hosting server and display the data coming in on RS-422 in a separate QT widget.