HomeSpan/examples/Advanced/12-ServiceOptions/12-ServiceOptions.ino

65 lines
2.4 KiB
C++

////////////////////////////////////////////////////////////
// //
// HomeSpan: A HomeKit implementation for the ESP32 //
// ------------------------------------------------ //
// //
// Example 12: Service Options: //
// * setting the Primary Service //
// * setting Service Names //
// //
////////////////////////////////////////////////////////////
#include "HomeSpan.h"
#include "DEV_LED.h"
#include "DEV_Identify.h"
void setup() {
// Example 12...
Serial.begin(115200);
homeSpan.begin(Category::Lighting,"HomeSpan LEDs");
new SpanAccessory();
new DEV_Identify("Bridge #1","HomeSpan","123-ABC","HS Bridge","0.9",3);
new Service::HAPProtocolInformation();
new Characteristic::Version("1.1.0");
new SpanAccessory();
new DEV_Identify("Ceiling Fan #1","HomeSpan","123-ABC","20mA LED","0.9",0);
new DEV_DimmableLED(0,17,ServiceType::Primary);
new Service::Fan();
new Characteristic::Active();
new Characteristic::RotationDirection();
new Characteristic::RotationSpeed(0);
new SpanAccessory();
new DEV_Identify("Ceiling Fan #2","HomeSpan","123-ABC","20mA LED","0.9",0);
new DEV_DimmableLED(0,17);
new Service::Fan(ServiceType::Primary);
new Characteristic::Active();
new Characteristic::RotationDirection();
new Characteristic::RotationSpeed(0);
new SpanAccessory();
new DEV_Identify("Ceiling Fan #3","HomeSpan","123-ABC","20mA LED","0.9",0);
new DEV_DimmableLED(0,17);
new Characteristic::Name("Main Light");
new Service::Fan(ServiceType::Primary);
new Characteristic::Active();
new Characteristic::RotationDirection();
new Characteristic::RotationSpeed(0);
new Characteristic::Name("Fan");
} // end of setup()
//////////////////////////////////////
void loop(){
homeSpan.poll();
} // end of loop()