Includes abilty to change brightness of light through HomeKit as well as with button. However, the vent light is too unstable to do this perfectly, and increasing brightness by stepping through multiple decreases is annoying. To do: Create Zephyr3 without brightness control and test to see how it works in practice.
AND updated Example 13 to reflect new loop() framework in place of SpanEvents. ALSO found a bunch of inconsistencies with WindowCovering HAP documentation. PositonState and HoldPosition are NOT used by HomeKit. However, HomeKit has a full slider for controlling shades which makes a Hold Button no longer needed. See Example 13 for details. Open to do: add commentary to Example 13 and eliminate SpanEvents from library!
Renumbered Example 11 (RGB_LED) to Example 10; Example 12 (ServiceOptions) to Example 11; Example 13 (ServiceLoops) to Example 12; and Example 14 (TargetStates) to Example 13. Example 14 is now the PushButton example (previously the TimedReset Example).
To do: Must update Door and Window code in Example 13 (TargetStates) to utilize new loop() framework. Must also delete all references to TimedResets in library code.
Updated Example 10NEW to fully reflect the use of loop() methods instead of TimedResets to emulate a push button. Renamed Example 10 to Example 14, since it must come after we introduce loops(). Deleted both original Example 10 and Example 10NEW
This uses loop() method to auto-reset the blinking LED controller after 3 seconds instead of requiring the use of a TimedReset object. To do: eliminate all TimedReset code as it is no longer needed. Will also need to renumber examples, since new Example 10 uses loop() which is not introduced until after current Example 13.
Completed new framework for using loop() methods and deleted all code related to new SpanEvent() and event() loops. Re-worked Example 13 to utilize new framework and validated it functions as expected.
Service loops() called for only those Services with over-ridden loop() methods. TO DO: update event logic to follow new framework. Vector should point to all CHARACTERISTICS that are updated to setVal()
Added detailed notes section to further explain all processes related to Event Notifications. Foreshadowed next example, which will be a Service supporting current and target state characteristics.
converted checkedTimeResets() from two-pass logic that first computes the required size of SpanBuf to a single-pass that utilizes vector<SpanBuf> instead. Much cleaner and easier.
checkEvents() now allows for multiple characteristics to be updated by service->notify(). This change included the use of vector<SpanBuf> to dynamically create the the temporary storage needed. To do: re-work similar routines to use vector<SpanBuf> instead of needing to perform two passes each time to gauge size of SpanBuf array needed.
creating code to allow for multiple characteristics to be updated within event() call. To Do: define anogther sensor that supports multiple characteristics. also need to check that "new SpanEvent" works as expected from within a defined service.
Transtioned to all getter methods: getVal(), getNewVal(), updated(), using templates for all floats.
Finalized templates for getVal and getNewVal, including making <int> default so it does not have to be set for most getVal() and getNewVal() calls. Works for booleans as well. TO DO: Re-work and check ALL prior examples to ensure they use getVal, etc., and DON'T access value, newValue, isUpdated, directly.