Comments (3)
#ifndef NUMBER_OF_RELAYS
#define NUMBER_OF_RELAYS 4
#endif
homekit_accessory_t *accessories[] = {
HOMEKIT_ACCESSORY(.id=1, .category=homekit_accessory_category_switch, .services=(homekit_service_t*[]){
HOMEKIT_SERVICE(ACCESSORY_INFORMATION, .characteristics=(homekit_characteristic_t*[]){
&name,
HOMEKIT_CHARACTERISTIC(MANUFACTURER, "YOU"),
HOMEKIT_CHARACTERISTIC(SERIAL_NUMBER, "123456"),
HOMEKIT_CHARACTERISTIC(MODEL, "Basic"),
HOMEKIT_CHARACTERISTIC(FIRMWARE_REVISION, "0.1"),
HOMEKIT_CHARACTERISTIC(IDENTIFY, identify),
NULL
}),
#if (NUMBER_OF_RELAYS == 1)
HOMEKIT_SERVICE(SWITCH, .primary=true, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(NAME, "Switch"),
&switch1_on,
NULL
}),
#else
HOMEKIT_SERVICE(SWITCH, .primary=true, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(NAME, "Switch 1"),
&switch1_on,
NULL
}),
#if (NUMBER_OF_RELAYS > 1)
HOMEKIT_SERVICE(SWITCH, .primary=true, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(NAME, "Switch 2"),
&switch2_on,
NULL
}),
#if (NUMBER_OF_RELAYS > 2)
HOMEKIT_SERVICE(SWITCH, .primary=true, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(NAME, "Switch 3"),
&switch3_on,
NULL
}),
#if (NUMBER_OF_RELAYS > 3)
HOMEKIT_SERVICE(SWITCH, .primary=true, .characteristics=(homekit_characteristic_t*[]){
HOMEKIT_CHARACTERISTIC(NAME, "Switch 4"),
&switch4_on,
NULL
}),
#endif
#endif
#endif
#endif
NULL
}),
NULL
};
Then in Makefile add
NUMBER_OF_RELAYS ?= 1
EXTRA_CFLAGS += -DNUMBER_OF_RELAYS=$(NUMBER_OF_RELAYS)
Then you can compile it like this (plus or minus how you normally compile it)
make NUMBER_OF_RELAYS=3 all
from esp-homekit.
hello @maximkulkin
Thank you very much for your quick response, I will implement it and it will be solved.
Thanks a lot
congratulations again
from esp-homekit.
I assume it worked for you. If you still have issues with it, feel free to reopen this issue (or create new one if you have a different problem)
from esp-homekit.
Related Issues (20)
- Cannot find device after removing it. HOT 1
- QUESTION : Dynamic "name" after init_accessory - without esp restart HOT 3
- Server limited to 25 characteristics HOT 4
- How to use ESP8266 as AccessPoint
- 'Hidden' Flag Doesn't Work?
- Separate Accessories - Causes Intermittent 'No Response' HOT 6
- Performance on iOS 16 beta HOT 1
- HOMEKIT_SERVICE_DOORBELL not found
- Can this be used as a proxy for the Level Lock? HOT 1
- Failed to dump SPR public key (code -199) HOT 3
- How to install in ESPhome running on Home Assistant HOT 1
- HOMEKIT_SERVICE_HUMIDIFIER_DEHUMIDIFIER
- wifi:bcn_timeout,ap_probe_send_start HOT 2
- Question: arduino as esp-idf component HOT 1
- Question: esp-idf v5.0
- Reason using PORT 5556 HOT 3
- ESP8266 not reachable after MDNS restart HOT 7
- ESP8266 Accessory No Response HOT 2
- I can't name the switch with different name in same accessory HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp-homekit.