Updated Examples 18 and 19
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 commit is contained in:
parent
2b669022ec
commit
78ddd8a330
|
|
@ -35,6 +35,12 @@
|
|||
// //
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
// WARNING: THIS EXAMPLE STOPPED WORKING CORRECTLY SOMEWHERE AROUND THE IOS 15.2 OR IOS 15.3 UPDATE
|
||||
// AND DOES NOT WORK AS OF IOS 15.4.1
|
||||
//
|
||||
// THE PROBLEM APPEARS TO BE IN THE RENDERING OF INDIVIDUAL VALVES IN THE HOME APP INTERFACE. THEY
|
||||
// APPEAR IN THE EVE HOMEKIT APPLICATION, BUT NOT APPLE'S HOME APP.
|
||||
|
||||
#include "HomeSpan.h"
|
||||
|
||||
// HAP normally treats multiple Services created within the same Accessory as independent of one another. However, certain HAP Services are designed to represent a central point
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*********************************************************************************
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2021 Gregg E. Berman
|
||||
* Copyright (c) 2021-2022 Gregg E. Berman
|
||||
*
|
||||
* https://github.com/HomeSpan/HomeSpan
|
||||
*
|
||||
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
#include "HomeSpan.h"
|
||||
#include "DEV_LED.h"
|
||||
#include "DEV_Identify.h"
|
||||
|
||||
void setup() {
|
||||
|
||||
|
|
@ -76,16 +75,19 @@ void setup() {
|
|||
homeSpan.begin(Category::Bridges,"HomeSpan Bridge");
|
||||
|
||||
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 Service::AccessoryInformation();
|
||||
new Characteristic::Identify();
|
||||
|
||||
new SpanAccessory();
|
||||
new DEV_Identify("LED 1","HomeSpan","123-ABC","20mA LED","0.9",0);
|
||||
new Service::AccessoryInformation();
|
||||
new Characteristic::Identify();
|
||||
new Characteristic::Name("LED 1");
|
||||
new DEV_DimmableLED(17,19); // The first argument specifies the LED pin; the second argument specifies the PushButton pin
|
||||
|
||||
new SpanAccessory();
|
||||
new DEV_Identify("LED 2","HomeSpan","123-ABC","20mA LED","0.9",0);
|
||||
new Service::AccessoryInformation();
|
||||
new Characteristic::Identify();
|
||||
new Characteristic::Name("LED 2");
|
||||
new DEV_DimmableLED(16,18); // The first argument specifies the LED pin; the second argument specifies the PushButton pin
|
||||
|
||||
} // end of setup()
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
|
||||
//////////////////////////////////
|
||||
// DEVICE-SPECIFIC SERVICES //
|
||||
//////////////////////////////////
|
||||
|
||||
struct DEV_Identify : Service::AccessoryInformation {
|
||||
|
||||
int nBlinks; // number of times to blink built-in LED in identify routine
|
||||
SpanCharacteristic *identify; // reference to the Identify Characteristic
|
||||
|
||||
DEV_Identify(const char *name, const char *manu, const char *sn, const char *model, const char *version, int nBlinks) : Service::AccessoryInformation(){
|
||||
|
||||
new Characteristic::Name(name); // create all the required Characteristics with values set based on above arguments
|
||||
new Characteristic::Manufacturer(manu);
|
||||
new Characteristic::SerialNumber(sn);
|
||||
new Characteristic::Model(model);
|
||||
new Characteristic::FirmwareRevision(version);
|
||||
identify=new Characteristic::Identify(); // store a reference to the Identify Characteristic for use below
|
||||
|
||||
this->nBlinks=nBlinks; // store the number of times to blink the LED
|
||||
|
||||
pinMode(homeSpan.getStatusPin(),OUTPUT); // make sure LED is set for output
|
||||
}
|
||||
|
||||
boolean update(){
|
||||
|
||||
for(int i=0;i<nBlinks;i++){
|
||||
digitalWrite(homeSpan.getStatusPin(),LOW);
|
||||
delay(250);
|
||||
digitalWrite(homeSpan.getStatusPin(),HIGH);
|
||||
delay(250);
|
||||
}
|
||||
|
||||
return(true); // return true
|
||||
|
||||
} // update
|
||||
|
||||
};
|
||||
|
|
@ -60,36 +60,22 @@ void setup() {
|
|||
|
||||
// Note the rest of the sketch below is identical to Example 5. All of the Web Logging occurs in DEV_LED.h
|
||||
|
||||
homeSpan.begin(Category::Lighting,"HomeSpan LEDs");
|
||||
homeSpan.begin(Category::Lighting,"HomeSpan LEDs"); // Note we can set Category to Lighting even if device is configured as a Bridge
|
||||
|
||||
new SpanAccessory();
|
||||
|
||||
new Service::AccessoryInformation();
|
||||
new Characteristic::Name("LED #1");
|
||||
new Characteristic::Manufacturer("HomeSpan");
|
||||
new Characteristic::SerialNumber("123-ABC");
|
||||
new Characteristic::Model("20mA LED");
|
||||
new Characteristic::FirmwareRevision("0.9");
|
||||
new Characteristic::Identify();
|
||||
|
||||
new Service::HAPProtocolInformation();
|
||||
new Characteristic::Version("1.1.0");
|
||||
|
||||
new SpanAccessory();
|
||||
new Service::AccessoryInformation();
|
||||
new Characteristic::Identify();
|
||||
new Characteristic::Name("LED #1");
|
||||
new DEV_LED(16);
|
||||
|
||||
new SpanAccessory();
|
||||
|
||||
new Service::AccessoryInformation();
|
||||
new Characteristic::Name("LED #2");
|
||||
new Characteristic::Manufacturer("HomeSpan");
|
||||
new Characteristic::SerialNumber("123-ABC");
|
||||
new Characteristic::Model("20mA LED");
|
||||
new Characteristic::FirmwareRevision("0.9");
|
||||
new Characteristic::Identify();
|
||||
|
||||
new Service::HAPProtocolInformation();
|
||||
new Characteristic::Version("1.1.0");
|
||||
|
||||
new Characteristic::Name("LED #2");
|
||||
new DEV_LED(17);
|
||||
|
||||
} // end of setup()
|
||||
|
|
|
|||
Loading…
Reference in New Issue