ESPurna

ESPurna is a library of open/community sourced firmware built on arduino that can be used in place of the MppDevices.

The support structure for the library is quite useful with a web server used to configure the devices and a REST API that makes it relatively easy to integrate with AutomationManager.

The one drawback to this library is that it does not have http level event notification of changes, so external changes to the devices are not noticed by AM until the next refresh/poll period. The delay is typically < 30s and on average will be around 15s.

To get started, visit https://github.com/xoseperez/espurna/releases/ to see if there is a binary for the device and sensor you would like to use. Most of the ITEAD/sonoff devices can be flashed with new firmware (which is probably much safer than using their default implementations).

To burn your device, you need to connect it to your USB (the first time) and put it into flash mode. Following the first (successful) flash you should be able to use the over the air (OTA) support.

Flashing instructions are here: https://github.com/xoseperez/espurna/wiki/Binaries. I've added a few tips here to make it easier.

  1. The basic espressif flashing tool, while not pretty, is useful: Espressif's ESP8266 DOWNLOAD Tool, Flash something to get your device information including flash size, erase the entire flash, and then flash the ESPurna binary.
  2. Setup via "Terminal" (USB). This is the easiest method. Use a serial monitor (e.g. Arduino IE (set eol to carriage return) or MppController at 115200bps, and send the commands:
      1. set adminPass {your preferred password, userid will be "admin"}
        • At the time of writing, password "... must be 8..63 characters (numbers and letters and any of these special characters: _,.;:~!?@#$%^&*<>\|(){}[]) and have at least one lowercase and one uppercase or one number."
      2. set ssid0 {your ssid}
      3. set pass0 {your password}
      4. wifi.reset
      5. reset
  3. Find the device's assigned IP:
      • look for the device assigned ip in the startup messages (MODE STA)
      • wifi and info are handy commands as well
  4. Use a browser to connect to the device's web page using the IP from above.
      1. Enable "Alexa" integration on the GENERAL page. Save.
      2. Enable the HTTP API on the ADMIN page. Confirm an HTTP API key is assigned. Save.
  5. The device can now be discovered and used with AutomationManager.

To use the device with AutomationManager

You'll need the web admin password that you used in the previous setup steps. AM will not retain the password, but it will find the device and use the assigned HTTP API key. You will need to repeat these steps if you change the key. In the device's web adming be sure to have enabled the HTTP API and, to use AUTO discovery, Alexa.

    1. Open AutomationManager
    2. Use "Find" to do a "Manual Search".
    3. Pick "Find Espurna devices"
    4. Typically you will use "AUTO" unless you have a network that blocks SSDP (multicast) messages, in which case use "MANUAL". You will need the device IP for a manual search.
    5. In AUTO AM will search for your devices for 30s or so. Note the list of devices (if there are none, try again or use the manual search). Touch any that you would like to add to AM.
    6. Specify the device web/admin password (not the HTTP API key, that will be discovered automatically) and touch "DISCOVER". When the discovery is complete return to the list and touch "REFRESH".
    7. You devices are now ready to be accessed with AutomationManager. Use "forget" or "ignore" for any devices you do not want managed.
    8. If you've assigned your ESPurna devices reserved or static IPs and they will not change you can disable Alexa in the ESPurna's web page.

Alternative: Setup over Wifi

  1. Restart device, find and connect to it's AP using the password fibonacci.
  2. Open a web browser against the gateway IP of your device (usually 192.168.4.1). Use the password fibonacci again. You'll need to update the password with one of your choosing (pay attention to the password restrictions).
  3. The device will disconnect and restart when you change the password. Find it's AP and connect to it again with your new password. Once again hit the device with a web browser.
    • You may need to force a login if you don't restart your browser. Try the URL http://admin:{yourpassword}@192.168.4.1 (no braces). Some browsers do not support this login feature, you will need to completely stop and restart the brower's process as it will retain the old password.
  4. Connect the device to your wifi router by adding a network on the WIFI page. Save. Note the assigned IP on the STATUS page if it is available.
  5. Connect to the device using your internal network (check your router for the device's assigned IP if you didn't find it earlier).

Troubleshooting

Device not available on your wifi network?

Retry the network setup. If the device's AP is visible, use the alternative wifi setup.

Web page does not appear

Restart your browser and use the url based password entry (see above).

Unauthorized

Double check the password. User is "admin".

With a web browser try entering the url based password as above.

When discovering with AM note some autofill entry fields add a space at the end.

Device does not start

Try booting with a serial port connected at 76800bps to see the boot messages. If you see a checksum error the flash didn't work. Try different parameters, DOUT will often work better than QIO or DIO. Note that the espressif flash utility will not allow you to select an alternate burn method and will reset it when it syncs with the chip for flashing. The default will not always work in that device. Try alternate flash settings with ESP8266Flasher.exe.