Commit Graph

83 Commits

Author SHA1 Message Date
Gregg 3edc30222f Updated Example 12 to demonstrate negative temperatures
Use SpanRange() to change HAP default range of 0-100 to -50 to 100.  Change starting temp +30 and have it reset to -30 after hitting +35.
2021-02-22 20:27:42 -06:00
Gregg c52ae7bdfe Update 17-LinkedServices.ino 2021-02-15 20:38:32 -06:00
Gregg 2e3f90851a Create 17-LinkedServices.ino 2021-02-15 19:40:07 -06:00
Gregg b8d4940772 Removed use of LED_BUILTIN in library and all examples
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)
2021-01-09 12:51:35 -06:00
Gregg 8dc8a0bc48 Update 01-SimpleLightBulb.ino
Changed comments to reflect requirement that AccessoryInformation Service be defined before any other Services in an Accessory.
2020-12-27 12:58:00 -06:00
Gregg 69057d560a Converted `char *` to `const char *` in DEV_Identify() 2020-12-27 09:38:12 -06:00
Gregg 5468f8e89e Set architecture=esp32 in library.properties.
Also fixed some comments in Example 15.
2020-11-27 23:21:43 -06:00
Gregg 5585765a48 Updated comments in some examples. 2020-11-23 08:33:39 -06:00
Gregg 2a7ae8cf78 Update 06-DimmableLED.ino 2020-11-21 22:24:05 -06:00
Gregg bca25b6a72 Updating docs 2020-11-14 16:13:37 -06:00
Gregg b6c5a6b68d Added License Info to all files 2020-11-02 20:09:09 -06:00
Gregg d45f210c5b Completed comments for Example 16 and confirmed all functionality. 2020-11-01 21:10:35 -06:00
Gregg c153824b95 Updated SpanButton Examples
And re-worked the logic in Example 15 to make full use of DOUBLE press functionality.  To Do:  Add commentary to Example 16.
2020-11-01 15:22:16 -06:00
Gregg e2f11630fa Updated SpanButtton to recognize new Double Press event
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!
2020-11-01 12:21:34 -06:00
Gregg f0f761c143 Extended Exmaple 16 to use two Stateless Programmable Switches
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.
2020-10-31 15:53:06 -05:00
Gregg 3979498b3c Created Example 16 - Programmable Pushbutton
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.
2020-10-31 09:35:42 -05:00
Gregg 22962ebfe3 Moved Zephyr into a standalone repository; Re-organized tutorials
Zephyr3, the latest version, was moved into its own repo and renamed ZephyrVentHood.

Deleted Zephyr1, Zephyr2, and Zephyr3, which are no longer needed.

Flattened folder structure for Examples and placed them all in top-level directory
2020-10-04 11:00:08 -05:00
Gregg b06dadc6a1 Updated commentary in Example 15 to reflect new logic for LONG presses
Changed commentary to explain that Long Presses do NOT need to have the button released, AND a LONG press will repeat if the button is held.
2020-10-03 19:33:01 -05:00
Gregg 7ecff55f9c Updated PushButton() so that longPresses always repeat
No need for any new methods - default is now that longPress repeats every longTime milliseconds provided button continues to be held down.  Once a longPress is triggered, a shortPress will not be triggered until button is released.
2020-10-03 12:02:57 -05:00
Gregg 77c48dcf46 Updated SpanButton to use Utils::PushButton
SpanButton now instantiates PushButton instead of keeping track of its own triggering logic.  This means that SpanButton longPress() is triggered by holding down the button for longTime WITHOUT the need to release.  This is a desired change.

Next:  Must update Example 15 to state that SpanButtons trigger a long press withouth needing to be released.

To do:  Consider adding a "repeating mode" for longPress in which the SpanButton re-triggers every longTime while button continues to be pressed.  Best way to implement is probably by creating a PushButton::extend() method.
2020-10-03 10:45:01 -05:00
Gregg 0a5cf52569 Modified Service::update() to return boolean instead of StatusCode
Also moved StatusCode definitions from Settings.h to HAPConstants.h.  There was no reason to have the user return a StatusCode of OK or UNABLE from update() since the only other choice was BUSY and HomeKit does not seem to distinguish errors.  Either it's okay or not okay, which can more easily be represented by a simply return of TRUE or FALSE from update().

