-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(structure): adding in structure set point
- Loading branch information
Showing
1 changed file
with
38 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,47 @@ | ||
import {Model} from './model'; | ||
import { Model } from './model'; | ||
|
||
export enum StructureHeatCoolMode { | ||
OFF = 'float', //for some reason flair calls off float? Maybe its "floating..." around. | ||
COOL = 'cool', | ||
HEAT = 'heat', | ||
AUTO = 'auto' | ||
OFF = 'float', //for some reason flair calls off float? Maybe its "floating..." around. | ||
COOL = 'cool', | ||
HEAT = 'heat', | ||
AUTO = 'auto', | ||
} | ||
|
||
export enum FlairMode { | ||
MANUAL = 'manual', | ||
AUTO = 'auto' | ||
MANUAL = 'manual', | ||
AUTO = 'auto' | ||
} | ||
|
||
export class Structure extends Model { | ||
public static type = 'structures' | ||
|
||
updatedAt: Date = new Date(); | ||
createdAt: Date = new Date(); | ||
isActive = false; | ||
home = false; | ||
|
||
structureHeatCoolMode: StructureHeatCoolMode = StructureHeatCoolMode.COOL; | ||
mode : FlairMode = FlairMode.AUTO; | ||
|
||
public fromJSON(data: any): Structure { | ||
this.name = data.attributes.name; | ||
this.createdAt = new Date(data.attributes['created-at']); | ||
this.updatedAt = new Date(data.attributes['updated-at']); | ||
|
||
this.isActive = data.attributes['is-active']; | ||
this.home = data.attributes.home; | ||
this.structureHeatCoolMode = data.attributes['structure-heat-cool-mode']; | ||
this.mode = data.attributes.mode; | ||
|
||
this.id = data.id; | ||
return this; | ||
} | ||
|
||
public isPrimaryHome(): boolean { | ||
return this.home; | ||
} | ||
public static type = 'structures'; | ||
|
||
updatedAt: Date = new Date(); | ||
createdAt: Date = new Date(); | ||
isActive = false; | ||
home = false; | ||
|
||
structureHeatCoolMode: StructureHeatCoolMode = StructureHeatCoolMode.COOL; | ||
structureHeatCoolModeCalculated?: StructureHeatCoolMode; | ||
setPointTemperatureC = 0; | ||
mode: FlairMode = FlairMode.AUTO; | ||
|
||
public fromJSON(data: any): Structure { | ||
this.name = data.attributes.name; | ||
this.createdAt = new Date(data.attributes['created-at']); | ||
this.updatedAt = new Date(data.attributes['updated-at']); | ||
|
||
this.isActive = data.attributes['is-active']; | ||
this.home = data.attributes.home; | ||
this.structureHeatCoolMode = data.attributes['structure-heat-cool-mode']; | ||
this.structureHeatCoolModeCalculated = data.attributes['structure-heat-cool-mode-calculated'] === null ? undefined : data.attributes['structure-heat-cool-mode-calculated']; | ||
this.setPointTemperatureC = data.attributes['set-point-temperature-c']; | ||
this.mode = data.attributes.mode; | ||
|
||
this.id = data.id; | ||
return this; | ||
} | ||
|
||
public isPrimaryHome(): boolean { | ||
return this.home; | ||
} | ||
} |