From a3846901e784d979f7dfffb3f0ad7484e922b81d Mon Sep 17 00:00:00 2001 From: Gregg Date: Sun, 4 Feb 2024 14:10:55 -0600 Subject: [PATCH] Revised Example 11 (Service Names) to use ConfiguredName Characteristic Complete re-work of Example 11 - fully tested for iOS 17.2.1 --- docs/ServiceList.md | 126 ++++++------- examples/11-ServiceNames/11-ServiceNames.ino | 179 ++++++++++--------- src/Span.h | 30 ++-- src/src.ino | 13 +- 4 files changed, 181 insertions(+), 167 deletions(-) diff --git a/docs/ServiceList.md b/docs/ServiceList.md index 8fde451..abff6e9 100644 --- a/docs/ServiceList.md +++ b/docs/ServiceList.md @@ -32,7 +32,7 @@ The pre-defined constant expressions for enumerated Characteristics are in names Required Identification Information. For each Accessory in a HomeSpan device this must be included as the first Service.
- + @@ -47,7 +47,7 @@ The pre-defined constant expressions for enumerated Characteristics are in names - +
CharacteristicFormatPermsMinMaxConstants/Defaults
Identify (14) :small_blue_diamond:
  • triggers an update when HomeKit wants HomeSpan to run its identification routine for an Accessory
boolPW11
  • RUN_ID (1) 
Name (23)
  • name of the Accessory when displayed in the Home App
stringPR--"unnamed"
Name (23)
  • default display name of the Accessory
stringPR--"unnamed"
FirmwareRevision (52)
  • must be in form x[.y[.z]] - informational only
stringPR+EV--"1.0.0"
Manufacturer (20)
  • any string - informational only
stringPR--"HomeSpan"
Model (21)
  • any string - informational only
stringPR--"HomeSpan-ESP32"
BatteryLevel (68) :small_blue_diamond:
  • measured as a percentage
uint8PR+EV0100100
ChargingState (8F) :small_blue_diamond:
  • indicates state of battery charging
uint8PR+EV02
  • NOT_CHARGING (0) :heavy_check_mark:
  • CHARGING (1) 
  • NOT_CHARGEABLE (2) 
StatusLowBattery (79) :small_blue_diamond:
  • indicates state of battery
uint8PR+EV01
  • NOT_LOW_BATTERY (0) :heavy_check_mark:
  • LOW_BATTERY (1) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

### LightBulb (43) @@ -58,15 +58,15 @@ The pre-defined constant expressions for enumerated Characteristics are in names Hue (13) floatPR+PW+EV03600 Saturation (2F) floatPR+PW+EV01000 ColorTemperature (CE) uint32PR+PW+EV140500200 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### Outlet (47) - Defines an controllable Outlet used to power any light or appliance.
+ Defines a controllable Outlet used to power any light or appliance.
- +
CharacteristicFormatPermsMinMaxConstants/Defaults
On (25) :small_blue_diamond:
  • indicates if the Service is active/on
boolPR+PW+EV01
  • OFF (0) :heavy_check_mark:
  • ON (1) 
OutletInUse (26) :small_blue_diamond:
  • indicates if an appliance or light is plugged into the outlet, regardless of whether on or off
boolPR+EV01
  • NOT_IN_USE (0) :heavy_check_mark:
  • IN_USE (1) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

### StatelessProgrammableSwitch (89) @@ -80,24 +80,24 @@ The pre-defined constant expressions for enumerated Characteristics are in names Defines a generic Switch.
- +
CharacteristicFormatPermsMinMaxConstants/Defaults
On (25) :small_blue_diamond:
  • indicates if the Service is active/on
boolPR+PW+EV01
  • OFF (0) :heavy_check_mark:
  • ON (1) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

## HEATING, VENTILATION, AND AIR CONDITIONING (HVAC) ### AirPurifier (BB) - Defines a basic Air Purifier with an optional fan. Optional Linked Services: FilterMaintenance, AirQualitySensor, Fan, and Slat
+ Defines a basic Air Purifier with an optional fan and swing mode. Optional Linked Services: FilterMaintenance. Combine with an AirSensor Service for automated operations.
- + - +
CharacteristicFormatPermsMinMaxConstants/Defaults
Active (B0) :small_blue_diamond:
  • indicates if the Service is active/on
uint8PW+PR+EV01
  • INACTIVE (0) :heavy_check_mark:
  • ACTIVE (1) 
CurrentAirPurifierState (A9) :small_blue_diamond:
  • indicates current state of air purification
uint8PR+EV02
  • INACTIVE (0) 
  • IDLE (1) :heavy_check_mark:
  • PURIFYING (2) 
CurrentAirPurifierState (A9) :small_blue_diamond:
  • indicates current state of air purification
uint8PR+EV02
  • INACTIVE (0) :heavy_check_mark:
  • IDLE (1) 
  • PURIFYING (2) 
TargetAirPurifierState (A8) :small_blue_diamond:
  • indicates desired state of air purifier
uint8PW+PR+EV01
  • MANUAL (0) 
  • AUTO (1) :heavy_check_mark:
RotationSpeed (29)
  • measured as a percentage
floatPR+PW+EV01000
SwingMode (B6)
  • indicates whether swing-mode is enabled
uint8PR+EV+PW01
  • SWING_DISABLED (0) :heavy_check_mark:
  • SWING_ENABLED (1) 
LockPhysicalControls (A7)
  • indicates if local control lock is enabled
uint8PW+PR+EV01
  • CONTROL_LOCK_DISABLED (0) :heavy_check_mark:
  • CONTROL_LOCK_ENABLED (1) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

### Fan (B7) - Defines a Fan. Can be used in conjunction with a LightBulb Service to create a Lighted Ceiling Fan.
+ Defines a Fan. Combine with a LightBulb Service to create a Lighted Ceiling Fan.
@@ -106,20 +106,20 @@ The pre-defined constant expressions for enumerated Characteristics are in names - +
CharacteristicFormatPermsMinMaxConstants/Defaults
Active (B0) :small_blue_diamond:
  • indicates if the Service is active/on
uint8PW+PR+EV01
  • INACTIVE (0) :heavy_check_mark:
  • ACTIVE (1) 
CurrentFanState (AF)
  • indicates current state of a fan
uint8PR+EV02
  • INACTIVE (0) 
  • IDLE (1) :heavy_check_mark:
  • BLOWING (2) 