The user now needs to know nothing about StatusCodes.   All Examples were modified to change StatusCode update() to boolean update() and return(StatusCode:OK) to return (true).

Much simpler.
2020-10-01 21:41:26 -05:00
Gregg 301c7dc652 Updated Example 9
Change VERBOSITY to new setLogLevel() framework.
2020-09-28 18:47:09 -05:00
Gregg 7d8a91f13b Updated prior Examples and eliminated ServiceType 2020-09-27 17:42:56 -05:00
Gregg fa8c5934ea Eliminated ServiceType from Library and Example 11
Next up - update Examples 12+ to delete ServiceType
2020-09-27 15:56:48 -05:00
Gregg 8c8168fe34 Update ZephyrHood3.ino
Switched pins for fan<->light
2020-08-26 17:45:00 -05:00
Gregg 30905c4ade Completed Zephyr3
Logic simplified and more robust, but brightness is NOT tracked.  Good compromise.
2020-08-24 12:15:03 -05:00
Gregg 7987cdaf48 FInal Version of Zephyr2
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.
2020-08-24 07:42:50 -05:00
Gregg e5fd2a200f Update DEV_Zephyr.h 2020-08-23 20:37:11 -05:00
Gregg 35280ccf53 Created Zephyr2
Create logic to track whether fan and light is on, withouth needing to rely on emulated pushbuttons.
2020-08-23 18:57:11 -05:00
Gregg 054d4dbf64 Completed Zephyr Vent Hood Example 2020-08-23 13:03:14 -05:00
Gregg 9f7e9a51e5 Created Zephyr Vent Hood Example 2020-08-23 08:21:56 -05:00
Gregg e298f32cbf Completed Example 15
All commentary finsihed.
2020-08-21 09:30:59 -05:00
Gregg f056b6ae82 Completed SpanButton()
And finished code for Example 15 to verify SpanButton() works as expected.  To Do: add comments and notes to Example 15.
2020-08-20 21:39:13 -05:00
Gregg c997ca3462 Created Example 15
Initial implementation of SpanButton PushButton object and check() logic
2020-08-20 07:29:15 -05:00
Gregg 9bbea69816 Re-organized Example Files into Tutorial Subfolders 2020-08-18 20:53:22 -05:00
Gregg 7fd21f2bed Completed Example 13
Fully documented Garage Door Opener and motorized Window Shade examples.
2020-08-18 20:36:40 -05:00
Gregg 258882fe6d Renamed Example 14 to EmulatePushButton
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!
2020-08-17 21:42:58 -05:00
Gregg a905ac4ef3 Renumbered Examples
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.
2020-08-17 07:14:01 -05:00
Gregg d5ff5c506d Example 10NEW -> Example 14
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
2020-08-17 07:00:47 -05:00
Gregg 6e8e11b0b1 Created modified 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.
2020-08-16 22:00:13 -05:00
Gregg 9cecc0a31a Updated 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.
2020-08-16 21:46:58 -05:00
Gregg 53f51cc11b Created new framework for Service loops()
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()
2020-08-16 08:45:24 -05:00
Gregg e3d1a9b566 Added Window Shade to Example 14 2020-08-14 18:44:45 -05:00
Gregg ffb7b7ed87 Updated putCharacteristics to use Timed Writes
Must next create small routine to clean up expire PIDs - something like: clearPIDs()
2020-08-14 09:59:48 -05:00
Gregg 5da5bd31a1 Created Example 14
Ack!  Doors seem to need TIMED WRITES.  Must implement that next.
2020-08-13 18:27:43 -05:00
Gregg b529956b5f Completed Example 13
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.
2020-08-13 09:41:16 -05:00
Gregg 14bf85c7a1 More updates to Example 13 2020-08-13 06:19:18 -05:00
Gregg 7028fffaaf Updating Example 13 2020-08-12 22:00:50 -05:00
Gregg 56225b1018 updated Example 13
Moved "new SpanEvent" into DEV_Sensors.h and verified it works fine.
2020-08-11 21:55:49 -05:00
Gregg 698592b7a3 Updated checkTimedResets()
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.
2020-08-11 21:26:13 -05:00