<commit_before># HAS
### Homekit Accessory Server

HAS is a Homekit accessory server written in NodeJS which lets you create your own Homekit-enabled accessories on your computer, Raspberry Pi or everything else which can run NodeJS.

It provides you a rich and simple API to create your own servers, accessories, services and characteristic.

This project is based on Homekit accessory protocol(HAP) specification which you can find it [here](https://developer.apple.com/homekit/specification/)(Requires Apple developer account).

#Sample

```js
import * as HAS from 'HAS';

let config = new HAS.Config('NodeJS Fan', '82:E6:B6:63:BC:2C', HAS.categories.fan, __dirname + '/fan.json', 8091, '200-20-200');

let server = new HAS.Server(config);

//Fan
let fan = new HAS.Accessory(1);

let fanIdentify = HAS.predefined.Identify(1, undefined, (value, callback) => {
        console.log('Fan Identify', value);
        callback(HAS.statusCodes.OK);
    }),
    fanManufacturer = HAS.predefined.Manufacturer(2, 'Hamyar'),
    fanModel = HAS.predefined.Model(3, 'Model2017'),
    fanName = HAS.predefined.Name(4, 'Fan'),
    fanSerialNumber = HAS.predefined.SerialNumber(5, 'ABCDEFGHIJ'),
    fanFirmwareVersion = HAS.predefined.FirmwareRevision(6, '1.0.0');
fan.addServices(HAS.predefined.AccessoryInformation(1, [fanIdentify, fanManufacturer, fanModel, fanName, fanSerialNumber, fanFirmwareVersion]));


let on = HAS.predefined.On(1, false, (value, callback) => {
    console.log('Fan Status', value);
    callback(HAS.statusCodes.OK);
});
fan.addServices(HAS.predefined.Fan(2, [on]));

server.addAccessory(fan);

//server.onIdentify will be used only when server is not paired, If server is paired identify.onWrite will be used
server.onIdentify = fanIdentify.onWrite;

//Starts the server
server.startServer();
```

_Check out [samples folder](https://github.com/abedinpour/HAS/tree/master/samples) for more samples._

#API

**Categories**

Homekit Accessory Categories

```js
HAS.catogories = {
   other: 1,
   bridge: 2,
   fan: 3,
   garage: 4,
   lightBulb: 5,
   doorLock: 6,
   outlet: 7,
   switch: 8,
   thermostat: 9,<commit_msg>README Fix<commit_after># HAS
### Homekit Accessory Server

HAS is a Homekit accessory server written in NodeJS which lets you create your own Homekit-enabled accessories on your computer, Raspberry Pi or everything else which can run NodeJS.

It provides you a rich and simple API to create your own servers, accessories, services and characteristic.

This project is based on Homekit accessory protocol(HAP) specification which you can find it [here](https://developer.apple.com/homekit/specification/)(Requires Apple developer account).

# Sample

```js
import * as HAS from 'HAS';

let config = new HAS.Config('NodeJS Fan', '82:E6:B6:63:BC:2C', HAS.categories.fan, __dirname + '/fan.json', 8091, '200-20-200');

let server = new HAS.Server(config);

//Fan
let fan = new HAS.Accessory(1);

let fanIdentify = HAS.predefined.Identify(1, undefined, (value, callback) => {
        console.log('Fan Identify', value);
        callback(HAS.statusCodes.OK);
    }),
    fanManufacturer = HAS.predefined.Manufacturer(2, 'Hamyar'),
    fanModel = HAS.predefined.Model(3, 'Model2017'),
    fanName = HAS.predefined.Name(4, 'Fan'),
    fanSerialNumber = HAS.predefined.SerialNumber(5, 'ABCDEFGHIJ'),
    fanFirmwareVersion = HAS.predefined.FirmwareRevision(6, '1.0.0');
fan.addServices(HAS.predefined.AccessoryInformation(1, [fanIdentify, fanManufacturer, fanModel, fanName, fanSerialNumber, fanFirmwareVersion]));


let on = HAS.predefined.On(1, false, (value, callback) => {
    console.log('Fan Status', value);
    callback(HAS.statusCodes.OK);
});
fan.addServices(HAS.predefined.Fan(2, [on]));

server.addAccessory(fan);

//server.onIdentify will be used only when server is not paired, If server is paired identify.onWrite will be used
server.onIdentify = fanIdentify.onWrite;

//Starts the server
server.startServer();
```

_Check out [samples folder](https://github.com/abedinpour/HAS/tree/master/samples) for more samples._

# API

**Categories**

Homekit Accessory Categories

```js
HAS.catogories = {
   other: 1,
   bridge: 2,
   fan: 3,
   garage: 4,
   lightBulb: 5,
   doorLock: 6,
   outlet: 7,
   switch: 8,
   thermostat: 9,
{'fraction_non_alphanumeric': 0.12789880534082923, 'fraction_numerical': 0.02108222066057625, 'mean_word_length': 4.545454545454546, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1709044', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1366, 'n_words': 394}