ESP8266 D1 Mini NodeMcu with Amazon Echo

I’ve been watching a lot of YouTube videos recently, the likes of Colin Furze and James Bruton. I spotted the ESP8266 on James Bruton’s channel, he’d used it to enable alexa voice control for Colin’s voice activated flame thrower.

So I bought myself one from Amazon along with a Relay shield for the sole purpose of having a play.

I bought the MakerHawk D1 Mini NodeMcu 4MB and a single 10A relay shield

Started off testing i’d setup the Arduino IDE software and link to the board correctly by loading a flashing LED script to the D1 mini.

Code:

void setup() {
pinMode(BUILTIN_LED, OUTPUT); // initialize onboard LED as output
}

void loop() {
digitalWrite(BUILTIN_LED, HIGH); // turn on LED with voltage HIGH
delay(100); // wait 100ms
digitalWrite(BUILTIN_LED, LOW); // turn off LED with voltage LOW
delay(100); // wait 100ms
}

Next step was to try a voice activated LED, it took a while to find code that worked as my Amazon Echo Dot had just updated to the latest firmware and I gather some people are having issues with legacy scripts working.

Download Working Alexa Code Here

Stand by for video of it working with the relay.

Internal Active Directory Domain Matches Company Website Domain

I’ve had a situation recently (which is quite common particularly as Microsoft don’t support .local domains for things like SkypeForBusiness)

The issue arose when the company Active Directory domain matches the external website domain and the company isn’t using www. record for their site, so people can’t access the corporate website internally. e.g. http://joebloggs.com

My workaround is quite simple and I can’t see this solution elsewhere in this specific context so I thought I’d put it here.

 

In my example, my pretend company has a windows AD domain of joebloggs.com which all their users & computers are members of. Their website is http://joebloggs.com

  • For AD to work joebloggs.com must be pointing to the internal IPs of your Domain Controllers.
  • If you browse to joebloggs.com internally you’ll be greeted with either an error (if no IIS installed) or an IIS landing page.
  • You can’t change your internal joebloggs.com A record to match the public IP of your web host as AD will break completely.

The solution is to use a reverse proxy. I’d thought of setting up a Linux VM and using NGINX or Apache but I discovered IIS has reverse proxy functionality available through a couple of extensions. This is obviously much cleaner as it can run on the DCs themselves.

 

The rough steps are as follows:

1. Install IIS role on DC
2. Install URL Rewrite module from: http://www.iis.net/downloads/microsoft/url-rewrite
3. Install Application Request routing module from: https://www.iis.net/downloads/microsoft/application-request-routing
4. Create an IIS Site on your DC for joebloggs.com
5. Follow guide here: https://tecadmin.net/set-up-reverse-proxy-using-iis/# and use your website public IP for the inbound rules box on reverse proxy.
6. Fix gzip error with guide here: https://blogs.msdn.microsoft.com/friis/2016/08/25/iis-with-url-rewrite-as-a-reverse-proxy-part-2-dealing-with-500-52-status-codes/
7. Make sure following variables are allowed on Rewrite (Go to View Server Variables…): HTTP_ACCEPT_ENCODING, HTTP_HOST, HTTP_X_ORIGINAL_ACCEPT_ENCODING
8. To make sure the host header requested (joebloggs.com) passes through to the webhost from your reverse proxy, Run the following command: C:\Windows\System32\inetsrv>appcmd.exe set config -section:system.webServer/proxy /preserveHostHeader:”True” /commit:apphost
9. Ensure Internal DNS A records for joebloggs.com are pointing to the DC IPs
10. Test site works

Happy Days.

Ramblings of Rob