Comments (2)
Just to understand your question better, let me pull an example from HAP-NodeJS.
/**
* Characteristic "Brightness"
*/
Characteristic.Brightness = function() {
Characteristic.call(this, 'Brightness', '00000008-0000-1000-8000-0026BB765291');
this.setProps({
format: Characteristic.Formats.INT,
unit: Characteristic.Units.PERCENTAGE,
maxValue: 100,
minValue: 0,
minStep: 1,
perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE, Characteristic.Perms.NOTIFY]
});
this.value = this.getDefaultValue();
};
inherits(Characteristic.Brightness, Characteristic);
Characteristic.Brightness.UUID = '00000008-0000-1000-8000-0026BB765291';
Brightness has a relatively simple structure, but your concern in that other characteristics might have more parameters. As an example CurrentHeatingCoolingState
.
/**
* Characteristic "Current Heating Cooling State"
*/
Characteristic.CurrentHeatingCoolingState = function() {
Characteristic.call(this, 'Current Heating Cooling State', '0000000F-0000-1000-8000-0026BB765291');
this.setProps({
format: Characteristic.Formats.UINT8,
perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY]
});
this.value = this.getDefaultValue();
};
inherits(Characteristic.CurrentHeatingCoolingState, Characteristic);
Characteristic.CurrentHeatingCoolingState.UUID = '0000000F-0000-1000-8000-0026BB765291';
// The value property of CurrentHeatingCoolingState must be one of the following:
Characteristic.CurrentHeatingCoolingState.OFF = 0;
Characteristic.CurrentHeatingCoolingState.HEAT = 1;
Characteristic.CurrentHeatingCoolingState.COOL = 2;
Are you asking for a way to deal with all such characteristics in a single function addCharacteristic
?
from esp8266-homekit.
Actually when I opened this issue, I was not aware of how the HomeKit philosophy works. But actually the issue does not exist and the current approach is already OK.
Basic idea is that each type of characteristic has its build in variables, predefined for this very characteristic. So they go statically inside the API and the outside user has not to worry about them.
I will close the issue...
from esp8266-homekit.
Related Issues (20)
- xQueue usage HOT 1
- Error: implicit declaration of function 'wc_HKDF' HOT 3
- add ESP8266-HomeKit to sonoff touch? HOT 4
- Village at sha2017.org HOT 3
- HomeKit Accessory Protocol Specification HOT 2
- implicit declaration of function 'wc_HKDF' (hkc.c) HOT 4
- Cannot pair HOT 11
- Unreachable from other iOS device HOT 3
- RGB led example HOT 12
- Change mdns flooding approach into a real bonjour strategy HOT 9
- HAP Bonjour Discovery HOT 2
- Use homekit on Arduino HOT 3
- Firmware Update Over The Air (FOTA) HOT 9
- Thermostat Sensor example HOT 3
- Other Services doesnt work HOT 9
- The accessory in the Home app shows "no response" after running for some time HOT 3
- The future of this code base HOT 5
- Help With Compiling HOT 6
- video instruction HOT 4
- Toogle Switch HOT 3
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 esp8266-homekit.