The only reason to have used getAccessory(aid) is to delete it, so the delete command is now invoked automatically. Function returns 0 on success (matching aid found) or -1 on fail (aid not found)
All tutorial examples now updated and confirmed working s expected in ios15.4.1 except for Example 17 (Shower). DEV_Identify.h removed from all examples and optional AccessoryInformation() Characteristics deleted to make examples easier to use and understand.
To Do: Review and update "Other Examples" and add link to Example 19 in Tutorials.md
This appears to be a Home App problem. The problem cannot be fixed by adding in ServiceLabel and ServiceIndex (no impact), nor adding in isConfigured(), nor adding Name() Characteristics. The Home App refuses to render the valves regardless of what valve type. They will sometimes appear, and then disappear from the interface for no reason.
Testing with the Apple's HomeKit Simulator yields the same symptoms.
Completely replaced Example 11, which showed how to use setPrimary() since this no longer seems to have any impact on HomeKit. Changed sketch name from ServiceOptions to ServiceNames.
Also updated SpanWebLog::addLog() so that the log message is also output to the Serial Monitor if the HomeSpan Log Level is set to 1 or greater.
To do: DOCUMENT ALL THIS!
If LOG1() or LOG2() is only provided with a SINGLE argument, then Serial.print() is called. This allows you to continue using LOG1() and LOG2() to directly print any variable or object that is handled by Serial.print(), such as an int, double, or even an IPAddress.
If LOG1() or LOG2() is provided with multiple arguments, the first is considered the format and Serial.printf(format...) is called. This allows you to use printf-like functionality within LOG1() and LOG2().
Gets IP address (as char *) of last client to send a request. Useful as part of web log messages. Will return 0.0.0.0 if used outside of any code that is responding to a client request.
Greatly simplifies use interface. No need to specify or save channels. And no need to even save pin number since that can be found using LedPin->getPin() method whenever needed.
Check is not applied to STRING Characteristics. Check is performed at end of each Accessory definition so will account for any changes to min/max as a result of calls to setRange(). If initial value is outside allowable range, a WARNING (not an ERROR) is thrown.
Next TO DO: Complete entry of default min/max into all Characteristics (except BOOL and STRING) defined Span.h so that setRange() error checking works for all Characteristics.
LED_BUILTIN is NOT defined for all ESP32 boards - some do not have a built-in LED! Instead, Status LED now defaults to Pin 13, as opposed to LED_BUILTIN. Also, added a new method, homeSpan.getStatusPin(), to return the pin number used for the Status LED, whether or not it remains the default (13) or is changed by user with homeSpan.setStatusPin(pin). This method is now used in the DEV_Identify.h file for each example, instead of using LED_BUILTIN (which otherwise won't compile for boards without a built-in LED)
button(int pin, boolean isLong) changed to button(int pin, int pressType), where pressType can be SpanButton::LONG, SpanButton::SINGLE, or SpanButton::DOUBLE. Updated Example 16 and confirmed everything works as expected.
To do: Review all prior examples and update SpanButton when needed. Also need to update Zephyr Vent Hood code!
Added ServiceLabelIndex Characteristic, which seems to be required as noted in HAP specifications. However, linking to a ServiceLabel Service does not appear to be required, so there is no need to build any Service-Linking logic into homeSpan - will wait for use-case to be identified.
To do: Add support for double-click to SpanButton, then include in Example 16.
Modified SpanCharacteristic::sprintfAttributes to streamline logic and add special handling for the ProgrammableSwitchEvent Characteristic as required by HAP: the value returned for the database or any read request must be set to null (i.e. "value":null). The only time the real value should be returned is when the device sends a EV/Notify message (when the button is pressed). Verified that the example works as expected!
TO DO: Add functionality to allow for Service Namespace and Index label so that you can have multiple programmable pushbuttons in one service - this requires logic for HAP LINKED SERVICE functionality.