Skip to content

Commit

Permalink
Wemo TimeOn and TodayKwh done. need to test for threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
cam292 committed Apr 24, 2019
1 parent 13db7f9 commit 5734944
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/main/java/Rulebooks/wemo/TimeOn.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ public void finalize()
}

public boolean conditionIsTrue(){
// today_on_time is in seconds
int onTime = Integer.valueOf(status.getAttributes().get("today_on_time")) / 60;

if (onTime > 540){
setAlertName("wemo-time-on");
return true;
}

setAlertName("wemo-time-on");
return false;
}

Expand Down
8 changes: 7 additions & 1 deletion src/main/java/Rulebooks/wemo/TodayKwh.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ public void finalize()
}

public boolean conditionIsTrue(){
double todayKwH = Double.valueOf(status.getAttributes().get("today_kwh"));

// assuming a 100w (.1kw) lightbulb running for 10 hours
if (todayKwH > 1 ){
setAlertName("wemo-today-kwh");
return true;
}

setAlertName("wemo-today-kwh");
return false;
}

Expand Down

0 comments on commit 5734944

Please sign in to comment.