RotationSpeed (29)
  • measured as a percentage
floatPR+PW+EV01000
SwingMode (B6)
  • indicates whether swing-mode is enabled
uint8PR+EV+PW01
  • SWING_DISABLED (0) :heavy_check_mark:
  • SWING_ENABLED (1) 
LockPhysicalControls (A7)
  • indicates if local control lock is enabled
uint8PW+PR+EV01
  • CONTROL_LOCK_DISABLED (0) :heavy_check_mark:
  • CONTROL_LOCK_ENABLED (1) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

### FilterMaintenance (BA) - Defines a Filter Maintainence check.
+ Defines a Filter Maintainence check. Use only as a Linked Service for the AirPurifier Service.
- - - + + +
CharacteristicFormatPermsMinMaxConstants/Defaults
FilterChangeIndication (AC) :small_blue_diamond:
  • indicates state of filter
uint8PR+EV01
  • NO_CHANGE_NEEDED (0) :heavy_check_mark:
  • CHANGE_NEEDED (1) 
FilterLifeLevel (AB)
  • measures as a percentage of remaining life
floatPR+EV01000
ResetFilterIndication (AD)
  • triggers and update when the user chooses to reset the FilterChangeIndication from the Home App
uint8PW11
  • RESET_FILTER (1) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
FilterLifeLevel (AB)
  • measured as a percentage of remaining life
floatPR+EV0100100
ResetFilterIndication (AD)
  • triggers an update when the user chooses to reset the FilterChangeIndication (only appears in Eve App, not Home App)
uint8PW11
  • RESET_FILTER (1) 
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

### HeaterCooler (BC) - Defines a standalone Heater, Cooler, or combined Heater/Cooler. Can be used with a separate Fan Service and/or Slat Service to extend functionality.
+ Defines a standalone Heater, Cooler, or combined Heater/Cooler.
@@ -131,11 +131,11 @@ The pre-defined constant expressions for enumerated Characteristics are in names - +
CharacteristicFormatPermsMinMaxConstants/Defaults
Active (B0) :small_blue_diamond:
  • indicates if the Service is active/on
uint8PW+PR+EV01
  • INACTIVE (0) :heavy_check_mark:
  • ACTIVE (1) 
CurrentTemperature (11) :small_blue_diamond:
  • current temperature measured in Celsius
floatPR+EV01000
CoolingThresholdTemperature (D)
  • cooling turns on when temperature (in Celsius) rises above this threshold
floatPR+PW+EV103510
HeatingThresholdTemperature (12)
  • heating turns on when temperature (in Celsius) falls below this threshold
floatPR+PW+EV02516
LockPhysicalControls (A7)
  • indicates if local control lock is enabled
uint8PW+PR+EV01
  • CONTROL_LOCK_DISABLED (0) :heavy_check_mark:
  • CONTROL_LOCK_ENABLED (1) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

### HumidifierDehumidifier (BD) - Defines a Humidifer, Dehumidifier, or combined Humidifer/Dehumidifier. Can be used with a separate Fan Service and/or Slat Service to extend functionality.
+ Defines a Humidifer, Dehumidifier, or combined Humidifer/Dehumidifier.
@@ -147,7 +147,7 @@ The pre-defined constant expressions for enumerated Characteristics are in names - +
CharacteristicFormatPermsMinMaxConstants/Defaults
Active (B0) :small_blue_diamond:
  • indicates if the Service is active/on
uint8PW+PR+EV01
  • INACTIVE (0) :heavy_check_mark:
  • ACTIVE (1) 
CurrentRelativeHumidity (10) :small_blue_diamond:
  • current humidity measured as a percentage
floatPR+EV01000
SwingMode (B6)
  • indicates whether swing-mode is enabled
uint8PR+EV+PW01
  • SWING_DISABLED (0) :heavy_check_mark:
  • SWING_ENABLED (1) 
WaterLevel (B5)
  • measured as a percentage
floatPR+EV01000
LockPhysicalControls (A7)
  • indicates if local control lock is enabled
uint8PW+PR+EV01
  • CONTROL_LOCK_DISABLED (0) :heavy_check_mark:
  • CONTROL_LOCK_ENABLED (1) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

