Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thermo schedule #80

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package-lock.json
node_modules
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,29 @@ For the setup of Google Drive, please follow the Google Drive Quickstart for Nod
##### Additional notes for Google Drive
* Pay attention so that your plugin does not issue multiple addEntry calls for the same accessory at the same time (this may results in improper behaviour of Google Drive to the its asynchronous nature)

### Schedules
For Eve Thermo you can also enable the schedule feature. You must pass your Thermostat service to the `registerScheduleEvents` function:
```
// in your includes:
var fakegatoHistory = require('fakegato-history');
...
// in your module.exports:
Schedule = fakegatoHistory.Schedule(homebridge);
...
// in your code:
let thermoScheduler = new Schedule('thermo', log);
thermoScheduler.registerScheduleEvents(thermostatService);
```
This will add the custom characteristics `E863F12F` (ProgramData), `E863F12C` (ProgramCommand) and `E863F11E`(FirmwareInfo) to your Termostat service. The schedule is executed in the background and will fire set calls to TargetTemperature and TargetHeatingCoolingState at the specified times.
You does not have to return the 'thermoScheduler' instance, but you can play around with vacation mode and open window mode from your plugin:
```
thermoScheduler.setVacationMode(true, 16); // (enable, temp[°C])
thermoScheduler.setVacationMode(false); // (disable)
thermoScheduler.setOpenWindow(true); // (enable open window mode)
thermoScheduler.setOpenWindow(false); // (disable open window mode)
```
You can also use these features from the Eve app. Vacation mode will disable the schedule and set the target temperature to a fixed value. Open window mode will stop heating (and temporary disables schedule) and will remain heating after a timeout of 30min.

## TODO

- [x] Support for rolling-over of the history
Expand Down
8 changes: 7 additions & 1 deletion fakegato-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const Format = require('util').format;
const FakeGatoTimer = require('./fakegato-timer').FakeGatoTimer;
const FakeGatoStorage = require('./fakegato-storage').FakeGatoStorage;
const FakeGatoSchedule = require('./fakegato-schedule');
const moment = require('moment');

const EPOCH_OFFSET = 978307200;
Expand All @@ -20,7 +21,12 @@ const TYPE_ENERGY = 'energy',
var homebridge;
var Characteristic, Service;

module.exports = function (pHomebridge) {

module.exports = createFakeGatoHistory; // default export
module.exports.Schedule = FakeGatoSchedule;


function createFakeGatoHistory(pHomebridge) {
if (pHomebridge && !homebridge) {
homebridge = pHomebridge;
Characteristic = homebridge.hap.Characteristic;
Expand Down
Loading