Git Product home page Git Product logo

fakegato-history's Introduction

fakegato-history

npm npm GitHub last commit GitHub license

Module to emulate Elgato Eve history service in Homebridge accessories, so that it will show in Eve.app (Home.app does not support it). Still work in progress. Use at your own risk, no guarantee is provided.

NOTE when updating from version <0.5.0: On certain systems (e.g. macOS), previus versions may append ".local" or ".lan" after hostname in the file name. This additional portions are now removed to improve reliability of persistence on google drive when network goes down. If you do not want to loose your previous history, before updating check if your system creates files with the additional portion, and if so, rename them.

More details on communication protocol and custom Characteristics in the Wiki.

Your plugin should expose the corresponding custom Elgato services and characteristics in order for the history to be seen in Eve.app. For a weather example see https://github.com/simont77/homebridge-weather-station-eve, for an energy example see https://github.com/simont77/homebridge-myhome/blob/master/index.js (MHPowerMeter class). For other types see the Wiki. Avoid the use of "/" in characteristics of the Information Service (e.g. model, serial number, manufacturer, etc.), since this may cause data to not appear in the history. Note that if your Eve.app is controlling more than one accessory for each type, the serial number should be unique, otherwise Eve.app will merge the histories. Adding hostname is recommended as well, for running multiple copies of the same plugin on different machines (i.e. production and development), i.e.:

.setCharacteristic(Characteristic.SerialNumber, hostname + "-" + this.deviceID)

Import module into your plugin module export with:

var FakeGatoHistoryService = require('fakegato-history')(homebridge);

Add the service to your Accessory using:

Accessory.log = this.log;
this.loggingService = new FakeGatoHistoryService(accessoryType, Accessory, length);

And if your plugin is using V2 of the platform API, also add the above to your configureAccessory function as well.

where

  • accessoryType can be "weather", "energy", "room", "room2, "door", motion", "switch", "thermo", "aqua", or "custom"
  • Accessory should be the accessory using the service, in order to correctly set the service name and pass the log to the parent object. Your Accessory should have a this.log variable pointing to the homebridge logger passed to the plugin constructor (add a line this.log=log; to your plugin). Debug messages will be shown if homebridge is launched with -D option.
  • length is the history length; if no value is given length is set to 4032 samples

Remember to return the fakegato service in getServices function if using the accessory API, and if using the platform API include it as a Service as part of your accessory.

Eve.app requires at least an entry every 10 minutes to avoid holes in the history. Depending on the accessory type, fakegato-history may add extra entries every 10 minutes or may average the entries from the plugin and send data every 10 minutes. This is done using a single global timer shared among all accessories using fakegato. You may opt for managing yourself the Timer and disabling the embedded one by using that constructor:

	this.loggingService = new FakeGatoHistoryService(accessoryType, Accessory, {size:length,disableTimer:true});

then you'll have to addEntry yourself data every 10min.

By default, if you don't addEntry during the 10 minutes timer, to avoid gaps (and fill data for lazy sensors), the timer repeat the last data. To avoid this behaviour, add the disableRepeatLastData param :

	this.loggingService = new FakeGatoHistoryService(accessoryType, Accessory, {size:length,disableRepeatLastData:true});

Depending on your accessory type:

  • Add entries to history of accessory emulating Eve Weather (TempSensor Service) using something like this:

      this.loggingService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.temperature, pressure: this.airPressure, humidity: this.humidity});
    

    AirPressure is in mbar, Temperature in Celsius, Humidity in %. Entries are internally averaged and sent every 10 minutes using the global fakegato timer. The temperature sensor needs to implement the Characteristic.TemperatureDisplayUnits Characteristic set to Celsius. Your entries should be in any case periodic, in order to avoid error with the average. Average is done independently on each quantity (i.e. you may different periods, and entries with only one or two quantities)

  • Add entries to history of accessory emulating Eve Energy (Outlet service) using something like this:

      this.loggingService.addEntry({time: Math.round(new Date().valueOf() / 1000), power: this.power});
    

    Power is in Watt. Entries are internally averaged and sent every 10 minutes using the global fakegato timer. To have good accuracy, your entries should be in any case periodic, in order to avoid error with the average.

  • Add entries to history of accessory emulating Eve Room (TempSensor, HumiditySensor and AirQuality Services) using something like this:

      this.loggingService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.temperature, humidity: this.humidity, ppm: this.ppm});
    

    Temperature in Celsius, Humidity in %. Entries are internally averaged and sent every 10 minutes using the global fakegato timer. Your entries should be in any case periodic, in order to avoid error with the average. Average is done independently on each quantity (i.e. you may different periods, and entries with only one or two quantities)

  • Add entries to history of accessory emulating Eve Room 2 (TempSensor, HumiditySensor and AirQuality Services) using something like this:

    this.loggingService.addEntry({time: Math.round(new Date().valueOf() / 1000), temp: this.temperature, humidity: this.humidity, voc: this.voc});

    Temperature in Celsius, Humidity in % and VOC in µg/m3. The Eve App will convert µg/m3 to ppb (by dividing by 4.57). Entries are internally averaged and sent every 10 minutes using the global fakegato timer. Your entries should be in any case periodic, in order to avoid error with the average. Average is done independently on each quantity (i.e. you may different periods, and entries with only one or two quantities)

  • Add entries to history of accessory emulating Eve Door (ContactSensor service) using something like this on every status change:

      this.loggingService.addEntry({time: Math.round(new Date().valueOf() / 1000), status: this.status});
    

    Status can be 1 for ‘open’ or 0 for ‘close’. Entries are of type "event", so entries received from the plugin will be added to the history as is. In addition to that, fakegato will add extra entries every 10 minutes repeating the last known state, in order to avoid the appearance of holes in the history.

  • Add entries to history of accessory emulating Eve Motion (MotionSensor service) using something like this on every status change:

      this.loggingService.addEntry({time: Math.round(new Date().valueOf() / 1000), status: this.status});
    

    Status can be 1 for ‘detected’ or 0 for ‘cleared’. Entries are of type "event", so entries received from the plugin will be added to the history as is. In addition to that, fakegato will add extra entries every 10 minutes repeating the last known state, in order to avoid the appearance of holes in the history.

  • Add entries to history of accessory emulating Eve Light Switch (Switch service) using something like this on every status change:

      this.loggingService.addEntry({time: Math.round(new Date().valueOf() / 1000), status: this.status});
    

    Status can be 1 for ‘On’ or 0 for ‘Off’. Entries are of type "event", so entries received from the plugin will be added to the history as is. In addition to that, fakegato will add extra entries every 10 minutes repeating the last known state, in order to avoid the appearance of holes in the history.

  • Add entries to history of accessory emulating Eve Thermo (Thermostat service) using something like this every 10 minutes:

      this.loggingService.addEntry({time: Math.round(new Date().valueOf() / 1000), currentTemp: this.currentTemp, setTemp: this.setTemp, valvePosition: this.valvePosition});
    

    currentTemp and setTemp in Celsius, valvePosition in %. Fakegato does not use the internal timer for Thermo, entries are added to the history as received from the plugin (Thermo accessory is under development). For setTemp to show, you have to add all the 3 extra thermo characteristics (see gist), and enable set temperature visualization under accessory options in Eve.app.

  • Add entries to history of accessory emulating Eve Aqua (Valve service set to Irrigation Type) using something like this on every status change:

      this.LoggingService.addEntry({ time: Math.round(new Date().valueOf() / 1000), status: this.power, waterAmount: this.waterAmount });
    

    Status can be 1 for ‘open’ or 0 for ‘close’. WaterAmount is meaningful (and needed) only when Status is close, and corresponds to the amount of water used during the just elapsed irrigation period in ml. Entries are of type "event", so entries received from the plugin will be added to the history as is. In addition to that, fakegato will add extra entries every 10 minutes repeating the last known state, in order to avoid the appearance of holes in the history.

  • Add entries to history of an accessory of a custom design or configuration. Configurations validated include combination energy and switch device ( history of power and on/off ), motion and temperature device ( history of motion and temperature ), room and thermo device (history of temperature/humidity and setTemp/valvePosition), and motion and light sensor device ( history of motion and light level).

      this.LoggingService.addEntry({ time: Math.round(new Date().valueOf() / 1000), power: this.power });
      this.LoggingService.addEntry({ time: Math.round(new Date().valueOf() / 1000), status: this.On });
    

    This is a sample power / switch device, and in the sample I'm sending the current power usage then updating the on/off status of the device. For best results send power and on/off status separately. Power on a regular interval and on/off when the device status changes.

    Temperature, Humidity, Pressure, Power and lux entries are averaged over the history interval. Contact, Status, Motion, setTemp and valvePosition are directly added to history records.

    valid entry Characteristic
    temp Temperature in celcius ( value averaged over 10 minutes )
    humidity humidity in percentage ( value averaged over 10 minutes )
    pressure pressure ( value averaged over 10 minutes )
    power Current usage in watts ( value averaged over 10 minutes )
    ppm Parts per million
    contact contact sensor state ( 0 / 1 )
    status switch status ( 0 / 1 )
    motion motion sensor state ( 0 / 1 )
    voc µg/m3
    setTemp Temperature in celcius
    valvePosition valvePosition in percentage
    lux light level in lux