### Slat (B9) @@ -158,7 +158,7 @@ The pre-defined constant expressions for enumerated Characteristics are in names SwingMode (B6) uint8PR+EV+PW01 CurrentTiltAngle (C1) intPR+EV-90900 TargetTiltAngle (C2) intPW+PR+EV-90900 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### Thermostat (4A) @@ -173,7 +173,7 @@ The pre-defined constant expressions for enumerated Characteristics are in names CurrentRelativeHumidity (10) floatPR+EV01000 HeatingThresholdTemperature (12) floatPR+PW+EV02516 TargetRelativeHumidity (34) floatPW+PR+EV01000 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
## STANDALONE SENSORS @@ -188,10 +188,10 @@ The pre-defined constant expressions for enumerated Characteristics are in names PM10Density (C7) floatPR+EV010000 VOCDensity (C8) floatPR+EV010000 StatusActive (75) boolPR+EV01 -StatusFault (77) uint8PR+EV01 +StatusFault (77) uint8PR+EV01 StatusTampered (7A) uint8PR+EV01 StatusLowBattery (79) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### CarbonDioxideSensor (97) @@ -201,10 +201,10 @@ The pre-defined constant expressions for enumerated Characteristics are in names CarbonDioxideLevel (93) floatPR+EV01000000 CarbonDioxidePeakLevel (94) floatPR+EV01000000 StatusActive (75) boolPR+EV01 -StatusFault (77) uint8PR+EV01 +StatusFault (77) uint8PR+EV01 StatusTampered (7A) uint8PR+EV01 StatusLowBattery (79) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### CarbonMonoxideSensor (7F) @@ -214,10 +214,10 @@ The pre-defined constant expressions for enumerated Characteristics are in names CarbonMonoxideLevel (90) floatPR+EV01000 CarbonMonoxidePeakLevel (91) floatPR+EV01000 StatusActive (75) boolPR+EV01 -StatusFault (77) uint8PR+EV01 +StatusFault (77) uint8PR+EV01 StatusTampered (7A) uint8PR+EV01 StatusLowBattery (79) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### ContactSensor (80) @@ -225,10 +225,10 @@ The pre-defined constant expressions for enumerated Characteristics are in names CharacteristicFormatPermsMinMaxConstants/Defaults ContactSensorState (6A) :small_blue_diamond:uint8PR+EV01 StatusActive (75) boolPR+EV01 -StatusFault (77) uint8PR+EV01 +StatusFault (77) uint8PR+EV01 StatusTampered (7A) uint8PR+EV01 StatusLowBattery (79) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### HumiditySensor (82) @@ -236,10 +236,10 @@ The pre-defined constant expressions for enumerated Characteristics are in names CharacteristicFormatPermsMinMaxConstants/Defaults CurrentRelativeHumidity (10) :small_blue_diamond:floatPR+EV01000 StatusActive (75) boolPR+EV01 -StatusFault (77) uint8PR+EV01 +StatusFault (77) uint8PR+EV01 StatusTampered (7A) uint8PR+EV01 StatusLowBattery (79) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### LeakSensor (83) @@ -247,10 +247,10 @@ The pre-defined constant expressions for enumerated Characteristics are in names CharacteristicFormatPermsMinMaxConstants/Defaults LeakDetected (70) :small_blue_diamond:uint8PR+EV01 StatusActive (75) boolPR+EV01 -StatusFault (77) uint8PR+EV01 +StatusFault (77) uint8PR+EV01 StatusTampered (7A) uint8PR+EV01 StatusLowBattery (79) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### LightSensor (84) @@ -258,10 +258,10 @@ The pre-defined constant expressions for enumerated Characteristics are in names CharacteristicFormatPermsMinMaxConstants/Defaults CurrentAmbientLightLevel (6B) :small_blue_diamond:floatPR+EV0.00011000001 StatusActive (75) boolPR+EV01 -StatusFault (77) uint8PR+EV01 +StatusFault (77) uint8PR+EV01 StatusTampered (7A) uint8PR+EV01 StatusLowBattery (79) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### MotionSensor (85) @@ -269,10 +269,10 @@ The pre-defined constant expressions for enumerated Characteristics are in names CharacteristicFormatPermsMinMaxConstants/Defaults MotionDetected (22) :small_blue_diamond:boolPR+EV01 StatusActive (75) boolPR+EV01 -StatusFault (77) uint8PR+EV01 +StatusFault (77) uint8PR+EV01 StatusTampered (7A) uint8PR+EV01 StatusLowBattery (79) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### OccupancySensor (86) @@ -280,10 +280,10 @@ The pre-defined constant expressions for enumerated Characteristics are in names CharacteristicFormatPermsMinMaxConstants/Defaults OccupancyDetected (71) :small_blue_diamond:uint8PR+EV01 StatusActive (75) boolPR+EV01 -StatusFault (77) uint8PR+EV01 +StatusFault (77) uint8PR+EV01 StatusTampered (7A) uint8PR+EV01 StatusLowBattery (79) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### SmokeSensor (87) @@ -291,10 +291,10 @@ The pre-defined constant expressions for enumerated Characteristics are in names CharacteristicFormatPermsMinMaxConstants/Defaults SmokeDetected (76) :small_blue_diamond:uint8PR+EV01 StatusActive (75) boolPR+EV01 -StatusFault (77) uint8PR+EV01 +StatusFault (77) uint8PR+EV01 StatusTampered (7A) uint8PR+EV01 StatusLowBattery (79) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### TemperatureSensor (8A) @@ -302,10 +302,10 @@ The pre-defined constant expressions for enumerated Characteristics are in names CharacteristicFormatPermsMinMaxConstants/Defaults CurrentTemperature (11) :small_blue_diamond:floatPR+EV01000 StatusActive (75) boolPR+EV01 -StatusFault (77) uint8PR+EV01 +StatusFault (77) uint8PR+EV01 StatusTampered (7A) uint8PR+EV01 StatusLowBattery (79) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
## DOORS, LOCKS, AND WINDOWS @@ -315,14 +315,14 @@ The pre-defined constant expressions for enumerated Characteristics are in names CurrentPosition (6D) :small_blue_diamond:uint8PR+EV01000 TargetPosition (7C) :small_blue_diamond:uint8PW+PR+EV01000 ObstructionDetected (24) boolPR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### Doorbell (121) Defines a Doorbell. Can be used on a standalone basis or in conjunction with a LockMechanism Service.
- +
CharacteristicFormatPermsMinMaxConstants/Defaults
ProgrammableSwitchEvent (73) :small_blue_diamond:
  • specifies type of button press
uint8PR+EV+NV02
  • SINGLE_PRESS (0) :heavy_check_mark:
  • DOUBLE_PRESS (1) 
  • LONG_PRESS (2) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

### GarageDoorOpener (41) @@ -333,7 +333,7 @@ The pre-defined constant expressions for enumerated Characteristics are in names ObstructionDetected (24) :small_blue_diamond:boolPR+EV01 LockCurrentState (1D) uint8PR+EV03 LockTargetState (1E) uint8PW+PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### LockMechanism (45) @@ -341,7 +341,7 @@ The pre-defined constant expressions for enumerated Characteristics are in names CharacteristicFormatPermsMinMaxConstants/Defaults LockCurrentState (1D) :small_blue_diamond:uint8PR+EV03 LockTargetState (1E) :small_blue_diamond:uint8PW+PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### Window (8B) @@ -350,7 +350,7 @@ The pre-defined constant expressions for enumerated Characteristics are in names CurrentPosition (6D) :small_blue_diamond:uint8PR+EV01000 TargetPosition (7C) :small_blue_diamond:uint8PW+PR+EV01000 ObstructionDetected (24) boolPR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### WindowCovering (8C) @@ -363,7 +363,7 @@ The pre-defined constant expressions for enumerated Characteristics are in names CurrentVerticalTiltAngle (6E) intPR+EV-90900 TargetVerticalTiltAngle (7D) intPW+PR+EV-90900 ObstructionDetected (24) boolPR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
## WATER SYSTEMS @@ -371,8 +371,8 @@ The pre-defined constant expressions for enumerated Characteristics are in names Defines the master control for a multi-Valve appliance. Linked Services: Valve (at least one required), and HeaterCooler (optional).
- - + +
CharacteristicFormatPermsMinMaxConstants/Defaults
Active (B0) :small_blue_diamond:
  • indicates if the Service is active/on
uint8PW+PR+EV01
  • INACTIVE (0) :heavy_check_mark:
  • ACTIVE (1) 
