Skip to content

HomeSpan v1.9.1

Latest
Compare
Choose a tag to compare
@HomeSpan HomeSpan released this 03 Jul 22:03
d6fcc50

New API Functions

  • New integrated support for TLV8 Characteristics

    • new TLV8() class library for the creation and management of TLV8 objects. Methods include:

      • add() - adds a TLV8 record containing a byte stream, string, numerical value, zero-length tag, or even another complete TLV8 object
      • find() - finds the TLV8 record matching a specified tag over an optionally-specified range
      • len() - returns the length of the specified TLV8 record
      • print() - prints each TLV8 record (or a range of records) to the Serial Monitor
      • printAll() - recursively prints all sub-TLV8 objects to the Serial Monitor
      • wipe() - erases all records from a TLV8 object
    • new TLV8_it() iterators used to extract and read data from TLV8 records. Methods include:

      • getTag() - returns the numeric TAG for a TLV8 record
      • getLen() - returns the LENGTH of a TLV8 record
      • get() - returns a pointer to the VALUE byte-stream of a TLV8 record
      • get()[] - returns a particular byte in the VALUE byte-stream of a TLV8 record
      • getVal() - a template function to convert the VALUE byte-stream of a TLV8 record to a numeric value
    • new homeSpan methods to read and write TLV8 objects to and from a TLV Characteristic

      • getTLV() and getNewTLV() reads from a TLV8-based Characteristic into a TLV8 object
      • setTLV() writes TLV8 object into a TLV8-based Characteristic
    • added new CUSTOM_CHAR_TLV8() that allows for easy creation of custom TLV8 Characteristics

    • added integrated support for new TLV8 Characteristic DisplayOrder

      • sets the order in which the Input Sources for a Television Service are displayed for selection in the Home App
      • credit to @zwaldowski (homebridge/HAP-NodeJS#644 (comment)) for reverse-engineering this undocumented Apple Characteristic, and to HomeBridge for documenting its UUID
    • added new Tutorial Example 22 - TLV8 Characteristics demonstrating use of the TLV8() class and TLV8 Characteristics

    • see the new TLV8.md page for complete details and documentation

  • New methods to read Controller data (for advanced use-cases only) (#801)

    • adds new homeSpan method setControllerCallback() to set optional callback function that HomeSpan calls whenever a controller is added, removed, or updated
    • adds new homeSpan methods controllerListBegin() and controllerListEnd()
      • returns constant iterators to the beginning and end of the linked-list HomeSpan uses to store all controller data
      • methods to read the controller data pointed to by such iterators include:
        • getID() - returns a pointer to the 36-byte Device ID of the controller
        • getLTPK() - a pointer to the 32-byte Long-Term Public Key of the controller
        • isAdmin() - returns true if the controller has admin permission, else returns false
    • see the API Reference for details
  • New methods to read and set the IIDs of Services and Characteristics

    • adds new SpanService method getIID() that returns the IID of a Service
    • adds new SpanCharacteristic method getIID() that returns the IID of a Characteristic
    • adds new homeSpan method resetIID(int newIID) that resets the IID count for the current Accessory
    • see the API Reference for details
  • Added support for more Pixel chips (#781 / #784)

    • new constructor Pixel(uint8_t pin, [pixelType_t pixelType]) allows your to set the order in which colors are transmitted to the pixel chip, where pixelType is one of the following:
      • PixelType::RGB, PixelType::RBG, PixelType::BRG, PixelType::BGR, PixelType::GBR, PixelType::GRB
      • PixelType::RGBW, PixelType::RBGW, PixelType::BRGW, PixelType::BGRW, PixelType::GBRW, PixelType::GRBW*
    • deprecated previous constructor Pixel(uint8_t pin, boolean isRGBW)
      • this constructor will continue to work, but you will receive a warning during compilation that it has been deprecated
      • users should switch to the new constructor to avoid potential compatibility issues with future versions of HomeSpan
    • added new method boolean isRGBW()
      • returns true if Pixel was constructed as RGBW, else false if constructed as RGB only (i.e. no white LED)
    • created new PixelTester sketch (found under Other-> Examples) to aid in determining the pixelType for any LED Strip
  • New Tutorial Example 21 - AccessoryIdentifier

    • demonstrates how to trigger an Accessory's Identifier Characteristic, optionally used to help identify a device during initial pairing to the Home App
  • Converted the getLinks() SpanService method to a template function

    • new form is now: vector<T> getLinks<T=SpanService *>(const char *serviceName=NULL)
    • if template parameter, T, is specified, the elements of the returned vector will be cast into type T
    • if serviceName is specified, only those services matching serviceName will be included in the return vector
    • fully backwards-compatible with original getLinks() method
  • New ability to halt the pulse generation for a ServoPin (#874)

    • calling set(NAN) for a ServoPin halts the pulse generation, which (for most analog servos) allows the motor to be freely rotated
    • calling set(position), where position equal the desired number of degrees, restarts the pulse generation and sets the servo position accordingly

Internal Updates

  • Added support for Characteristics that require the write-response protocol to process write requests (#801)

    • not needed for any Characteristics that are currently supported by HomeSpan
    • but available for use with any Custom Characteristics that may require the write-response protocol
    • this feature is automatically enabled as needed - no user coding, setup, or configuration required
    • write-response requests will be processed regardless of whether the Characteristic has the WR permission set
  • Added extra checks when using setVal()

    • a warning message is output on the Serial Monitor if setVal() is called to change the value of a Characteristic from within the update() method at the same time the Home App is sending an update request for that value
    • does not apply if setVal() is called from within update() to change the value of a Characteristic in response to a write-response request from the Home App
  • Refactored client/slot management to save memory and prepare for future integration of Ethernet support

    • fixed-array of Client/Socket connections replaced by dynamic linked-list
    • serial interface now only shows active client connections (rather than a fixed list of client slots)
    • deprecated homeSpan.reserveSocketConnections()
      • no longer needed since new HomeKit Architecture requires only one or two connections from a central Home Hub
      • function throws compiler deprecation warning, but otherwise function does nothing
  • Allow dynamic variables to be used for the string arguments in homeSpan.begin() and homeSpan.setHostNameSuffix() (#837)

    • string variables are now fully copied into their own memory rather than simply copying the pointers
    • allows local dynamic variables that go out of scope to be used as parameters

Bug Fixes

  • Fixed bug introduced in 1.9.0 that prevented homeSpan.setPairingCode() from saving (and subsequently using) the request Setup Pairing Code (#786)

    • this method now operates silently, unless an invalid pairing code is provided, in which case an error is reported to the Serial Monitor and the sketch is halted
    • the process for setting the Pairing Code using the CLI 'S' command or via the Access Point are unchanged - confirmation messages are still output to the Serial Monitor and errors do not cause the sketch to halt
  • Fixed memory leak introduced in 1.9.0 that would fail to free a small temporary memory block created when verifying a new connection (#844)

    • had no practical impact when using a Home Hub since Home Kit only creates a few permanent connections
    • had significant impact when not using a Home Hub in cases where the Home App repeatedly drops and re-establishes connections, resulting in slow erosion of heap memory and then out-of-memory failure of the device after a few days (note use of HomeSpan without a Home Hub is not formally supported)
  • Fixed latent bug in SpanPoint

    • HomeSpan would crash when printing SpanPoint configuration information to the Serial Monitor (the 'i' CLI command) if any of the instances of SpanPoint had receiveSize=0
    • this bug never surfaced before since all the SpanPoint examples were based on receiving data and therefore had a non-zero receiveSize

Deleted Functions

  • Deleted homeSpan.setMaxConnections(), which had been deprecated many versions ago

  • Deleted stand-alone SpanRange structure, which had been deprecated many versions ago

    • this has no impact on standard use of the Characteristic method setRange()