For Energy and Door accessories it is also worth to add the custom characteristic E863F112 for resetting, respectively, the Total Consumption accumulated value or the Aperture Counter (not the history). See Wiki. The value of this characteristic is changed whenever the reset button is tapped on Eve, so it can be used to reset the locally stored value. The value seems to be the number of seconds from 1.1.2001. I left this characteristics out of fakegato-history because it is not part of the common history service.

For Door and Motion you may want to add characteristic E863F11A for setting the time of last activation. Value is the number of second from reset of fakegato-history. You can get this time using the function getInitialTime()

For Aqua you need to add E863F131 and E863F11D characteristics in order to make Eve recognize the accessory, and to set last activation, total water consumption and flux (see wiki). You MUST also set a proper value in E863F131, even if your plugin does not actively set these quantities, otherwise Eve will not communicate properly. See wiki for an example proper value.

If your "weather" or "room" plugin don't send addEntry for a short time (supposedly less than 1h - need feedback), the graph will draw a straight line from the last data received to the new data received. Instead, if your plugin don't send addEntry for "weather" and "room" for a long time (supposedly more than few hours - need feedback), the graph will show "no data for the period". Take this in consideration if your sensor does not send entries if the difference from the previous one is small, you will end up with holes in the history. This is not currently addresses by fakegato, you should add extra entries if needed. Note that if you do not send a new entry at least every 10 minutes, the average will be 0, and you will a zero entry. This will be fixed soon.

Advanced Options

  • Usage in a Typescript based Plugin
import fakegato from 'fakegato-history';
.
.
.
export class yourPlatform implements DynamicPlatformPlugin {
  private FakeGatoHistoryService;     <-- You need a platform level reference to the service
.
.
.
constructor ()  <-- This is your Platform constructor
{
this.FakeGatoHistoryService = fakegato(this.api);
.
.
. For each accessory
element.fakegatoService = new this.FakeGatoHistoryService(element.type, accessory, {
  log: this.log,        <--  Required as typescript does not allow adding the log variable to the Accessory object.
});

History Persistence

It is possible to persist data to disk or to Google Drive to avoid loosing part of the history not yet downloaded by Eve on restart or system crash. Data is saved every 10min for "weather" and "room", on every event and every 10 minutes for "door" and "motion", on every event for other types.

Data will be saved, either on local filesystem or on google drive, in JSON files, one for each persisted accessory, with filename in the form hostname_accessoryDisplayName_persist.json. In order to reset the persisted data, simply delete these files.

NOTE when updating from version <0.5.0: On certain systems (e.g. macOS), previus versions may append ".local" or ".lan" after hostname in the file name. This additional portions are now removed to improve reliability of persistence on google drive when network goes down. If you do not want to loose your previous history, before updating check if your system creates files with the additional portion, and if so, rename them.

As an added feature, plugins can leverage persistance capabilities of fakegato, both on filesystem and google drive, using the two functions setExtraPersistedData(extra) and getExtraPersistedData(). Extra can be any json formattable data. Plugin has to check that what is returned is what it is expecting (fakegato will return undefined object if extra data is not present on the persisted file, or if google drive has not started yet), and retry if needed. It is also advisable to call in advance the function isHistoryLoaded() to check whether fakegato finished loading the history from the storage.

File System

In order to enable persistence on local disk, when instantiating the FakeGatoHistoryService, the third argument become an object with these attributes:

this.loggingService = new FakeGatoHistoryService(accessoryType, Accessory, {
	size:length, 				// optional - if you still need to specify the length
	storage:'fs',
	path:'/place/to/store/my/persistence/'  // if empty it will be used the -U homebridge option if present, or .homebridge in the user's home folder
});

Google Drive

In order to enable persistence on Google Drive, when instantiating the FakeGatoHistoryService, the third argument become an object with these attributes:

this.loggingService = new FakeGatoHistoryService(accessoryType, Accessory, {
	size:length, 				// optional - if you still need to specify the length
	storage:'googleDrive',
	folder:'fakegatoFolder', 		// folder on Google drive to persist data, 'fakegato' if empty
	keyPath:'/place/to/store/my/keys/' 	// where to find client_secret.json, if empty it will be used the -U homebridge option if present or .homebridge
});

For the setup of Google Drive, please follow the Google Drive Quickstart for Node.js instructions from https://developers.google.com/drive/api/quickstart/nodejs, except for these changes:

  • In Step 7 of "Authorize credentials for a desktop application" rename the downloaded file to "client_secret.json" and put it in fakegato-history directory.
  • Skip "Setup the sample"
  • Run the quickstartGoogleDrive.js included with this module. You need to run the command from fakegato-history directory. After authoeizing the app onto Google website a file "drive-nodejs-quickstart.json" is created in the same directory
  • Copy files "client_secret.json" and "drive-nodejs-quickstart.json in your keyPath
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)

TODO

  • Support for rolling-over of the history
  • Aggregate transmission of several entries into a single Characteristic update in order to speed up transfer when not on local network.
  • Add other accessory types. Help from people with access to real Eve accessory is needed. Dump of custom Characteristics during data transfer is required.
  • Make history persistent
  • Adjustable history length
  • Addition and management of other history related characteristics
  • Periodic sending of reference time stamp (seems not really needed if the time of your homebridge machine is correct)

Known bugs

  • Currently valve position history in thermo is not working

How to contribute

If you own an Eve accessory and would like to help improving this module, you can follow this procedure to dump the communication:

  • Install Xcode on a Mac with High Sierra and register for a free Apple Developer Account
  • Download this code https://github.com/simont77/HMCatalog-Swift3/tree/experimental and compile the HMCatalog app. Follow this guide https://stackoverflow.com/questions/30973799/ios-9-new-feature-free-provisioning-run-your-app-on-a-device-just-with-your-ap to compile for your own device and install on it (the app will not work on any other device). The App will run only for few days, since the code signature has a very short expiration date, but you can repeat the procedure if needed. This is called Free Provisioning, you may find many additional guides on the web in case of issues. You will have also to enable Homekit support, let Xcode fix issues when it offers to do it.
  • Run the HMCatalog app. You should be able to read raw values of all the characteristics of your accessories.
  • Trigger an history transfer of the history within Eve.app
  • Open again the HMCatalog app, select your Eve accessory and the Service E863F007-079E-48FF-8F27-9C2605A29F52. If using an iPad, you can open HMCatalog and Eve in split view to monitor in real time the communication as it occurs.
  • Copy values of all characteristics (especially E863F117-079E-48FF-8F27-9C2605A29F52 and E863F116-079E-48FF-8F27-9C2605A29F52) and leave me a comment with it.

fakegato-history's People

Contributors

banboobee avatar devbobo avatar ebaauw avatar honkmaster avatar nebzhb avatar northernman54 avatar samfox2 avatar seydx avatar sieren avatar simont77 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fakegato-history's Issues

Eve show negative values for temperature (internet speed) in history

I want to log the internet speeds in fakegato-history in Mbps. In the fakegato-history json file the values look good.
Plugin:
https://github.com/Kienz/homebridge-speedtest-net

persistent json:
{"firstEntry":0,"lastEntry":2,"usedMemory":2,"refTime":608625820.9330001,"initialTime":1586933020.933,"history":["noValue",{"time":1586933020.933,"setRefTime":1},{"time":1586933020.933,"temp":422.75,"humidity":17.97,"pressure":55}]}

temp = download speed
humidity = upload speed
pressure = ping in ms

homebridge log:
4/15/2020, 8:43:40 AM] [Internet] Download: 422.75 Mbps
[4/15/2020, 8:43:40 AM] [Internet] Upload: 17.97 Mbps
[4/15/2020, 8:43:40 AM] [Internet] Ping: 55 ms
[4/15/2020, 8:43:40 AM] [Internet] External IP: 149.172.218.226
[4/15/2020, 8:43:40 AM] [Internet] Add history data 422.75 17.97 55
[4/15/2020, 8:43:40 AM] [Internet] First entry Internet: 0
[4/15/2020, 8:43:40 AM] [Internet] Last entry Internet: 2
[4/15/2020, 8:43:40 AM] [Internet] Used memory Internet: 2
[4/15/2020, 8:43:40 AM] [Internet] 116 Internet: 00000000000000009ce4462403 0102 0202 03020300c00f00000000000000000101
[4/15/2020, 8:43:40 AM] [Internet] ** Fakegato-storage write FS file: /homebridge/accessories/homebridge-4_Internet_persist.json "firstEntry":0,"lastEntry":2,"usedMemory":2,"refTime":608625820.9330001,"initial
[4/15/2020, 8:44:28 AM] [Internet] Data request Internet: 01140100000000
[4/15/2020, 8:44:28 AM] [Internet] Address requested Internet: 1
[4/15/2020, 8:44:28 AM] [Internet] Internet Entry: 2, Address: 2
[4/15/2020, 8:44:28 AM] [Internet] Data Internet: 1501000000 0100 0000 819ce446240000 0000 00 0000 10 02000000000000000723a505072602

Eve shows for this entry the value "-232,6" (in celcius). What is wrong?
I'm using the temperature service and the "weather" fakegato-history.

Timer without adding extra entries

Hi,
I really like your lib and the timer handling.
In my setup, sensor data are received via MQTT every ~50-70 seconds. I call your addEntry function every time when new data are received, so that a new history entry is generated every 10min from the average. This is working perfectly.
Now, if one sensor suddenly stops sending data (going offline, battery low, ...) and consequently no entry is added within the next 10min-intervall (no addEntry call), I don’t want to have this „previous average extra entry“ generated. If the sensor is really off, gaps in the Eve app are absolutely ok.

Is it possible to use your timer for averaging values over the timer interval, but without adding extra entries if no data were added?

Eve Light Switch History?

Hi,

Elgato sells the Eve Light Switch in the US and interestingly it seems to offer a history for Characteristic.On. As I'm in Germany I can't use this out of the box, however it would be great to know if support for this is underway?

I'd be looking to add this to my automation switches. Incidentally if I try to expose the history for the switches, the app already shows an On History, but doesn't show any data - so the data format must differ from the others somehow.

Thanks!

googleDrive failed callback

when I lunch the script quickstartGoogleDrive.js and retrieve the link when I put the code into command line I receive the following error:

fs.js:128
throw new ERR_INVALID_CALLBACK();
^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at maybeCallback (fs.js:128:9)
at Object.writeFile (fs.js:1163:14)
at storeToken (/homebridge/node_modules/fakegato-history/lib/googleDrive.js:356:6)
at /homebridge/node_modules/fakegato-history/lib/googleDrive.js:337:7
at /homebridge/node_modules/fakegato-history/node_modules/google-auth-library/lib/auth/oauth2client.js:154:5
at Request._callback (/homebridge/node_modules/fakegato-history/node_modules/google-auth-library/lib/transporters.js:106:7)
at Request.self.callback (/homebridge/node_modules/fakegato-history/node_modules/request/request.js:185:22)
at Request.emit (events.js:198:13)
at Request. (/homebridge/node_modules/fakegato-history/node_modules/request/request.js:1161:10)
at Request.emit (events.js:198:13)

Eve Signatures / Log Entries

Hi,

Not sure if this the best way to add some of my insights, but this seemed the only way.

I've been following this work for a few days, and I can only tell: great job!

However, I'm not sure that the "signatures" as exposed in characteristic 116 are so magical. I think they are "which data is available for logging".

For Eve Thermo, the "Signature" I have is:
06 0102 1102 1001 1201 1d01 2302
I'm "decoding" this as:
6 different types of data
0102: 01 = Type (Temperature), 02 bytes
1102: 11 = Type (Setpoint Temperature), 02 bytes
1001: 10 = Type (Valve %), 01 byte
1201: 12 = Type (Heating Mode???), 01 byte
1d01: 1d = Type (???), 01 byte
2302: 23 = Type (Battery Voltage???), 02 bytes

Then, on the logging in characteristic 117, the "entry type" is a bit mask:
e.g.: 01 would mean "I'm only reporting the 1st data type now => Temperature (2 bytes)
The Eve Thermo that I was spying on reported a few logs with "entry type" 1f: (0001111) => Temperature (2bytes), Setpoint Temp (2bytes), Valve% (1byte), Heating Mode (1byte), ????(1byte) ==>> total size 7
Newer log entries have "entry type" 3f: (0011111) => same + "battery voltage???"(2 bytes) ==>> total size 9

So, I think that 116 and 117 really work together; and I believe that not each log entry needs to report ALL data (i.e. the logging is dynamic); even though that most data will allways be reported all the time.

I also have spied on an Eve Energy (Firmware 1.2.9):
"Signature" 05 0b02 0c02 0d02 0702 0e01
5 different data types
0b02: ????, 2 bytes
0c02: Volt x 10, 2 bytes
0d02: ????, 2 bytes
0702: Watt x 10 (???), 2 bytes
0e01: On/Off, 1 byte

Extract from the log (117) for this Eve Energy
0b 21590000 b140cc00 10 01
Entry type 10 (binary: 00010000) => I'm only reporting my 5th data point
01 => Switch On (1 byte)
12 22590000 a642cc00 0f 0000 0b09 0000 0000
Entry type 0f (binary: 00001111) => I'm only reporting my first 4 data points
Data Type 0B (???), 2 bytes => 0
Data Type 0C (Volt x 10), 2 bytes => 2315 => 230,5 Volt
Data Type 0D (???), 2 bytes => 0
Data Type 07 (Watt x 10), 2 bytes => 0 => 0 Watt

(with this interpretation, it would seem that fakegato is currently sending "Temperature" (set to 0), "Humidity" (set to 0), "Watt" (filled with correct data) and "Air Quality" (set to 0) for TYPE_ENERGY ... which indicates that they are quite liberal in what they can handle in app)

Hope my contribution helps... regards, Stef

Homebridge crashes after a while

I getting the following error after 1-2 minutes after startup.
RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: Attempt to write outside buffer bounds
at boundsError (internal/buffer.js:53:11)
at Buffer.readFloatBackwards [as readFloatBE] (internal/buffer.js:403:5)
at Parser. (/usr/lib/node_modules/homebridge-knx/lib/knxmonitor.js:62:29)
at Parser.emit (events.js:182:13)
at /usr/lib/node_modules/homebridge-knx/node_modules/eibd/lib/parser.js:96:12
at Decoder.decode (/usr/lib/node_modules/homebridge-knx/node_modules/eibd/lib/decoder.js:233:7)
at Parser.parseTelegram (/usr/lib/node_modules/homebridge-knx/node_modules/eibd/lib/parser.js:93:18)
at Parser.onData (/usr/lib/node_modules/homebridge-knx/node_modules/eibd/lib/parser.js:150:12)
at Socket. (/usr/lib/node_modules/homebridge-knx/node_modules/eibd/lib/parser.js:36:10)
at Socket.emit (events.js:182:13)

I saw now stats so far.
Still tried to get it running.

Historical import of measurements?

I have a bunch of measurements alongside their UNIX timestamp in the API I am querying for the stats on my air purifier plugin, is it supported to load in historical records using addEvent?

I have about 3k records that would need to be included, or is there a specific bulk loader?

