Skip to content

Commit

Permalink
1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-j-davies committed May 31, 2021
1 parent bdab623 commit 416aa53
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
38 changes: 38 additions & 0 deletions core/accessories/HumiditySensor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
'use strict'

const { Service, Characteristic, Categories} = require("hap-nodejs");
const {SetWithBattery, BaseAccessory} = require("./BaseAccessory")

class HumiditySensor extends BaseAccessory {

constructor(Config) {
super(Config, Categories.SENSOR);

this._service = new Service.HumiditySensor(Config.name, Config.name);

this._service.setCharacteristic(Characteristic.CurrentRelativeHumidity, 25);
this._service.setCharacteristic(Characteristic.StatusActive, 1);
this._service.setCharacteristic(Characteristic.StatusFault, 0);
this._service.setCharacteristic(Characteristic.StatusTampered, 0);
this._Properties["CurrentRelativeHumidity"] = 25;
this._Properties["StatusActive"] = 1;
this._Properties["StatusFault"] = 0;
this._Properties["StatusTampered"] = 0;


const EventStruct = {
"Get": ["CurrentRelativeHumidity", "StatusActive", "StatusTampered", "StatusFault"],
"Set": []
}

this._wireUpEvents(this._service, EventStruct);
this._accessory.addService(this._service);

this._createBatteryService();
}
}
HumiditySensor.prototype.setCharacteristics = SetWithBattery;

module.exports = {
HumiditySensor:HumiditySensor
}
Binary file added core/accessories/Icons/HUMIDITY_SENSOR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions core/accessories/Types.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,19 @@ const { Leak } = require("./LeakSensor")
const { LightSensor } = require("./LightSensor")
const { Camera } = require("./Camera/Camera")
const { MultiSensor } = require("./MultiSensor")
const { HumiditySensor } = require("./HumiditySensor")


let Types = {

"HUMIDITY_SENSOR": {
Label: "Humidity Sensor",
Icon: "HUMIDITY_SENSOR.png",
SupportsRouting: true,
Class: HumiditySensor,
Actions: [],
ConfigProperties: []
},
"CONTACT_SENSOR": {
Label: "Contact Sensor",
Icon: "CONTACT_SENSOR.png",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hap-router",
"version": "1.5.0",
"version": "1.6.0",
"description": "A Middleware HAP Router for bringing HomeKit functionality to your Home Automation.",
"main": "HAPRouter.js",
"keywords": [
Expand Down

0 comments on commit 416aa53

Please sign in to comment.