StatusFault (77)
  • indicates whether the Service has a fault
uint8PR+EV01
  • NO_FAULT (0) :heavy_check_mark:
  • FAULT (1) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
StatusFault (77)
  • indicates whether the Service has a fault (only appears in Eve App, not Home App)
uint8PR+EV01
  • NO_FAULT (0) :heavy_check_mark:
  • FAULT (1) 
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

### IrrigationSystem (CF) @@ -382,12 +382,12 @@ The pre-defined constant expressions for enumerated Characteristics are in names ProgramMode (D1) :small_blue_diamond:uint8PR+EV02 InUse (D2) :small_blue_diamond:uint8PR+EV01 RemainingDuration (D4) uint32PR+EV0360060 -StatusFault (77) uint8PR+EV01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +StatusFault (77) uint8PR+EV01 +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
### Valve (D0) - Defines an electronic Valve. Can be used standalone or as a Linked Service in conjunction with the Faucet and IrrigationSystem Services.
+ Defines an electronic Valve. Can be used standalone or as a Linked Service for either a Faucet or IrrigationSystem Service.
@@ -396,20 +396,20 @@ The pre-defined constant expressions for enumerated Characteristics are in names - - + +
CharacteristicFormatPermsMinMaxConstants/Defaults
Active (B0) :small_blue_diamond:
  • indicates if the Service is active/on
uint8PW+PR+EV01
  • INACTIVE (0) :heavy_check_mark:
  • ACTIVE (1) 
InUse (D2) :small_blue_diamond:
  • if Service is set to active, this indictes whether it is currently in use
uint8PR+EV01
  • NOT_IN_USE (0) :heavy_check_mark:
  • IN_USE (1) 
RemainingDuration (D4)
  • duration (in seconds) remaining for Service to be active/on
uint32PR+EV0360060
IsConfigured (D6)
  • indicates if a predefined Service has been configured
uint8PR+EV01
  • NOT_CONFIGURED (0) :heavy_check_mark:
  • CONFIGURED (1) 
ServiceLabelIndex (CB)
  • numerical index used to distinguish multiple copies of the same Service within an Accessory
uint8PR12551
StatusFault (77)
  • indicates whether the Service has a fault
uint8PR+EV01
  • NO_FAULT (0) :heavy_check_mark:
  • FAULT (1) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
StatusFault (77)
  • indicates whether the Service has a fault (only appears in Eve App, not Home App)
uint8PR+EV01
  • NO_FAULT (0) :heavy_check_mark:
  • FAULT (1) 
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

## SECURITY SYSTEMS ### SecuritySystem (7E) - Defines a Security System. Often combined with MotionSensor and ContactSensor Services.
+ Defines a Security System. Often used in combination with MotionSensor and ContactSensor Services.
- + - +
CharacteristicFormatPermsMinMaxConstants/Defaults
SecuritySystemCurrentState (66) :small_blue_diamond:
  • indicates current state of the security system
uint8PR+EV04
  • ARMED_STAY (0) 
  • ARMED_AWAY (1) 
  • ARMED_NIGHT (2) 
  • DISARMED (3) :heavy_check_mark:
  • ALARM_TRIGGERED (4) 
SecuritySystemTargetState (67) :small_blue_diamond:
  • indicates desired state of the security system
uint8PW+PR+EV03
  • ARM_STAY (0) 
  • ARM_AWAY (1) 
  • ARM_NIGHT (2) 
  • DISARM (3) :heavy_check_mark:
SecuritySystemAlarmType (8E)
  • indicates whether alarm was triggered for known reason
uint8PR+EV01
  • KNOWN (0) :heavy_check_mark:
  • UNKNOWN (1) 
StatusFault (77)
  • indicates whether the Service has a fault
uint8PR+EV01
  • NO_FAULT (0) :heavy_check_mark:
  • FAULT (1) 
StatusFault (77)
  • indicates whether the Service has a fault (only appears in Eve App, not Home App)
uint8PR+EV01
  • NO_FAULT (0) :heavy_check_mark:
  • FAULT (1) 
StatusTampered (7A)
  • indicates whether the Service has been tampered with
uint8PR+EV01
  • NOT_TAMPERED (0) :heavy_check_mark:
  • TAMPERED (1) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

## TELEVISIONS @@ -417,7 +417,7 @@ The pre-defined constant expressions for enumerated Characteristics are in names Defines an Input Source for a TV. Use only as a Linked Service for the Television Service.
- + @@ -430,7 +430,7 @@ The pre-defined constant expressions for enumerated Characteristics are in names - +
CharacteristicFormatPermsMinMaxConstants/Defaults
Identifier (E6) :small_blue_diamond:
  • numerical Identifer of the InputSource.
uint32PR02550
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"
IsConfigured (D6)
  • indicates if a predefined Service has been configured
uint8PR+EV01
  • NOT_CONFIGURED (0) :heavy_check_mark:
  • CONFIGURED (1) 
CurrentVisibilityState (135)
  • current visibility of the Service, as selectable on the Settings Page of the Home App
uint8PR+EV01
  • VISIBLE (0) :heavy_check_mark:
  • NOT_VISIBLE (1) 
TargetVisibilityState (134)
  • indicates desired visibility of the Service, as selectable on the Settings Page of the Home App
uint8PW+PR+EV01
  • VISIBLE (0) :heavy_check_mark:
  • NOT_VISIBLE (1) 
ActiveIdentifier (E7)
  • numerical Identifier of the InputSource selected in the Home App.
uint32PW+PR+EV02550
RemoteKey (E1)
  • triggers an update when the corresponding key is pressed in the Remote Control widget on an iPhone
uint8PW415
  • UP (4) 
  • DOWN (5) 
  • LEFT (6) 
  • RIGHT (7) 
  • CENTER (8) 
  • BACK (9) 
  • PLAY_PAUSE (11) 
  • INFO (15) 
PowerModeSelection (DF)
  • when defined, creates a "View TV Settings" button in the Home App that triggers an update to this Characteristic when pressed
uint8PW00
  • VIEW_SETTINGS (0) 
ConfiguredName (E3)
  • name of the Service when displayed in the Home App
stringPW+PR+EV--"unnamed"
ConfiguredName (E3)
  • default display name of this Service
stringPW+PR+EV--"unnamed"