I was considering looping over all the measurements and calling addEvent on every iteration - is there a way to push these direct to this history, or will each call need to wait for the 10-minute poll?

Accessory vs Platform API

I want to use a different filename, based on the device unique ID (ZigBee mac address) instead of on the (user changeable!) accessory name. I managed this by setting the accessory.displayName, but now it also shows the history service (007) under the ID. I figured I could create the 007 service myself, and fakegato-history would pick it up:

if ( typeof thisAccessory.getService === "function" ) {
// Platform API
this.log.debug('Platform',thisAccessory.displayName);
this.service = thisAccessory.getService(FakeGatoHistoryService);
if (this.service === undefined) {
this.service = thisAccessory.addService(FakeGatoHistoryService, ucfirst(thisAccessory.displayName) + ' History', this.accessoryType);
}

However, my platform plugin is recognised as accessory plugin. Shouldn't line 440 check for getServices() instead of getService()?

https://github.com/nfarina/homebridge/blob/b670ec1036135b0df06094f1738d7c93499c3a39/lib/server.js#L388

No history visible in eve app

Hey I tried to add this cool plugin to my weather station extended plugin but I'm facing some problems.

I added your plugin v0.3.8 according to your description but the history data in the eve app is empty.

Do you have any idea what I might be doing wrong?

You can see my implementation here: https://github.com/naofireblade/homebridge-weather-station-extended/blob/master/index.js

I debugged the fakegato-history service and there seems to be history data in it:

displayName: 'Now History',
UUID: 'E863F007-079E-48FF-8F27-9C2605A29F52',
subtype: undefined,
iid: 25,
characteristics:
 [ Characteristic {
     displayName: 'Name',
     UUID: '00000023-0000-1000-8000-0026BB765291',
     iid: 26,
     value: 'Now History',
     eventOnlyCharacteristic: false,
     props: [Object],
     _events: [Object],
     _eventsCount: 1 },
   S2R1Characteristic {
     displayName: 'S2R1',
     UUID: 'E863F116-079E-48FF-8F27-9C2605A29F52',
     iid: 27,
     value: '8AAAAAAAAACdvCMgAwECAgIDAgQAwA8AAAAAAAAAAAEB',
     eventOnlyCharacteristic: false,
     props: [Object],
     _events: [Object],
     _eventsCount: 1 },
   S2R2Characteristic {
     displayName: 'S2R2',
     UUID: 'E863F117-079E-48FF-8F27-9C2605A29F52',
     iid: 28,
     value: null,
     eventOnlyCharacteristic: false,
     props: [Object],
     _events: [Object],
     _eventsCount: 2 },
   S2W1Characteristic {
     displayName: 'S2W1',
     UUID: 'E863F11C-079E-48FF-8F27-9C2605A29F52',
     iid: 29,
     value: null,
     eventOnlyCharacteristic: false,
     props: [Object],
     _events: [Object],
     _eventsCount: 2 },
   S2W2Characteristic {
     displayName: 'S2W2',
     UUID: 'E863F121-079E-48FF-8F27-9C2605A29F52',
     iid: 30,
     value: null,
     eventOnlyCharacteristic: false,
     props: [Object],
     _events: [Object],
     _eventsCount: 2 } ],
optionalCharacteristics: [],
isHiddenService: false,
isPrimaryService: false,
linkedServices: [],
size: 4032,
minutes: 4,
accessoryName: 'Now',
log:
 { [Function: bound ]
   debug: [Function],
   info: [Function],
   warn: [Function],
   error: [Function],
   log: [Function],
   prefix: 'Wetterstation' },
accessoryType116: '03 0102 0202 0302',
accessoryType117: '07',
accessoryType: 'weather',
firstEntry: 0,
lastEntry: 3,
history:
 [ ,
   { time: 1517520157, setRefTime: 1 },
   { temp: 1.9, ressure: 998, humidity: 94, time: 1517520157 },
   { temp: 1.8, ressure: 998, humidity: 94, time: 1517520397 } ],
memorySize: 4032,
usedMemory: 3,
currentEntry: 1,
transfer: false,
setTime: true,
refTime: 539212957,
memoryAddress: 0,
dataStream: '',
IntervalID: null,
_events:
 { 'service-configurationChange': [Function: bound ],
   'characteristic-change': [Function: bound ] },
_eventsCount: 2 }````

fakegatoStorage Issue Tracker and backlog

Backlog

  • Revisit logging, current too verbose even for debug
  • Google Drive - Add retries for 'User Rate Limit Exceeded' after a small interval for both fakegato-history.load and fakegato-history.save
  • fakegato-history - this.log.debug("ERROR fetching persisting data restart from zero - invalid JSON",e);
    cb(e,false); // fakegato-history This needs testing
  • Added hostname to drive file name, so that test and prod data can
    be separate. ( May need to rethink this further. )

Issues

  • Google Drive - on reboot my motion accessory issue two addentry one after the other, this creates two files, and then everything starts going crazy, if I remove the extra files then always seems ok
  • Google Drive - Fix creation of multiple folders when none exist

Implementation of FakeGate does not show history graph...

Hi,

I'm trying to add FakeGate to the homebridge-knx plugin. When I check the device in the eve App, I see the graph, but it says "No data available". If I dump the "loggingService" variable, I could see historical data. So not sure what I'm doing wrong here...

Any ideas how to further debug and get this up and running?

Thanks....

Debug Output:

[6/4/2018, 12:51:27 PM] [homebridge-knx.KNX] ** Fakegato-storage AddWriter : Temperatur Wohnzimmer History8
[6/4/2018, 12:51:27 PM] [homebridge-knx.KNX] ** Fakegato-storage read FS file: /home/knx/.homebridge/knx_Temperatur Wohnzimmer History8_persist.json
[6/4/2018, 12:51:27 PM] [homebridge-knx.KNX] ** Fakegato-timer Subscription : Temperatur Wohnzimmer History8
....
[6/4/2018, 12:54:15 PM] [homebridge-knx.KNX] **Fakegato-timer: addData  Temperatur Wohnzimmer History8 { time: 1528109655, temp: 26 }  immediate:  false

Dump of loggingService:

FakeGatoHistory {
  displayName: 'Temperatur Wohnzimmer History8 History',
  UUID: 'E863F007-079E-48FF-8F27-9C2605A29F52',
  subtype: 'SUB_dbcb770a-9b2e-4e69-8695-7317969d8a38',
  iid: 21,
  characteristics:
   [ Characteristic {
       displayName: 'Name',
       UUID: '00000023-0000-1000-8000-0026BB765291',
       iid: 22,
       value: 'Temperatur Wohnzimmer History8 History',
       status: null,
       eventOnlyCharacteristic: false,
       props:
        { format: 'string',
          unit: null,
          minValue: null,
          maxValue: null,
          minStep: null,
          perms: [ 'pr' ] },
       subscriptions: 0,
       _events: { change: [Function: bound ] },
       _eventsCount: 1 } ],
  optionalCharacteristics: [],
  isHiddenService: false,
  isPrimaryService: false,
  linkedServices: [],
  size: '365',
  minutes: 10,
  storage: 'fs',
  path: '/home/knx/.homebridge',
  filename: undefined,
  disableTimer: false,
  accessoryName: 'Temperatur Wohnzimmer History8',
  log:
   { [Function: bound ]
     debug: [Function],
     info: [Function],
     warn: [Function],
     error: [Function],
     log: [Function],
     prefix: 'homebridge-knx.KNX' },
  loaded: true,
  accessoryType116: '04 0102 0202 0402 0f03',
  accessoryType117: '0f',
  accessoryType: 'room',
  firstEntry: 0,
  lastEntry: 4,
  history:
   [ 'noValue',
     { time: 1528107958, setRefTime: 1 },
     { temp: 25.9, time: 1528107958 },
     { temp: 25.94, time: 1528108558 },
     { temp: 26, time: 1528109159 } ],
  memorySize: '365',
  usedMemory: 4,
  currentEntry: 1,
  transfer: false,
  setTime: true,
  refTime: 549800758,
  memoryAddress: 0,
  dataStream: '',
  saving: false,
  service:
   Service {
     displayName: 'Temperatur Wohnzimmer History8 History',
     UUID: 'E863F007-079E-48FF-8F27-9C2605A29F52',
     subtype: 'room',
     iid: 11,
     characteristics:
      [ Characteristic {
          displayName: 'Name',
          UUID: '00000023-0000-1000-8000-0026BB765291',
          iid: 12,
          value: 'Temperatur Wohnzimmer History8 History',
          status: null,
          eventOnlyCharacteristic: false,
          props:
           { format: 'string',
             unit: null,
             minValue: null,
             maxValue: null,
             minStep: null,
             perms: [Object] },
          subscriptions: 0,
          _events: { change: [Function: bound ] },
          _eventsCount: 1 },
        Characteristic {
          displayName: 'S2R1',
          UUID: 'E863F116-079E-48FF-8F27-9C2605A29F52',
          iid: 13,
          value: 'sQQAAAAAAAA2S8UgBAECAgIEAg8DBQBtAQAAAAAAAAAAAQE=',
          status: null,
          eventOnlyCharacteristic: false,
          props:
           { format: 'data',
             unit: null,
             minValue: null,
             maxValue: null,
             minStep: null,
             perms: [Object] },
          subscriptions: 0,
          _events: { change: [Function: bound ] },
          _eventsCount: 1 },
        Characteristic {
          displayName: 'S2R2',
          UUID: 'E863F117-079E-48FF-8F27-9C2605A29F52',
          iid: 14,
          value: 'EwMAAABYAgAADyIKAAAAAAAAAA==',
          status: null,
          eventOnlyCharacteristic: false,
          props:
           { format: 'data',
             unit: null,
             minValue: null,
             maxValue: null,
             minStep: null,
             perms: [Object] },
          subscriptions: 0,
          _events:
           { change: [Function: bound ],
             get: [Function: bound getCurrentS2R2] },
          _eventsCount: 2 },
        Characteristic {
          displayName: 'S2W1',
          UUID: 'E863F11C-079E-48FF-8F27-9C2605A29F52',
          iid: 15,
          value: 'ARQDAAAAAA==',
          status: null,
          eventOnlyCharacteristic: false,
          props:
           { format: 'data',
             unit: null,
             minValue: null,
             maxValue: null,
             minStep: null,
             perms: [Object] },
          subscriptions: 0,
          _events:
           { change: [Function: bound ],
             set: [Function: bound setCurrentS2W1] },
          _eventsCount: 2 },
        Characteristic {
          displayName: 'S2W2',
          UUID: 'E863F121-079E-48FF-8F27-9C2605A29F52',
          iid: 16,
          value: '0k7FIA==',
          status: null,
          eventOnlyCharacteristic: false,
          props:
           { format: 'data',
             unit: null,
             minValue: null,
             maxValue: null,
             minStep: null,
             perms: [Object] },
          subscriptions: 0,
          _events:
           { change: [Function: bound ],
             set: [Function: bound setCurrentS2W2] },
          _eventsCount: 2 } ],
     optionalCharacteristics: [],
     isHiddenService: false,
     isPrimaryService: false,
     linkedServices: [],
     _events:
      { 'service-configurationChange': [Function: bound ],
        'characteristic-change': [Function: bound ] },
     _eventsCount: 2 },
  _events:
   { 'service-configurationChange': [Function: bound ],
     'characteristic-change': [Function: bound ] },
  _eventsCount: 2,
  initialTime: 1528107958 }

img_3180

Thermo schedule

Hi,

Any chance you’re able to decode the thermo schedule format? I’ve included the data from your example and it show nice schedules for regular, bathroom and basement. It would be nice to add honeywell evohome’s schedule in there.

Thx!

New Characteristics / Services: Eve Motion - Eve Light Strip - Window Guard - Light Switch - Smoke

Hi!

I'm working on implementing custom Eve characteristics for ESP8266 based HomeKit firmware that works without any bridge via Wi-Fi.

Characteristics that i'm looking for: Temperature offset, LED on Motion, Transitions, Power On Behavior

Also i'm looking for the correct Service/Characteristic order for Eve Room to show app at the settings page as "Eve Room" (like my Eve Degree, Motion etc). Found it 🤓

