simont77 / fakegato-history

Module to emulate Elgato Eve history
MIT License
168 stars 16 forks source link

getInitialTime() returns undefined? #66

Closed thncode closed 5 years ago

thncode commented 5 years ago

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
simont77 commented 5 years ago

InitialTime is set upon the first entry is actually written into the history. It means that you may have to wait the internal fakegato time. What accessory type is yours? also, if you are using a debugger you can see how the fakegato structure is.

simont77 commented 5 years ago

Are you using file persistence? If so, fakegato will wait for the history to be loaded before adding any entry or setting the initialTime variable. You can check if the is history is loaded with isHistoryLoaded

thncode commented 5 years ago

I see. Could the missing initialTime be a result of switching from 0.4.0 to 0.5.3 while developing the contact sensor accessory?

simont77 commented 5 years ago

There was no change to initialTime from 0.4.0 to 0.5.3, but the retrieving mechanism for the persisted history was improved. I suggest you to try with 0.5.3 without persistence, then switch on filesystem persistence removing the previous history file, and check what happens I

thncode commented 5 years ago

Can you give me a hint how to switch from persisted history to non-persisted and back?

simont77 commented 5 years ago

it is configured with the constructor. Refer to https://github.com/simont77/fakegato-history#history-persistence

thncode commented 5 years ago

I solved it. for some strange reason the history file was 0 length and could not be overwritten by the plugin. after deletion everything worked like it should... Thx!