-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
By default, registered Eve.app Characteristics for power management -…
… fakegato intials #168
- Loading branch information
Showing
8 changed files
with
176 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Characteristic } from 'hap-nodejs' | ||
|
||
import { | ||
EveS2R1, | ||
EveS2R2, | ||
EveS2W1, | ||
EveS2W2, | ||
} from './eve-app/EveCharacteristics' | ||
|
||
class HAPCharacteristic extends Characteristic { | ||
static EveS2R1: typeof EveS2R1 | ||
static EveS2R2: typeof EveS2R2 | ||
static EveS2W1: typeof EveS2W1 | ||
static EveS2W2: typeof EveS2W2 | ||
} | ||
|
||
export default HAPCharacteristic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Service } from 'hap-nodejs' | ||
|
||
import { EveHistoryData } from './eve-app/EveServices' | ||
|
||
class HAPService extends Service { | ||
static EveHistoryData: typeof EveHistoryData | ||
} | ||
|
||
export default HAPService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { Formats, Perms } from 'hap-nodejs/dist/lib/Characteristic' | ||
|
||
import CustomCharacteristicType from '../../types/CustomCharacteristicType' | ||
import HAPCharacteristic from '../HAPCharacteristic' | ||
|
||
/** | ||
* Based upon | ||
* - https://gist.github.com/simont77/3f4d4330fa55b83f8ca96388d9004e7d | ||
* - https://gist.github.com/gomfunkel/b1a046d729757120907c | ||
* - https://github.com/simont77/fakegato-history/blob/master/fakegato-history.js | ||
*/ | ||
|
||
const EveCharacteristics: CustomCharacteristicType[] = [ | ||
{ | ||
UUID: 'E863F10A-079E-48FF-8F27-9C2605A29F52', | ||
name: 'Eve-Volt', | ||
format: Formats.FLOAT, | ||
perms: [Perms.PAIRED_READ], | ||
description: 'Volt (V) value. Used by Eve.app.', | ||
}, | ||
{ | ||
UUID: 'E863F126-079E-48FF-8F27-9C2605A29F52', | ||
name: 'Eve-Ampere', | ||
format: Formats.FLOAT, | ||
perms: [Perms.PAIRED_READ], | ||
description: 'Ampere (A) value. Used by Eve.app.', | ||
}, | ||
{ | ||
UUID: 'E863F10D-079E-48FF-8F27-9C2605A29F52', | ||
name: 'Eve-Watt', | ||
format: Formats.FLOAT, | ||
perms: [Perms.PAIRED_READ], | ||
description: | ||
'Watt (W) value. Used by Eve.app, reported as "Consumption".', | ||
}, | ||
{ | ||
UUID: 'E863F10C-079E-48FF-8F27-9C2605A29F52', | ||
name: 'Eve-Kilowatt-hour', | ||
format: Formats.FLOAT, | ||
perms: [Perms.PAIRED_READ], | ||
description: | ||
'Kilowatt-hour (kWh) value. Used by Eve.app, reported as Total Consumption.', | ||
}, | ||
{ | ||
UUID: 'E863F110-079E-48FF-8F27-9C2605A29F52', | ||
name: 'Eve-Volt-Ampere', | ||
format: Formats.UINT16, | ||
perms: [Perms.PAIRED_READ], | ||
description: 'Volt-Ampere (VA) value. Used by Eve.app.', | ||
}, | ||
] | ||
|
||
export class EveS2R1 extends HAPCharacteristic { | ||
public static readonly UUID: string = 'E863F116-079E-48FF-8F27-9C2605A29F52' | ||
|
||
constructor() { | ||
super('Eve-S2R1', EveS2R1.UUID, { | ||
format: Formats.DATA, | ||
perms: [Perms.PAIRED_READ, Perms.NOTIFY, Perms.HIDDEN], | ||
}) | ||
} | ||
} | ||
HAPCharacteristic.EveS2R1 = EveS2R1 | ||
|
||
export class EveS2R2 extends HAPCharacteristic { | ||
public static readonly UUID: string = 'E863F117-079E-48FF-8F27-9C2605A29F52' | ||
|
||
constructor() { | ||
super('Eve-S2R2', EveS2R2.UUID, { | ||
format: Formats.DATA, | ||
perms: [Perms.PAIRED_READ, Perms.NOTIFY, Perms.HIDDEN], | ||
}) | ||
} | ||
} | ||
HAPCharacteristic.EveS2R2 = EveS2R2 | ||
|
||
export class EveS2W1 extends HAPCharacteristic { | ||
public static readonly UUID: string = 'E863F11C-079E-48FF-8F27-9C2605A29F52' | ||
|
||
constructor() { | ||
super('Eve-S2W1', EveS2W1.UUID, { | ||
format: Formats.DATA, | ||
perms: [Perms.PAIRED_WRITE, Perms.HIDDEN], | ||
}) | ||
} | ||
} | ||
HAPCharacteristic.EveS2W1 = EveS2W1 | ||
|
||
export class EveS2W2 extends HAPCharacteristic { | ||
public static readonly UUID: string = 'E863F121-079E-48FF-8F27-9C2605A29F52' | ||
|
||
constructor() { | ||
super('Eve-S2W2', EveS2W2.UUID, { | ||
format: Formats.DATA, | ||
perms: [Perms.PAIRED_WRITE, Perms.HIDDEN], | ||
}) | ||
} | ||
} | ||
HAPCharacteristic.EveS2W2 = EveS2W2 | ||
|
||
export default EveCharacteristics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import HAPCharacteristic from '../HAPCharacteristic' | ||
import HAPService from '../HAPService' | ||
|
||
/** | ||
* Based on https://github.com/simont77/fakegato-history/blob/master/fakegato-history.js | ||
*/ | ||
|
||
export class EveHistoryData extends HAPService { | ||
// Custom service for meta and/or historical information. Characteristics for logging: E863F11C, E863F121, E863F116, E863F117. Used by Eve.app. | ||
public static readonly UUID: string = 'E863F007-079E-48FF-8F27-9C2605A29F52' | ||
|
||
constructor() { | ||
super('EveHistoryData', EveHistoryData.UUID) | ||
|
||
// Required Characteristics | ||
this.addCharacteristic(HAPCharacteristic.EveS2R1) | ||
this.addCharacteristic(HAPCharacteristic.EveS2R2) | ||
this.addCharacteristic(HAPCharacteristic.EveS2W1) | ||
this.addCharacteristic(HAPCharacteristic.EveS2W2) | ||
} | ||
} | ||
|
||
HAPService.EveHistoryData = EveHistoryData |