Currently I've successfully added Eve Degree (shows up as "real" Degree in Eve app), but i can't find the correct order for Eve Room! But i've found some things in Accessory Simulator, e.g: VOC density doesn't shows up on Eve app (Room's sensor can measure it...also CO2)
But VOC characteristic will be kept because I've the same sensor that Elgato have in Room
😄

Other thing that cant figure out is Eve Motion have ( had???) custom "LED on Motion" characteristic for toggeling the LED when motion detected.... anybody found the proper characteristic for that?
It would be a nice feature to turn on/off the led when motion detected via Eve's characteristic
😄

Eve Motion characteristic:
IMG_7749

Eve doesn't show Contact history on fakegato door sensor.

I'm trying to implement fakegato-history in my homebridge-hue platform plugin, but I'm stuck. Would appreciate any hints.

I started with what I hoped would be the easiest: a door sensor. Also, I have an Eve Door for comparison. I added the LastOpen (11A) and TimesOpened (129) characteristics to the ContactSensor service. I update their values when the contact state changes - this seems to work. I added a fakegato logging service to the "accessory" (still using the old static accessory model). I issue an addEntry() on startup and when the contact state changes. The Fakegato-timer seems to do its work, I see an entry being added every 10 minutes (see log below). In Eve, I see history under the Times Opened characteristic, but not under the Contact characteristic. When I press the details, Eve shows a busy wheel and doesn't display any log entries. I didn't add the 118 and 119 characteristics to the Contact Sensor service. Would I need to do so? Do need to set their values or will the Eve app to that?

I added the ResetTotals characteristic (112) to the logging service, but I don't see a reset in Eve under the Times Opened details (as for the Eve Door). I double-checked in HMCatalog that it's there. Should I assign a value other than 0 to this characteristic? I do notice some more characteristics in the logging service for the Eve Door. It has 11E (rw), 112 (rw), 11C (w), 121 (w), 116 (r), 117 (r), 11D (w), and 131 (r). The fakegato logging service only has 116, 117, 11C, 121, and 112 (added by me).

Here's some excerpts from the homebridge log:

[2018-1-30 21:50:25] [Hue] pi2: /sensors/256: LUMI lumi.sensor_magnet.aq2 (ZHAOpenClose) "Washroom Door"
[2018-1-30 21:50:25] [Hue] ** Fakegato-timer Subscription : Washroom Door
[2018-1-30 21:50:25] [Hue] **Fakegato-timer: addData  Washroom Door { time: 1517345425, status: 0 }  immediate:  true
[2018-1-30 21:50:25] [Hue] **Fakegato-timer: executeImmediateCallback**
[2018-1-30 21:50:25] [Hue] **Fakegato-timer callbackDoor:  Washroom Door , immediate:  true , entry:  { time: 1517345425, status: 0 }
[2018-1-30 21:50:25] [Hue] First entry Washroom Door: 0
[2018-1-30 21:50:25] [Hue] Last entry Washroom Door: 2
[2018-1-30 21:50:25] [Hue] Used memory Washroom Door: 2
[2018-1-30 21:50:25] [Hue] 116 Washroom Door: 00000000000000001112212001 06010300c00f00000000000000000101
...
[2018-1-30 21:53:59] [Hue] Data request Washroom Door: 01140000000000
[2018-1-30 21:53:59] [Hue] Address requested Washroom Door: 0
[2018-1-30 21:53:59] [Hue] Data Washroom Door: 1501000000 0100 0000 81111221200000 0000 00 0000
[2018-1-30 21:53:59] [Hue] Washroom Door Entry: 2, Address: 2
[2018-1-30 21:53:59] [Hue] Data Washroom Door:  0b 02000000000000000100
[2018-1-30 21:54:05] [Hue] Washroom Door: state changed event
[2018-1-30 21:54:05] [Hue] Washroom Door: sensor open changed from false to true
[2018-1-30 21:54:05] [Hue] Washroom Door: set homekit contact from 0 to 1
[2018-1-30 21:54:05] [Hue] **Fakegato-timer: addData  Washroom Door { time: 1517345645, status: 1 }  immediate:  true
[2018-1-30 21:54:05] [Hue] **Fakegato-timer: executeImmediateCallback**
[2018-1-30 21:54:05] [Hue] **Fakegato-timer callbackDoor:  Washroom Door , immediate:  true , entry:  { time: 1517345645, status: 1 }
[2018-1-30 21:54:05] [Hue] First entry Washroom Door: 0
[2018-1-30 21:54:05] [Hue] Last entry Washroom Door: 3
[2018-1-30 21:54:05] [Hue] Used memory Washroom Door: 3
[2018-1-30 21:54:05] [Hue] 116 Washroom Door: dc000000000000001112212001 06010400c00f00000000000000000101
[2018-1-30 21:54:08] [Hue] Washroom Door: state changed event
[2018-1-30 21:54:08] [Hue] Washroom Door: sensor open changed from true to false
[2018-1-30 21:54:08] [Hue] Washroom Door: set homekit contact from 1 to 0
[2018-1-30 21:54:08] [Hue] **Fakegato-timer: addData  Washroom Door { time: 1517345648, status: 0 }  immediate:  true
[2018-1-30 21:54:08] [Hue] **Fakegato-timer: executeImmediateCallback**
[2018-1-30 21:54:08] [Hue] **Fakegato-timer callbackDoor:  Washroom Door , immediate:  true , entry:  { time: 1517345648, status: 0 }
[2018-1-30 21:54:08] [Hue] First entry Washroom Door: 0
[2018-1-30 21:54:08] [Hue] Last entry Washroom Door: 4
[2018-1-30 21:54:08] [Hue] Used memory Washroom Door: 4
[2018-1-30 21:54:08] [Hue] 116 Washroom Door: df000000000000001112212001 06010500c00f00000000000000000101
[2018-1-30 21:54:14] [Hue] Washroom Door: state changed event
[2018-1-30 21:54:14] [Hue] Washroom Door: sensor open changed from false to true
[2018-1-30 21:54:14] [Hue] Washroom Door: set homekit contact from 0 to 1
[2018-1-30 21:54:14] [Hue] **Fakegato-timer: addData  Washroom Door { time: 1517345654, status: 1 }  immediate:  true
[2018-1-30 21:54:14] [Hue] **Fakegato-timer: executeImmediateCallback**
[2018-1-30 21:54:14] [Hue] **Fakegato-timer callbackDoor:  Washroom Door , immediate:  true , entry:  { time: 1517345654, status: 1 }
[2018-1-30 21:54:14] [Hue] First entry Washroom Door: 0
[2018-1-30 21:54:14] [Hue] Last entry Washroom Door: 5
[2018-1-30 21:54:14] [Hue] Used memory Washroom Door: 5
[2018-1-30 21:54:14] [Hue] 116 Washroom Door: e5000000000000001112212001 06010600c00f00000000000000000101
[2018-1-30 21:54:17] [Hue] Washroom Door: state changed event
[2018-1-30 21:54:17] [Hue] Washroom Door: sensor open changed from true to false
[2018-1-30 21:54:17] [Hue] Washroom Door: set homekit contact from 1 to 0
[2018-1-30 21:54:17] [Hue] **Fakegato-timer: addData  Washroom Door { time: 1517345657, status: 0 }  immediate:  true
[2018-1-30 21:54:17] [Hue] **Fakegato-timer: executeImmediateCallback**
[2018-1-30 21:54:17] [Hue] **Fakegato-timer callbackDoor:  Washroom Door , immediate:  true , entry:  { time: 1517345657, status: 0 }
[2018-1-30 21:54:17] [Hue] First entry Washroom Door: 0
[2018-1-30 21:54:17] [Hue] Last entry Washroom Door: 6
[2018-1-30 21:54:17] [Hue] Used memory Washroom Door: 6
[2018-1-30 21:54:17] [Hue] 116 Washroom Door: e8000000000000001112212001 06010700c00f00000000000000000101
...
[2018-1-30 22:00:25] [Hue] **Fakegato-timer callbackDoor:  Washroom Door , immediate:  false , entry:  { time: 1517346025, status: 0 }
[2018-1-30 22:00:25] [Hue] First entry Washroom Door: 0
[2018-1-30 22:00:25] [Hue] Last entry Washroom Door: 7
[2018-1-30 22:00:25] [Hue] Used memory Washroom Door: 7
[2018-1-30 22:00:25] [Hue] 116 Washroom Door: 58020000000000001112212001 06010800c00f00000000000000000101
...
[2018-1-30 22:07:22] [Hue] Address requested Washroom Door: b
[2018-1-30 22:07:22] [Hue] Washroom Door Entry: 11, Address: 11
[2018-1-30 22:07:22] [Hue] Washroom Door Entry: 12, Address: 12
[2018-1-30 22:07:22] [Hue] Washroom Door Entry: 13, Address: 13
[2018-1-30 22:07:22] [Hue] Washroom Door Entry: 14, Address: 14
[2018-1-30 22:07:22] [Hue] Washroom Door Entry: 15, Address: 15
[2018-1-30 22:07:22] [Hue] Data Washroom Door:  0b 0b0000007a0300000100 0b 0c000000930300000101 0b 0d0000009e0300000100 0b 0e000000a30300000101 0b 0f000000a70300000100
...
[2018-1-30 22:15:24] [Hue] Data request Washroom Door: 01141000000000
[2018-1-30 22:15:24] [Hue] Address requested Washroom Door: 10
[2018-1-30 22:15:24] [Hue] Washroom Door Entry: 16, Address: 16
[2018-1-30 22:15:24] [Hue] Data Washroom Door:  0b 10000000b00400000100

Google Drive module doesn't handle forced logout scenario

@simont77 Hi all, I had to restart my router, and probably the external IP address changed. From that time fakegato, that was still running on my raspberry, stopped to save the history to google drive. I suppose that it is an authentication related problem. Do you know how can we fix it? Unfortunately on my main installation I have logging disabled, so I don’t know if any error was caught.

NorthernMan54 [12:23 PM]
@simont77 If you restart homebridge does it fix itself? I'm thinking the error handling doesn't handle the forced logout scenario, and authenticate again.

simont77 [12:27 PM]
Yes, restarting homebridge fixes everything, the saved history is correctly reloaded and updated

Eve History week/month view, missing current day

Hi there, I‘ve noticed that on histories week and month views the line for the current day is not drawn. Could that be a topic of fakegato or more an Eve app issue?

82514570-765F-4D97-ABAD-904DE61D6E6B
3A4DE31E-09B6-41F3-818E-0D012D1AE286

Measure values are available for the whole time. I guess it‘s an app issue. Any ideas?

Thermo integration example

Hi,

Great project!
I would like to include the new thermo functionality you've created in honeywell's evohome homebridge: https://github.com/rooi/homebridge-evohome

I do not see the the graphs as in the weather station. Perhaps it has something to do with the fact the the homebridge-evohome uses platforms instead of accessories and/or I've made an error. Do you have an example on how to include the thermo?

Thanks!

Q: correct settings for 'room' accessory type

cf., https://github.com/homespun/homebridge-accessory-bandwidth-quality/blob/master/index.js#L175

i am trying to determine why my plugin isn't generating entries that are acceptable to the elgato eve app.

a typical entry is something like:

    { time: 1539616961,  ppm: 500,  temp: 272.56832,  humidity: 9.14389333333332 }

the timer is disabled and an entry is added each hour. in looking at the README i am wondering whether i am doing something wrong with respect to the timing. can you advise me? thanks!

disableTimer bug

Specifying {disableTimer: true} in the options to the FakeGatoHistory constructor has a side-effect, causing Eve no longer to display the history. Now the entry is passed by reference to _addEntry(). When using the timer, the entry is re-constructed using the backlog, effectively passing the entry by value to _addEntry(). When the plugin calls addEntry with new values for the same object (e.g. add.Entry(this.entry), all history entries change, because they refer to the same object.

Two loggingServices?

Is it possible to have two FakeGatoHistoryLoggingServices/subtypes in one accessory? e.g. one for temperature/humidity and another one for an alert switch based on door type?

Can only see "undefined" when passing 'this' as an Accessory.

Hi,

I added fakegato-history to my accessory i'm working on with the below:

this.loggingService = new FakeGatoHistoryService("room", this, {
  storage:'fs'
  });
this.services.push(this.loggingService);

However when the plugin loads in debug mode all I see is:

[2018-3-2 05:29:33] [BlueAir 680i] ** Fakegato-storage AddWriter : undefined
[2018-3-2 05:29:33] [BlueAir 680i] Loading...
[2018-3-2 05:29:33] [BlueAir 680i] ** Fakegato-storage read FS file: 
/Users/myles.gray/.homebridge/Myless-MacBook-Pro.local_undefined_persist.json
[2018-3-2 05:29:33] [BlueAir 680i] ** Fakegato-timer Subscription : undefined
[2018-3-2 05:29:33] [BlueAir 680i] Registring Events undefined
[2018-3-2 05:29:33] [BlueAir 680i] Accessory undefined

I have followed the instructions as best I can, I have made sure this.log = log; is also in the accessory constructor.

Any ideas?

Gaps in history

In my setup I have integrated two components with fakegato-historysupport:

  1. homebridge-weather
  2. homebridge-dht

Sometimes I have gaps in my history inside the Eve app (see attached screenshot, sorry for the German). My server has been running constantly without errors. The log files are inconspicuous and the components have logged their data well. This is e.g. a log from the time where no history is available:

[2018-2-1 15:14:42] [Wetter] Fetched humidity 86 of type current for Wetter
[2018-2-1 15:14:42] [Wetter] Fetched temperature 4 of type current for Wetter
[2018-2-1 15:15:12] [DHT22] DHT Status: 0, Temperature: 17.6, Humidity: 53

Do you have any idea what causes this issue and how can I help?

img_7997

Reference time for 11A-characteristic (ContactSensor)

We are struggling with the reference time of the Last Activation characteristic for a fake Eve door ContactSensor.

Wiki says:
seconds since last reset

However, Eve app always shows Just now for the last opening event.

@ebaauw uses something like this.hk.lastActivation = now - this.historyService.getInitialTime() but this shows in our case the same behavior.

History Storage and Access

Whilst the Eve app is one of the best Homekit apps around, I was wondering whether it is possible to access the history data for Eve devices from outside the app? If the app can pull the data from say its weather device could some other interface do it so that it became available in say Node-Red?

History not showing for Energy type

I'm trying to implement energy consumption history into this plugin. It appears to be creating the fakeGatoHistoryService, adding entries, and writing entries to disk properly, but I still cannot see history in the Eve app.

I also have the homebridge-weather-station-extended plugin installed it's working fine. When the Eve app is refreshed, there will be activity in the log where fakegato-history sends new weather entries to the Eve app, but not so for the energy consumption history I'm trying to implement.

I've noticed nothing in the fakeGatoHistoryService is being assigned an iid, they all remain null and I suspect this is why it's not working, but I can't figure out why this is happening or how to fix it. Any pointers?

I've uploaded a copy of my code here, and this is a sample of the fakegatoHistoryService (iids bolded):

FakeGatoHistory {
displayName: 'Computer History',
UUID: 'E863F007-079E-48FF-8F27-9C2605A29F52',
subtype: undefined,
iid: null,
characteristics:
[ Characteristic {
displayName: 'Name',
UUID: '00000023-0000-1000-8000-0026BB765291',
iid: null,
value: 'Computer History',
status: null,
eventOnlyCharacteristic: false,
props: [Object],
subscriptions: 0,
_events: [Object],
_eventsCount: 1 },
S2R1Characteristic {
displayName: 'S2R1',
UUID: 'E863F116-079E-48FF-8F27-9C2605A29F52',
iid: null,
value: '9eMFAAAAAAATibQgBAECAgIHAg8DOgLADwAAAAAAAAAAAQE=',
status: null,
eventOnlyCharacteristic: false,
props: [Object],
subscriptions: 0,
_events: [Object],
_eventsCount: 1 },
S2R2Characteristic {
displayName: 'S2R2',
UUID: 'E863F117-079E-48FF-8F27-9C2605A29F52',
iid: null,
value: null,
status: null,
eventOnlyCharacteristic: false,
props: [Object],
subscriptions: 0,
_events: [Object],
_eventsCount: 2 },
S2W1Characteristic {
displayName: 'S2W1',
UUID: 'E863F11C-079E-48FF-8F27-9C2605A29F52',
iid: null,
value: null,
status: null,
eventOnlyCharacteristic: false,
props: [Object],
subscriptions: 0,
_events: [Object],
_eventsCount: 2 },
S2W2Characteristic {
displayName: 'S2W2',
UUID: 'E863F121-079E-48FF-8F27-9C2605A29F52',
iid: null,
value: null,
status: null,
eventOnlyCharacteristic: false,
props: [Object],
subscriptions: 0,
_events: [Object],
_eventsCount: 2 } ],
optionalCharacteristics: [],
isHiddenService: false,
isPrimaryService: false,
linkedServices: [],
size: 4032,
minutes: 5,
storage: 'fs',
path: '/homebridge',
filename: undefined,
disableTimer: false,
accessoryName: 'Computer',
log:
{ [Function: bound ]
debug: [Function],
info: [Function],
warn: [Function],
error: [Function],
log: [Function],
prefix: 'TP Link' },
loaded: true,
accessoryType116: '04 0102 0202 0702 0f03',
accessoryType117: '1f',
accessoryType: 'energy',
firstEntry: 0,
lastEntry: 569,
history:
[ 'noValue',
{ time: 1527009683, setRefTime: 1 },
{ power: 22, time: 1527009683 },
{ power: 21.9, time: 1527010510 },
{ power: 27.3, time: 1527011567 },
{ power: 68, time: 1527012167 },
{ power: 0, time: 1527013284 },
{ power: 0, time: 1527013884 },
{ power: 0, time: 1527014484 },
{ power: 0, time: 1527015084 },
{ power: 0, time: 1527015684 },
{ power: 0, time: 1527016284 },
{ power: 0, time: 1527016884 },
{ power: 0, time: 1527017484 },
{ power: 0, time: 1527018084 },
{ power: 0, time: 1527018684 },
{ power: 0, time: 1527019284 },
{ power: 0, time: 1527019884 },
{ power: 0, time: 1527020484 },
{ power: 0, time: 1527021084 },
{ power: 0, time: 1527021684 },
{ power: 0, time: 1527022284 },
{ power: 0, time: 1527022884 },
{ power: 0, time: 1527023484 },
{ power: 0, time: 1527024084 },
{ power: 0, time: 1527024684 },
{ power: 0, time: 1527025284 },
{ power: 0, time: 1527025884 },
{ power: 0, time: 1527026484 },
{ power: 0, time: 1527027084 },
{ power: 0, time: 1527027684 },
{ power: 0, time: 1527028284 },
{ power: 0, time: 1527028884 },
{ power: 0, time: 1527029484 },
{ power: 0, time: 1527030084 },
{ power: 0, time: 1527030684 },
{ power: 0, time: 1527031284 },
{ power: 0, time: 1527031884 },
{ power: 0, time: 1527032484 },
{ power: 0, time: 1527033084 },
{ power: 0, time: 1527033684 },
{ power: 0, time: 1527034284 },
{ power: 0, time: 1527034884 },
{ power: 0, time: 1527035484 },
{ power: 0, time: 1527036084 },
{ power: 0, time: 1527036684 },
{ power: 0, time: 1527037284 },
{ power: 0, time: 1527037884 },
{ power: 0, time: 1527038484 },
{ power: 0, time: 1527039084 },
{ power: 0, time: 1527039684 },
{ power: 0, time: 1527040284 },
{ power: 0, time: 1527040884 },
{ power: 0, time: 1527041484 },
{ power: 0, time: 1527042084 },
{ power: 0, time: 1527042684 },
{ power: 0, time: 1527043284 },
{ power: 0, time: 1527043884 },
{ power: 0, time: 1527044484 },
{ power: 0, time: 1527045084 },
{ power: 0, time: 1527045684 },
{ power: 0, time: 1527046284 },
{ power: 0, time: 1527046884 },
{ power: 0, time: 1527047484 },
{ power: 0, time: 1527048084 },
{ power: 0, time: 1527048684 },
{ power: 0, time: 1527049284 },
{ power: 0, time: 1527049884 },
{ power: 0, time: 1527050484 },
{ power: 0, time: 1527051084 },
{ power: 0, time: 1527051684 },
{ power: 0, time: 1527052284 },
{ power: 0, time: 1527052884 },
{ power: 0, time: 1527053484 },
{ power: 0, time: 1527054084 },
{ power: 0, time: 1527054684 },
{ power: 0, time: 1527055284 },
{ power: 0, time: 1527055884 },
{ power: 0, time: 1527056484 },
{ power: 0, time: 1527057084 },
{ power: 0, time: 1527057684 },
{ power: 0, time: 1527058284 },
{ power: 0, time: 1527058884 },
{ power: 0, time: 1527059484 },
{ power: 0, time: 1527060084 },
{ power: 0, time: 1527060684 },
{ power: 0, time: 1527061284 },
{ power: 0, time: 1527061884 },
{ power: 0, time: 1527062484 },
{ power: 0, time: 1527063084 },
{ power: 0, time: 1527063684 },
{ power: 0, time: 1527064284 },
{ power: 51.1, time: 1527064884 },
{ power: 51.1, time: 1527065484 },
{ power: 51.1, time: 1527066084 },
{ power: 51.1, time: 1527066684 },
{ power: 51.1, time: 1527067284 },
{ power: 51.1, time: 1527067884 },
{ power: 51.1, time: 1527068484 },
{ power: 51.1, time: 1527069084 },
... 470 more items ],
memorySize: 4032,
usedMemory: 569,
currentEntry: 1,
transfer: false,
setTime: true,
refTime: 548702483,
memoryAddress: 0,
dataStream: '',
saving: false,
initialTime: 1527009683 }

Cheers!

Feature request: make timer subscription optional

I'd like to be able to specify per accessory whether the logging service should subscribe to the fakegato timer. A lot of ZigBee sensors report their state periodically, which I can use easily to create periodic entries.

Also, for plugins that poll devices and cache their state it's quite easy to create periodic entries every n-th polling cycle.

history energy monitor.

hi
EVE energy
What do you use as features to get the consumption chart, do you need a start date ??
or continue ??
How to solve it. thank you
Project and, total cost original, graph
59893065_327800631244050_4401598874259554304_n

homebridge with big fakegato history - start fails over 90 times, until set fakegato to false and back to true

Hello @simont77,

i have a very strange issue with fakegato-history. 😢
I implemented since a long time in homebridge-devolo.

I've had the problem many times when I was still using a Raspberry Pi. But after 5-10 minutes homebridge started normally and without errors. Back then I was thinking of Read / Write IOs? Or the fact that status changes (power consumption, motion detector, contact sensor) were tried to write while loading the faktegato-history. So I then added the isHistoryLoaded function to onCurrentValueChanged.

Whatever, after I moved my homebridge installation to an Intel i3 with SSD, I never had any problems again. Til today ...


I try to summarize it.

Homebridge tried 93 times ... until I intervened manually.

Mar 12 13:11:04 frida systemd[1]: homebridge1.service: Scheduled restart job, restart counter is at 93.

The debug log always looks similar, without a real error message the start process fails. I cannot send you the entire log with all 93 attempts - because it exceeds 220 MB. I attached the last attempts here as TXT (2.3 MB).

fakegato-01-true_failstart-over-90-times_cut.txt

Now it's getting interesting. I then deactivated fakegato for homebridge-devolo in config.json and homebridge started properly. (Logfile size 43 KB)

fakegato-02-false_now-starts-fine.txt

Then, I finished homebridge clean again, activated fakegato. Simsalabim! Homebridge now starts properly with activate fakegato. (Logfile 2.3 MB) Many many historical data.

fakegato-03-true-again-starts-fine.txt


Phew. Strange right? @simont77

Do you have any idea?

My thoughts:

  • Disable print all historical data?
  • Homebridge has obviously not ended "properly". Did fakegato-history attempt to write any cached / complete data at startup before isHistoryLoaded? Which was rejected after fakegato: false?

Thanks for your time.
Nico

eve chart axes

this is not an issue with fakegato, ... but:
is there a way to force eve to set y-axis min/max?
e.g. for indoor temperature i would like to have the axis starting from 0 instead of something around the min values.
i thought about setting the first values in the json manually to 0, but they would probably get overwritten in the future.... any ideas?

getInitialTime() returns undefined?

sorry - it's me again. I am doing a series of contact switches. while all other FakeGato mechanisms do work getInitialTime() always returns undefined. Any idea?

bildschirmfoto 2019-01-24 um 07 37 27

bildschirmfoto 2019-01-24 um 07 38 29

Latest Entry/value

Hello everyone,

First of all, thank you so much for this awesome work. Im using it with my Thermostat Plugin. Everything works fine.

So i wanted to create something new in regard of the Motion Sensors. And therefore i wanted to know if its possible to get the latest Entry (time, Status value) from Fakegato history

Does "Door" accessoryType work for someone?

When I use "motion" as the accessoryType I do see my motions in the history graph and in the data log. However, if I use "door", I don't see anything in the graph and if I click on the "..." it's just spinning and not showing any data?

Do someone else see the same issue?

"addEntry" for past timestamps vs. internal "10 minute filler"-timer

This should be more a discussion point than a real issue:

I modded a "if cellphone is pingable, person is at home"-homebridge plugin to act as a motion-sensor with EVE compatible history.

Because cellphones are not always connected to the wifi there is a 20minute period where the plugin tries to ping the phone. If it does not answer while these 20minutes, the state of the motion-sensor goes to false. At the same time a history entry is written with the timestamp of the last successful ping, which was 20min ago.

But it seems, that in the meantime fakegato's internal timer writes two filler entries with the - until now - correct values. But chronologically these two filler (with state=true) are after the manually set false-state. This results in a 20minutes long additional true-state after the cellphone last successful ping:

img_a398b5c590d3-1

Would it be best to disable the internal timer and let the plugin write it's own 10min-filler states (after a state change back till the pre-last state change) or is this something fakegato should/can handle?

polarity of contact sensor events

i have just added the fakegato-history to the homebridge-them platform plugin.

basic functionality is already very nice. but I have noticed some things:

  • I think the documented polarity for the contact sensor events is wrong. at least I have to store 1 for closed and 0 for open. otherwise the graph and the list of events is inverted.
    maybe the values follow the style of the CurrentDoorState characteristic instead of the ContactSensorState style?

  • as the contact sensor history will not work without the TimesOpened, SecondsOpened and SecodsClosed characteristics it would be nicht if fakegato would add them automatically and also cunt the events. the data is there :).

  • the same would be true for the LastActivation

would you accept a patch that adds support for these three?

  • maybe reset is also something that could be handed in fakegato then?

mix types in an accessory

Hi,

is there a way to mix types in an accessory?
e.g. my accessory has a temperature sensor service and a switch service (power), how can i log "temp" and "state" for it?

QUESTION: on set EveResetTotal

in addition to doing:

    history.getCharacteristic(CommunityTypes.EveResetTotal).updateValue(value)

should a call be made to history.cleanPersist() or something else to tell fakegato to clear the history?

thanks!

air quality history

I am trying hard to add air quality (ppm) history with fakegato - but no luck yet. the accessory always reports "not data". is there anywhere a good example or where can I find the specific conditions for this? contactSensor and temp/humidity works for me, but not air quality. PLEASE HELP!

Name of _persist.json file

I'm having some concerns on the fakegato-storage functionality, particularly the filenames used:

  • When using {storage: 'fs'} as option to FakeGatoHistory, it doesn't seem to make sense to use the hostname in the filename. Multiple instances of homebridge need to be run from a different user directory anyway, ensuring each instance logs to a different directory;
  • The accessory displayName is not guaranteed to be unique and might actually change over time. Also it might contain spaces. I'd rather see the accessory serial number in the filename. Still I would like to base the name of the history service on the accessory display name.

Arguably, not every-one might share my concerns. Both issues could be addressed by adding an additional filename option to the FakeGatoHistory, so each plugin can control their own behaviour.

History not showing in Elgato EVE

Hi,

i've created some new accessories with fakegato. Everthing seems to work correctly.
How can i force the accessory to show the history? I've tried to remove the accessory from the homebridge and readd it again. Nothing happens. Is there a other solution than to completly remove the homebridge?

regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.