-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
613 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
#pragma region Prolog | ||
/******************************************************************* | ||
$CRT 11 Dez 2024 : hb | ||
$AUT Holger Burkarth | ||
$DAT >>StatelessSwitch.h<< 11 Dez 2024 16:24:30 - (c) proDAD | ||
*******************************************************************/ | ||
#pragma endregion | ||
#pragma region Spelling | ||
// Ignore Spelling: | ||
#pragma endregion | ||
#pragma region Description | ||
/* | ||
--EN-- | ||
--DE-- | ||
*/ | ||
#pragma endregion | ||
#pragma region Includes | ||
#include <HomeKit_Switch.h> | ||
|
||
using namespace HBHomeKit; | ||
using namespace HBHomeKit::Switch; | ||
#pragma endregion | ||
|
||
#pragma region PIN Config | ||
|
||
/* | ||
* @brief | ||
*/ | ||
#define SWITCHER_PIN D7 | ||
|
||
|
||
#pragma endregion | ||
|
||
#pragma region HomeKit Config | ||
|
||
/* | ||
* @brief A HomeKit device service contains the basic information of the device | ||
* @note The device name is also used to create the Bonjour service name. | ||
*/ | ||
const CDeviceService Device | ||
{ | ||
{ | ||
.DeviceName{"Switch"}, // available as http://Switch.local | ||
/* | ||
* ... more optional device information: You can read more about the CDeviceService in hb_homekit.h | ||
*/ | ||
} | ||
}; | ||
|
||
|
||
/* | ||
* @brief Switcher as a service for HomeKit | ||
*/ | ||
CStatelessSwitchService StatelessSwitch | ||
({ | ||
.Name = "SlessSwitch", | ||
}); | ||
|
||
/* | ||
* @brief HomeKit provides everything you need to interact with Apple HomeKit and host a homepage. | ||
*/ | ||
CHomeKit HomeKit | ||
( | ||
Device, | ||
homekit_accessory_category_programmable_switch, | ||
&StatelessSwitch | ||
); | ||
|
||
CPrgSwitchEventHandler gbEventHandler(SWITCHER_PIN, StatelessSwitch); | ||
|
||
#pragma endregion | ||
|
||
|
||
#pragma region setup | ||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
delay(500); // Important for ESP32: Wait until the serial interface is ready | ||
Serial.println("\n\n\nEnter Setup"); | ||
|
||
// Installs and configures everything for Switcher. | ||
InstallVarsAndCmds(HomeKit); | ||
AddMenuItems(HomeKit); | ||
gbEventHandler.Setup(HomeKit); | ||
|
||
// Adds a menu (WiFi) that allows the user to connect to a WiFi network. | ||
AddWiFiLoginMenu(HomeKit); | ||
|
||
// Adds standard menu items to the controller. | ||
AddStandardMenus(HomeKit); | ||
|
||
// Installs the action UI, required for garage/WiFi web-pages. | ||
InstallActionUI(HomeKit); | ||
|
||
// Starts HomeKit | ||
if(!HomeKit.Setup()) | ||
{ | ||
ERROR("HomeKit setup failed"); | ||
return; | ||
} | ||
|
||
INFO("Setup finished"); | ||
} | ||
|
||
#pragma endregion | ||
|
||
#pragma region loop | ||
void loop() | ||
{ | ||
HomeKit.Loop(); | ||
} | ||
|
||
#pragma endregion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/******************************************************************* | ||
$CRT 11 Dez 2024 : hb | ||
$AUT Holger Burkarth | ||
$DAT >>StatelessSwitch.ino<< 11 Dez 2024 16:24:43 - (c) proDAD | ||
*******************************************************************/ | ||
/* | ||
* The source code has been moved to a .h file to take advantage | ||
* of syntax highlighting and other features of preferred IDEs | ||
* such as Visual Studio. | ||
*/ | ||
#include "StatelessSwitch.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.