Hacker for Hire

ESP8266 and SSDP

I recently picked up an Adafruit Feather HUZZAH with the intent of gluing it together with the SmartThings eco system. This presented an initial problem of needing to do SSDP based communications since that's how SmartThings likes to do LAN based communications. After digging a bit, it becamse clear I was going to have to make some modifications to the library.

Getting Ready for Development

  1. Follow the instructions to get the standard ESP8266 Arduino package installed (see Adafruit)
  2. Fork the repo on github
  3. Change to the cd ~/.arduino15/packages/esp8266/hardware/esp8266/2.0.0 directory
  4. Remove everything, rm -rf *.*
  5. Clone the git repo you forked
  6. In the tools directory, ./get.py to get the required tools downloaded
  7. Make code changes and then start hacking away

Implementing the SSDP Server

After I built my own, I finally saw that there was a ESPSSDP library that I could use, so I scrapped what I did (even though it was about 5% smaller) and figured that I'd work on cleaning up the normal library so everyone else could maybe have the changes. First things first, we need a proper set of serial numbers, so now we can do this:

// setup the SSDP information
SSDP.setHTTPPort(LISTEN_PORT);
SSDP.setName("Temperature and Humdity Sensor");
SSDP.setURL("index.html");
SSDP.setModelName("TandH");
SSDP.setModelNumber("v1");
SSDP.setModelURL("http://hackerforhire.org/TandHv1");
SSDP.setManufacturer("Hacker for Hire");
SSDP.setManufacturerURL("http://hackerforhire.org/");
// only in my repo for now
SSDP.setSerialNumber(ESP.getChipId());
SSDP.setDeviceType("urn:schemas-upnp-org:device:TemperatureSensor:1");

After poking some more at the SSDP library, I think I'm going to add a function to adjust the timer refresh since there is no way that waking the system every 1000ms is going to let it live even close to a day on the battery.

comments powered by Disqus