Skip to content

Commit

Permalink
1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-j-davies committed Jun 1, 2021
1 parent 75e0a06 commit ccdf831
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 203 deletions.
2 changes: 1 addition & 1 deletion @marcus-j-davies/haprouter-route-websocket/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@marcus-j-davies/haprouter-route-websocket",
"description": "The stock HAP Router WEB SOCKET route",
"version": "2.0.0",
"version": "2.0.1",
"main": "index.js",
"author": {
"name": "Marcus Davies",
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ If you're a Home Automation Enthusiast, or just a tinkerer, Hap Router allows yo
## Nice! how do I get started
The server is managed by a gorgeous looking Web User Interface (if the above images haven't already suggested so), It is a breeze to use, and at the basic level you:
- Create a Route (Routes can be used by more than 1 accessory)
- Create an Accessory (16 different accessory type thus far)
- Create an Accessory (20 different accessory type thus far)
- Enroll the device in HomeKit.
- Have Fun.

Expand Down Expand Up @@ -155,8 +155,9 @@ library, without it, projects like this one are not possible.

## Version History

- **1.6.1**
- **1.7.0**
- Bump WS dependancy for **haprouter-route-websocket**
- Added a combined Temp and Humidty Sensor

- **1.6.0**
- Added a Humidity Sensor Accessory.
Expand Down
Binary file added core/accessories/Icons/TEMP_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.
96 changes: 96 additions & 0 deletions core/accessories/TempHumidity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
'use strict'

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

const Set = function (payload) {

Object.keys(payload).forEach((K) =>{

switch(K){


case "CurrentTemperature":
this._Properties[K] = payload[K];
this._tempService.setCharacteristic(Characteristic[K], payload[K])
break;

case "CurrentRelativeHumidity":
this._Properties[K] = payload[K];
this._humidityservice.setCharacteristic(Characteristic[K], payload[K])
break;

case "StatusActive":
case "StatusFault":
case "StatusTampered":
this._Properties[K] = payload[K];
this._tempService.setCharacteristic(Characteristic[K], payload[K])
this._humidityservice.setCharacteristic(Characteristic[K], payload[K])
break;

case "BatteryLevel":
case "StatusLowBattery":
case "ChargingState":
this._Properties[K] = payload[K];
this._batteryService.setCharacteristic(Characteristic[K], payload[K])
break;


}

})
}

class TempHumidity extends BaseAccessory {

constructor(Config) {

super(Config, Categories.SENSOR);


// Temp
this._tempService = new Service.TemperatureSensor("Temperature Sensor", "Temperature Sensor");

this._tempService.setCharacteristic(Characteristic.CurrentTemperature, 21);
this._tempService.setCharacteristic(Characteristic.StatusActive, 1);
this._tempService.setCharacteristic(Characteristic.StatusFault, 0);
this._tempService.setCharacteristic(Characteristic.StatusTampered, 0);
this._Properties["CurrentTemperature"] = 21;
this._Properties["StatusActive"] = 1;
this._Properties["StatusFault"] = 0;
this._Properties["StatusTampered"] = 0;


var EventStruct = {
"Get": ["CurrentTemperature", "StatusActive", "StatusTampered", "StatusFault"],
"Set": []
}

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

// Humidity
this._humidityservice = new Service.HumiditySensor("Humidity Sensor", "Humidity Sensor");

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

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

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

this._createBatteryService();
}
}
TempHumidity.prototype.setCharacteristics = Set;

module.exports = {
TempHumidity:TempHumidity
}
9 changes: 9 additions & 0 deletions core/accessories/Types.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,19 @@ const { LightSensor } = require("./LightSensor")
const { Camera } = require("./Camera/Camera")
const { MultiSensor } = require("./MultiSensor")
const { HumiditySensor } = require("./HumiditySensor")
const { TempHumidity } = require("./TempHumidity")


let Types = {

"TEMP_HUMIDITY_SENSOR": {
Label: "Temp & Humidity Sensor",
Icon: "TEMP_HUMIDITY_SENSOR.png",
SupportsRouting: true,
Class: TempHumidity,
Actions: [],
ConfigProperties: []
},
"HUMIDITY_SENSOR": {
Label: "Humidity Sensor",
Icon: "HUMIDITY_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.6.0",
"version": "1.7.0",
"description": "A Middleware HAP Router for bringing HomeKit functionality to your Home Automation.",
"main": "HAPRouter.js",
"keywords": [
Expand Down
6 changes: 0 additions & 6 deletions ui/static/JS/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,3 @@ function RestoreConfig()
Input.click();
}


/******************************************* */




195 changes: 2 additions & 193 deletions ui/static/Style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ fieldset table{
text-align: center;
vertical-align: middle;
margin: 10px;
font-size: 14px;
font-size: 11px;
color: rgb(255,255,255);
width: 80px;
height: 75px;
Expand Down Expand Up @@ -294,195 +294,4 @@ div.PopupCurtain > div.PopupContent{
box-shadow: 10px 10px 5px -4px rgba(0,0,0,0.75);
overflow: hidden;


}


/********************************/

.StyledButton[withborder]
{
border-color: rgb(0,0,0);
border-style: solid;
border-width: 5px;
font-size: 16px;
-webkit-border-radius: 6px;
-moz-border-radius: 6px;
border-radius: 6px;
}


.Middle {
margin-left: auto;
margin-right: auto;
}

.Dialog {
border-width: 2px;
border-style: solid;
border-color: #F36B08;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: 6px 6px 5px 0px rgba(0,0,0,1);
-moz-box-shadow: 6px 6px 5px 0px rgba(0,0,0,1);
box-shadow: 6px 6px 5px 0px rgba(0,0,0,1);
overflow:hidden;
background-color:rgba(255,255,255,1.0)
}

.Dialog .Title {
background-color: #F36B08;
padding-left: 10px;
height: 40px;
line-height: 40px;
/*font-weight: bold;*/
color: rgb(255,255,255);
}

.TopBanner {
width: 100%;
height: 40px;
line-height: 40px;
padding-left: 5px;
padding-right:5px;
color: white;
font-size: 22px;
background-color: #F36B08;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
overflow: hidden;

-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;

}

img.invert {
filter: invert(100%);
}


.Accessory {
display: inline-block;
width: 200px;
margin-top:20px;
margin-left: 10px;
margin-bottom: 10px;

height: 65px;
padding-left: 5px;
color: rgb(255,255,255);
font-size: 16px;
background-color: #F36B08;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
border-width:1px;
border-color:rgb(0,0,0);
border-style:solid;
padding:10px;
animation-delay:0.3s;



-webkit-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.75);
-moz-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.75);
box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.75);


}

.Route {
display: inline-block;
width: 200px;
margin-top:20px;
margin-left: 10px;
margin-bottom: 10px;

height: 65px;
padding-left: 5px;
color: rgb(255,255,255);
font-size: 16px;
background-color: #F36B08;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
overflow: hidden;
border-width:1px;
border-color:rgb(0,0,0);
border-style:solid;
padding:10px;
animation-delay:0.3s;

word-break: break-all;



-webkit-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.75);
-moz-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.75);
box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.75);


}
table{
color:rgb(0,0,0)
}


.config{
width: 200px;
}





svg rect{

fill:rgb(0,0,0);
stroke-width:4;
stroke:#F36B08;
cursor: pointer;
}
svg path{
stroke:rgb(0,0,0);
stroke-width:3;
z-index: -99;

}

.Popup{
position: absolute;
top:0;
left: 0;
z-index:100;
background-color: rgba(0,0,0,0.6);
width: 100%;
height: 100%;
display: none;

}

.MDNSType{
position: relative;
left: 80px;
bottom: -20px;
color: black;
font-size: 12px;
background-color: white;
border-color: black;
border-width: 1px;
border-style: solid;
padding: 5px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}





}

0 comments on commit ccdf831

Please sign in to comment.