### TelevisionSpeaker (113) @@ -438,12 +438,12 @@ The pre-defined constant expressions for enumerated Characteristics are in names CharacteristicFormatPermsMinMaxConstants/Defaults VolumeControlType (E9) :small_blue_diamond:uint8PR+EV03 VolumeSelector (EA) :small_blue_diamond:uint8PW01 -ConfiguredName (E3) stringPW+PR+EV--"unnamed" +ConfiguredName (E3) stringPW+PR+EV--"unnamed"
## MISCELLANEOUS ### ServiceLabel (CC) - Groups together un-named (or un-nameable) Services by Linking them to this Service. When used, those other Services must each include a ServiceLabelIndex Characteristic with a unique value. Rarely needed.
+ Defines a naming scheme for un-nameable Services, such as a StatelessProgrammableSwitch, by Linking them to this Service. When used, those other Services must each include a ServiceLabelIndex Characteristic with a unique value.
CharacteristicFormatPermsMinMaxConstants/Defaults
ServiceLabelNamespace (CD) :small_blue_diamond:
  • indicates how un-named Services linked together with a ServiceLabel Service should be displayed in the Home App
uint8PR01
  • DOTS (0) 
  • NUMERALS (1) :heavy_check_mark:

diff --git a/examples/11-ServiceNames/11-ServiceNames.ino b/examples/11-ServiceNames/11-ServiceNames.ino index 9547c02..c529843 100644 --- a/examples/11-ServiceNames/11-ServiceNames.ino +++ b/examples/11-ServiceNames/11-ServiceNames.ino @@ -25,33 +25,47 @@ * ********************************************************************************/ -//////////////////////////////////////////////////////////// -// // -// HomeSpan: A HomeKit implementation for the ESP32 // -// ------------------------------------------------ // -// // -// Example 11: Service Names: // -// * setting the names of individual Services // -// * changing the icons in a bridge Accessory // -// // -//////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// // +// HomeSpan: A HomeKit implementation for the ESP32 // +// ------------------------------------------------ // +// // +// Example 11: Service Names: // +// * setting the names of individual Services // +// * "changing" the icons in a bridge Accessory // +// // +//////////////////////////////////////////////////////////////// #include "HomeSpan.h" + // INITIAL NOTE: Apple is constantly updating how the Home App Icons are chosen and how/if/where/when the Names for + // Accessories and Services are displayed. This example has been tested and verified as of iOS 17.2.1. + void setup() { // As described in previous examples, when pairing a device the Home App will choose default names for each // Accessory Tile, unless you override those default names with your own names by adding a Name Characteristic // to the Accessory Information Service for each Accessory (except the first, which is typically the Bridge Accessory). - // The same process holds true for the names of the Services in an Accessory with multiple Services, such as a Ceiling Fan with a Light. - // When pairing, the Home App will choose default names for each Service (such as Fan, Fan 2, Light, Light 2) depending on the types - // of Services included. Similar to the names of Accessory Tiles, you can change the names of individual Services when prompted - // during the pairing process, or at any time after pairing from within the appropriate settings pages in the Home App. More importantly, - // you can override the default Service names generated by the Home App by simply adding the Name Characteristic to any Service. + // The same process holds true for the names of the Services in an Accessory with multiple Services: if a Service is not named, + // the Home App will generate one. You can of course change the names of individual Services when prompted + // during the pairing process, or at any time after pairing from within the appropriate settings pages in the Home App. + + // But more importantly, you can name Services in your sketch so that those name show up when pairing, saving you the need to + // rename them from the settings pages in the Home App. - // However, note that Service names (whether or not overridden) only appear in the Home App if there is a chance of ambiguity, - // such as a Accessory with two Services of the same type. But even if a Service name does not appear in the Home App, + // Whereas we previously used the *Name* Characteristic to provide names for Accessory Tiles, we use the *ConfiguredName* Characteristic + // to provide names for individual Services within each Accessory. + + // One important distinction between Name and ConfigureName is that Name is only used by the Home App during pairing. After that, + // any changes you make to the name of an Accessory Tile from within the Home App are never communicated back to HomeSpan, and any changes + // you might make to those names in your sketch will not be reflected in the Home App unless you unpair and re-pair the device. In contrast, + // ConfiguredName works like any other Characteristic: changes made to ConfiguredName from within a sketch are proporgated to the Home App, + // and any edits you make to a Service's name in the Home App trigger a corresponding call to update() in HomeSpan so HomeSpan and the Home App + // are always in sync with regard to the names of any Services that includes the ConfiguredName Characteristic. + + // NOTE: Service names (whether those generated by the Home App or specified via the ConfiguredName Characteristic) are only displayed on the + // control screen of an Accessory Tile if there are two more more Services of the same type. But even if a Service name does not appear in the Home App, // it will still be used by Siri to control a specific Service within an Accessory by voice. // In the example below we create 5 different functional Accessories, each illustrating how names, as well as icons, are chosen by the Home App @@ -62,103 +76,92 @@ void setup() { homeSpan.begin(Category::Bridges,"HomeSpan Bridge"); - // Our first Accessory is the "Bridge" Accessory + // Our initial Accessory is therefore the "Bridge" Accessory new SpanAccessory(); new Service::AccessoryInformation(); new Characteristic::Identify(); - // Our second Accessory is a Ceiling Fan with a single Light. There are three things to note: - // - // * when pairing, the Home App will generate default names of "Light" and "Fan" for the two Services. - // However, these names are not displayed on the control screen of the Accessory since there is no - // ambiguity between the Light and Fan controls - the Home App displays them differently - // - // * the icon used by the Home App for the Accessory Tile is a Lightbulb. Why does it choose this instead of a Fan icon? - // Recall from Example 3 that for Accessories with multiple Services, if there is any ambiguity of which icon to use, - // the Home App chooses based on the Category of the device. But since this device is configured as a Bridge, the - // Category provides no helpful information to the Home App. In such cases the Home App picks an icon for the - // Accessory Tile that matches the first functional Service in the Accessory, which in this instance in a LightBulb - // - // * when opening the control screen by clicking the Accessory Tile, the LightBulb control will appear on the left, and - // the Fan control will appear on the right + // Our first "functional" Accessory is a combination of a LightBulb, Outlet, and Switch. Note that when pairing, the Home App generates + // default names of "Light", "Outlet", and "Switch" for these three Services, though these names are NOT displayed on the control screen + // of the Accessory since there is only one type of each Service. Also note that the Home App selects a LightBulb icon for the Accessory Tile new SpanAccessory(); new Service::AccessoryInformation(); new Characteristic::Identify(); - new Characteristic::Name("Light with Fan"); // this sets the name of the Accessory Tile - new Service::LightBulb(); // the icon of the Accessory Tile will be a Lightbulb, since this is the first functional Service + new Characteristic::Name("Light First"); // this sets the name of the Accessory Tile + new Service::LightBulb(); // the icon of the Accessory Tile will be a Lightbulb, since this is the first functional Service new Characteristic::On(); - new Service::Fan(); - new Characteristic::Active(); - - // Our third Accessory is identical to the second, except we swapped the order of the Lightbulb and Fan Services. - // The result is that the Home App now displays the Accessory Tile with a Fan icon intead of a Lightbulb icon. - // Also, when opening the control screen by clicking on the Accessory Tile, the Fan control will now appear on the - // left, and the LightBulb control on the right. - - new SpanAccessory(); - new Service::AccessoryInformation(); - new Characteristic::Identify(); - new Characteristic::Name("Fan with Light"); // this sets the name of the Accessory Tile - new Service::Fan(); // the icon of the Accessory Tile will be a Fan, since this is the first functional Service - new Characteristic::Active(); - new Service::LightBulb(); + new Service::Outlet(); + new Characteristic::On(); + new Characteristic::OutletInUse(); + new Service::Switch(); new Characteristic::On(); - // Our fourth Accessory shows what happens if we implement two identical LightBulb Services (without any Fan Service). - // Since both Services are LightBulbs, the Home App sensibly picks a Lightbulb icon for the Accessory Tile. However, - // when you click the Accessory Tile and open the control screen, you'll note that the Home App now does display the names - // of the Service beneath each control. In this case the Home App uses the default names "Light 1" and "Light 2". The Home App - // presumably shows the names of each Service since the two controls are identical and there is otherwise no way of telling which - // control operates which light. - - new SpanAccessory(); + // Our second Accessory is similar to the first, but here we define the Switch Service first. Note that the Home App now selects + // a Switch icon for the Accessory Tile + + new SpanAccessory(); new Service::AccessoryInformation(); new Characteristic::Identify(); - new Characteristic::Name("Ceiling Lights"); // this sets the name of the Accessory Tile - new Service::LightBulb(); + new Characteristic::Name("Switch First"); // this sets the name of the Accessory Tile + new Service::Switch(); // the icon of the Accessory Tile will be a Switch, since this is the first functional Service new Characteristic::On(); - new Service::LightBulb(); + new Service::Outlet(); + new Characteristic::On(); + new Characteristic::OutletInUse(); + new Service::LightBulb(); new Characteristic::On(); - // Our fifth Accessory combines a single Fan Service with two identical LightBulb Services. Since the first functional Service implemented - // is a Fan, the Home App will pick a Fan icon for the Accessory Tile. Also, since we added Name Characteristics to two LightBulb - // Services, their default names generated by the Home App ("Light 1" and "Light 2") will be changed to the names specified. Finally, - // note that the Home App displays a more compact form of controls on the control screen since there are three Services. The arrangement - // and style of the controls will depend on what combination of Characteristics are implemented for each Service. - - new SpanAccessory(); + // Our third Accessory is similar to the second, but here we define 2 Switches, 2 LightBulbs, but still only 1 Outlet. This time, during pairing + // the Home App generates default names of Switch, Switch 2, Light, Light 2, and Outlet. Importantly, note that on the control screen for + // this Accessory, the Home App now displays the names of the Switches ("Switch" and "Switch 2") as well as the LightBulbs ("Light" and "Light 2") + // under each corresponding control, but it does NOT display the name "Outlet" under the Outlet control since there is only one Outlet Service + + new SpanAccessory(); new Service::AccessoryInformation(); new Characteristic::Identify(); - new Characteristic::Name("Fan with Lights"); // this sets the name of the Accessory Tile - new Service::Fan(); - new Characteristic::Active(); - new Service::LightBulb(); - new Characteristic::Name("Main Light"); // this changes the default name of this LightBulb Service from "Light 1" to "Main Light" + new Characteristic::Name("Two Switches"); // this sets the name of the Accessory Tile + new Service::Switch(); // the icon of the Accessory Tile will be a Switch, since this is the first functional Service + new Characteristic::On(); + new Service::Switch(); + new Characteristic::On(); + new Service::Outlet(); new Characteristic::On(); - new Service::LightBulb(); - new Characteristic::Name("Night Light"); // this changes the default name of this LightBulb Service from "Light 2" to "Night Light" + new Characteristic::OutletInUse(); + new Service::LightBulb(); + new Characteristic::On(); + new Service::LightBulb(); new Characteristic::On(); - // Our sixth Accessory is similar to the fifth, except we added some more features to some of the Services. Note how this changes - // the layout of the controls on the control screen. + // Our fourth and final Accessory is the same as the third, but this time we use the ConfiguredName Characteristic to define a name for each Service. + // When pairing, you should see the Home App now uses the names below instead of generating default names as it did in the other examples. You + // should also see these names displayed under each control on the control screen for the Accessory, with the exception of the Outlet Service. + // Though we did provide a name for the Outlet, since there is only one Outlet Service in this Accessory, the Home App does not display its name. + // Howevever, if from the settings screen for this Accessory you further navigate to the "Accessories" page, you will indeed see the names for each + // Service exactly as specified below, including the Outlet name "Aux Power" - new SpanAccessory(); + new SpanAccessory(); new Service::AccessoryInformation(); - new Characteristic::Identify(); - new Characteristic::Name("Multi-Function Fan"); - new Service::Fan(); - new Characteristic::Active(); - new Characteristic::RotationDirection(); // add a control to change the direcion of rotation - new Characteristic::RotationSpeed(0); // add a control to set the rotation speed - new Service::LightBulb(); - new Characteristic::Name("Main Light"); + new Characteristic::Identify(); + new Characteristic::Name("Central Control"); // this sets the name of the Accessory Tile + new Service::Switch(); // the icon of the Accessory Tile will be a Switch, since this is the first functional Service new Characteristic::On(); - new Characteristic::Brightness(100); // make this light dimmable (with intitial value set to 100%) - new Service::LightBulb(); - new Characteristic::Name("Night Light"); // don't add anything new to this light + new Characteristic::ConfiguredName("High Voltage"); // this sets the name of the first Switch Service + new Service::Switch(); + new Characteristic::On(); + new Characteristic::ConfiguredName("Low Voltage"); // this sets the name of the second Switch Service + new Service::Outlet(); new Characteristic::On(); + new Characteristic::OutletInUse(); + new Characteristic::ConfiguredName("Aux Power"); // this sets the name of the Outlet Service + new Service::LightBulb(); + new Characteristic::On(); + new Characteristic::ConfiguredName("Main Lights"); // this sets the name of the first LightBulb Service + new Service::LightBulb(); + new Characteristic::On(); + new Characteristic::ConfiguredName("Accent Lights"); // this sets the name of the second LightBulb Service + } // end of setup() diff --git a/src/Span.h b/src/Span.h index 71dabf0..710779b 100644 --- a/src/Span.h +++ b/src/Span.h @@ -84,7 +84,7 @@ namespace Service { OPT_DEP(Name); END_SERV - CREATE_SERV(Outlet,47) // Defines an controllable Outlet used to power any light or appliance. + CREATE_SERV(Outlet,47) // Defines a controllable Outlet used to power any light or appliance. REQ(On); REQ(OutletInUse); OPT(ConfiguredName); @@ -105,7 +105,7 @@ namespace Service { SERVICES_GROUP // Heating, Ventilation, and Air Conditioning (HVAC) - CREATE_SERV(AirPurifier,BB) // Defines a basic Air Purifier with an optional fan. Optional Linked Services: FilterMaintenance, AirQualitySensor, Fan, and Slat + CREATE_SERV(AirPurifier,BB) // Defines a basic Air Purifier with an optional fan and swing mode. Optional Linked Services: FilterMaintenance. Combine with an AirSensor Service for automated operations. REQ(Active); REQ(CurrentAirPurifierState); REQ(TargetAirPurifierState); @@ -116,7 +116,7 @@ namespace Service { OPT_DEP(Name); END_SERV - CREATE_SERV(Fan,B7) // Defines a Fan. Can be used in conjunction with a LightBulb Service to create a Lighted Ceiling Fan. + CREATE_SERV(Fan,B7) // Defines a Fan. Combine with a LightBulb Service to create a Lighted Ceiling Fan. REQ(Active); OPT(CurrentFanState); OPT(TargetFanState); @@ -128,7 +128,7 @@ namespace Service { OPT_DEP(Name); END_SERV - CREATE_SERV(FilterMaintenance,BA) // Defines a Filter Maintainence check. + CREATE_SERV(FilterMaintenance,BA) // Defines a Filter Maintainence check. Use only as a Linked Service for the AirPurifier Service. REQ(FilterChangeIndication); OPT(FilterLifeLevel); OPT(ResetFilterIndication); @@ -136,7 +136,7 @@ namespace Service { OPT_DEP(Name); END_SERV - CREATE_SERV(HeaterCooler,BC) // Defines a standalone Heater, Cooler, or combined Heater/Cooler. Can be used with a separate Fan Service and/or Slat Service to extend functionality. + CREATE_SERV(HeaterCooler,BC) // Defines a standalone Heater, Cooler, or combined Heater/Cooler. REQ(Active); REQ(CurrentTemperature); REQ(CurrentHeaterCoolerState); @@ -151,7 +151,7 @@ namespace Service { OPT_DEP(Name); END_SERV - CREATE_SERV(HumidifierDehumidifier,BD) // Defines a Humidifer, Dehumidifier, or combined Humidifer/Dehumidifier. Can be used with a separate Fan Service and/or Slat Service to extend functionality. + CREATE_SERV(HumidifierDehumidifier,BD) // Defines a Humidifer, Dehumidifier, or combined Humidifer/Dehumidifier. REQ(Active); REQ(CurrentRelativeHumidity); REQ(CurrentHumidifierDehumidifierState); @@ -391,7 +391,7 @@ namespace Service { OPT_DEP(Name); END_SERV - CREATE_SERV(Valve,D0) // Defines an electronic Valve. Can be used standalone or as a Linked Service in conjunction with the Faucet and IrrigationSystem Services. + CREATE_SERV(Valve,D0) // Defines an electronic Valve. Can be used standalone or as a Linked Service for either a Faucet or IrrigationSystem Service. REQ(Active); REQ(InUse); REQ(ValveType); @@ -406,7 +406,7 @@ namespace Service { SERVICES_GROUP // Security Systems - CREATE_SERV(SecuritySystem,7E) // Defines a Security System. Often combined with MotionSensor and ContactSensor Services. + CREATE_SERV(SecuritySystem,7E) // Defines a Security System. Often used in combination with MotionSensor and ContactSensor Services. REQ(SecuritySystemCurrentState); REQ(SecuritySystemTargetState); OPT(SecuritySystemAlarmType); @@ -442,7 +442,7 @@ namespace Service { SERVICES_GROUP // Miscellaneous - CREATE_SERV(ServiceLabel,CC) // Groups together un-named (or un-nameable) Services by Linking them to this Service. When used, those other Services must each include a ServiceLabelIndex Characteristic with a unique value. Rarely needed. + CREATE_SERV(ServiceLabel,CC) // Defines a naming scheme for un-nameable Services, such as a StatelessProgrammableSwitch, by Linking them to this Service. When used, those other Services must each include a ServiceLabelIndex Characteristic with a unique value. REQ(ServiceLabelNamespace); END_SERV @@ -496,10 +496,10 @@ namespace Characteristic { CREATE_CHAR(double,CoolingThresholdTemperature,10,10,35); // cooling turns on when temperature (in Celsius) rises above this threshold CREATE_CHAR(uint32_t,ColorTemperature,200,140,500); // measured in inverse megaKelvin (= 1,000,000 / Kelvin) CREATE_CHAR(uint8_t,ContactSensorState,1,0,1,DETECTED,NOT_DETECTED); // indictates if contact is detected (i.e. closed) - CREATE_CHAR(const char *,ConfiguredName,"unnamed",0,1); // name of the Service when displayed in the Home App + CREATE_CHAR(const char *,ConfiguredName,"unnamed",0,1); // default display name of this Service CREATE_CHAR(double,CurrentAmbientLightLevel,1,0.0001,100000); // measured in Lux (lumens/m2 CREATE_CHAR(int,CurrentHorizontalTiltAngle,0,-90,90); // current angle (in degrees) of slats from fully up (-90) to fully open (0) to fully down (90) - CREATE_CHAR(uint8_t,CurrentAirPurifierState,1,0,2,INACTIVE,IDLE,PURIFYING); // indicates current state of air purification + CREATE_CHAR(uint8_t,CurrentAirPurifierState,0,0,2,INACTIVE,IDLE,PURIFYING); // indicates current state of air purification CREATE_CHAR(uint8_t,CurrentSlatState,0,0,2,FIXED,JAMMED,SWINGING); // indicates current state of slats CREATE_CHAR(uint8_t,CurrentPosition,0,0,100); // current position (as a percentage) from fully closed (0) to full open (100) CREATE_CHAR(int,CurrentVerticalTiltAngle,0,-90,90); // current angle (in degrees) of slats from fully left (-90) to fully open (0) to fully right (90) @@ -513,7 +513,7 @@ namespace Characteristic { CREATE_CHAR(double,CurrentRelativeHumidity,0,0,100); // current humidity measured as a percentage CREATE_CHAR(double,CurrentTemperature,0,0,100); // current temperature measured in Celsius CREATE_CHAR(int,CurrentTiltAngle,0,-90,90); // current angle (in degrees) of slats from fully up or left (-90) to fully open (0) to fully down or right (90) - CREATE_CHAR(double,FilterLifeLevel,0,0,100); // measures as a percentage of remaining life + CREATE_CHAR(double,FilterLifeLevel,100,0,100); // measured as a percentage of remaining life CREATE_CHAR(uint8_t,FilterChangeIndication,0,0,1,NO_CHANGE_NEEDED,CHANGE_NEEDED); // indicates state of filter CREATE_CHAR(const char *,FirmwareRevision,"1.0.0",0,1); // must be in form x[.y[.z]] - informational only CREATE_CHAR(const char *,HardwareRevision,"1.0.0",0,1); // must be in form x[.y[.z]] - informational only @@ -534,7 +534,7 @@ namespace Characteristic { CREATE_CHAR(const char *,Model,"HomeSpan-ESP32",0,1); // any string - informational only CREATE_CHAR(boolean,MotionDetected,0,0,1,NOT_DETECTED,DETECTED); // indicates if motion is detected CREATE_CHAR(boolean,Mute,0,0,1,OFF,ON); // not used - CREATE_CHAR(const char *,Name,"unnamed",0,1); // name of the Accessory when displayed in the Home App + CREATE_CHAR(const char *,Name,"unnamed",0,1); // default display name of the Accessory CREATE_CHAR(double,NitrogenDioxideDensity,0,0,1000); // measured in µg/m3 CREATE_CHAR(boolean,ObstructionDetected,0,0,1,NOT_DETECTED,DETECTED); // indicates if obstruction is detected CREATE_CHAR(double,PM25Density,0,0,1000); // 2.5-micron particulate density, measured in µg/m3 @@ -552,7 +552,7 @@ namespace Characteristic { CREATE_CHAR(double,RelativeHumidityHumidifierThreshold,50,0,100); // humidfier turns on when humidity falls below this threshold CREATE_CHAR(uint32_t,RemainingDuration,60,0,3600); // duration (in seconds) remaining for Service to be active/on CREATE_CHAR(uint8_t,RemoteKey,4,4,15,UP=4,DOWN,LEFT,RIGHT,CENTER,BACK,PLAY_PAUSE=11,INFO=15); // triggers an update when the corresponding key is pressed in the Remote Control widget on an iPhone - CREATE_CHAR(uint8_t,ResetFilterIndication,1,1,1,RESET_FILTER=1); // triggers and update when the user chooses to reset the FilterChangeIndication from the Home App + CREATE_CHAR(uint8_t,ResetFilterIndication,1,1,1,RESET_FILTER=1); // triggers an update when the user chooses to reset the FilterChangeIndication (only appears in Eve App, not Home App) CREATE_CHAR(int,RotationDirection,0,0,1,CLOCKWISE,COUNTERCLOCKWISE); // indicates the rotation direction of a fan CREATE_CHAR(double,RotationSpeed,0,0,100); // measured as a percentage CREATE_CHAR(double,Saturation,0,0,100); // color saturation, measured as a percentage @@ -566,7 +566,7 @@ namespace Characteristic { CREATE_CHAR(uint8_t,SleepDiscoveryMode,0,0,1); // not used CREATE_CHAR(uint8_t,SmokeDetected,0,0,1,NOT_DETECTED,DETECTED); // indicates if smoke is detected CREATE_CHAR(boolean,StatusActive,1,0,1,NOT_FUNCTIONING,FUNCTIONING); // indicates whether the Service is properly functioning - CREATE_CHAR(uint8_t,StatusFault,0,0,1,NO_FAULT,FAULT); // indicates whether the Service has a fault + CREATE_CHAR(uint8_t,StatusFault,0,0,1,NO_FAULT,FAULT); // indicates whether the Service has a fault (only appears in Eve App, not Home App) CREATE_CHAR(uint8_t,StatusJammed,0,0,1,NOT_JAMMED,JAMMED); // indicates whether the Service has been "jammed" CREATE_CHAR(uint8_t,StatusLowBattery,0,0,1,NOT_LOW_BATTERY,LOW_BATTERY); // indicates state of battery CREATE_CHAR(uint8_t,StatusTampered,0,0,1,NOT_TAMPERED,TAMPERED); // indicates whether the Service has been tampered with diff --git a/src/src.ino b/src/src.ino index 7069400..7d9a9d8 100644 --- a/src/src.ino +++ b/src/src.ino @@ -70,7 +70,18 @@ void setup() { new Characteristic::StatusActive(0); new Characteristic::StatusFault(1); new Characteristic::StatusTampered(1); - new Characteristic::StatusLowBattery(1); + new Characteristic::StatusLowBattery(1); + + new SpanAccessory(); + new Service::AccessoryInformation(); + new Characteristic::Identify(); + new Characteristic::Name("Furnace Filter"); + + new Service::FilterMaintenance(); + new Characteristic::FilterChangeIndication(Characteristic::FilterChangeIndication::CHANGE_NEEDED); + new Characteristic::FilterLifeLevel(5); +// new Characteristic::ResetFilterIndication(); + }