simont77 / fakegato-history

Module to emulate Elgato Eve history
MIT License
167 stars 15 forks source link

Does "Door" accessoryType work for someone? #58

Closed ctschach closed 6 years ago

ctschach commented 6 years ago

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?

simont77 commented 6 years ago

For "door" you have to add all the extra characteristics to the ContactService

ctschach commented 6 years ago

Can you give me a hint, what characteristics are needed.

simont77 commented 6 years ago

See here https://github.com/ebaauw/homebridge-lib/blob/master/lib/EveHomeKitTypes.js for extra characteristics in Door and here https://github.com/simont77/fakegato-history/wiki/Services-and-characteristics-for-Elgato-Eve-devices for meaning

simont77 commented 6 years ago

// Used in Eve Door this.createService('ContactSensor', hap.Service.ContactSensor.UUID, [ hap.Characteristic.ContactSensorState, eve.Characteristic.TimesOpened, eve.Characteristic.OpenDuration, eve.Characteristic.ClosedDuration, eve.Characteristic.LastActivation ])

ctschach commented 6 years ago

Thanks for all your help...meanwhile I was able to get the things running....

matopeto commented 3 years ago

Hi sorry for comment to closed question, i create ContactSensor and add all eve characteristics:

this.alarmService = new Service.ContactSensor(this.name + " Alarm");
this.alarmService.addCharacteristic(CustomCharacteristic.OpenDuration);
this.alarmService.addCharacteristic(CustomCharacteristic.ClosedDuration);
this.alarmService.addCharacteristic(CustomCharacteristic.TimesOpened);
this.alarmService.addCharacteristic(CustomCharacteristic.LastActivation);
this.alarmService.addCharacteristic(CustomCharacteristic.ResetTotal);

this.alarmService.log = this.log;
this.alarmLoggingService = new FakeGatoHistoryService("door", this.alarmService, {
  storage: this.storage,
  minutes: this.refresh * 10 / 60,
});
this.alarmLoggingService.subtype = "alarm";

And when i logging like this:

var state = notDetected ? Characteristic.ContactSensorState.CONTACT_NOT_DETECTED : Characteristic.ContactSensorState.CONTACT_DETECTED;

this.alarmService.setCharacteristic(Characteristic.ContactSensorState, state);
this.alarmLoggingService.addEntry({
  time: moment().unix(),
  status: state
})

But in eve app shows no data for contact history

Do i need do sometihig else? Compute and set those characteristicts?

Thank you for answers

simont77 commented 3 years ago

Does the history appear (even if empty) or not? I'm not completely sure that the subtype is well accepted by Eve.

matopeto commented 3 years ago

@simont77 hi thank you for answer

subtype is only for homebridge, when i add two FakeGatoHistoryService services (one for temperature one for alarm). I will try create only one alarm service but i think it is not issue. (it is standart way to add more service same type)

Yes all characteristics are displayed in EVE app but without history. Opened state is not working too. GUI shows loading but no data, homebridge logs seems OK, i see adding and retrieving history

IMG_9248

simont77 commented 3 years ago

Yes, try to add only one FakeGatoService. Eve's real accessory has only one, I don't know what will happen with 2 in the same Accessory, since they will use the same Characteristics to speak with Eve.

matopeto commented 3 years ago

i have two accessories and two fakegato services, one per accessory, but i will try and i let you known :)

simont77 commented 3 years ago

Two accessories and two fakegato is ok. If the log are ok, but data is not appearing if may be some issue with time. Check that ios and homebridge are reasonably on time and in the same time zone. Eve will not show event is the future. If your history start time was set in the future you have to reset the history in the app. Unfortunately where is no way to do that when no data is shown apart from reinstalling Eve. A workaround is to change accessory name and serial, so that it is considered a new one. Also check that the name and serial only use valid character (see on the readme).

matopeto commented 3 years ago

Other fakegato service displays history data OK (for temperature and/or humidity), so i think homebridge and ios timezone and time is ok (and i see in your source code that you use unixtimestamp and it is timezone independent). Both accessory has different name. (door/contact service has " alarm" suffix)

this is current code snippet of getServices method:


   // Information Service
var informationService = new Service.AccessoryInformation();

informationService
    .setCharacteristic(Characteristic.Manufacturer, "homebridge-rtl_433")
    .setCharacteristic(Characteristic.SerialNumber, hostname + "-" + this.name)
    .setCharacteristic(Characteristic.FirmwareRevision, require('./package.json').version);

this.sensorService = new Service.TemperatureSensor(this.name);

this.sensorService
    .getCharacteristic(Characteristic.CurrentTemperature)
    .setProps({
        minValue: -100,
        maxValue: 100
    });

this.timeoutCharacteristic = Characteristic.CurrentTemperature;
this.timeout = setTimeout(deviceTimeout.bind(this), this.deviceTimeout * 60 * 1000); // 5 minutes

this.sensorService.log = this.log;
this.loggingService = new FakeGatoHistoryService("weather", this.sensorService, {
    storage: this.storage,
    minutes: this.refresh * 10 / 60
});
if (this.alarm !== undefined) {
    this.alarmService = new Service.ContactSensor(this.name + " Alarm");
    this.alarmService.addCharacteristic(CustomCharacteristic.OpenDuration);
    this.alarmService.addCharacteristic(CustomCharacteristic.ClosedDuration);
    this.alarmService.addCharacteristic(CustomCharacteristic.TimesOpened);
    this.alarmService.addCharacteristic(CustomCharacteristic.LastActivation);
    this.alarmService.addCharacteristic(CustomCharacteristic.ResetTotal);

    this.alarmService.log = this.log;
    this.alarmLoggingService = new FakeGatoHistoryService("door", this.alarmService, {
        storage: this.storage,
        minutes: this.refresh * 10 / 60,
    });
    this.alarmLoggingService.subtype = "alarm";
    debug("XXX Subtype", this.alarmLoggingService.subtype)
    debug("XXX getServiceId()", this.alarmLoggingService.getServiceId())
    informationService
        .setCharacteristic(Characteristic.Model, "Temperature Sensor with Alarm @ " + this.alarm);
} else {
    informationService
        .setCharacteristic(Characteristic.Model, "Temperature Sensor");
}

if (this.alarm !== undefined) {
    return [informationService, this.sensorService, this.alarmService, this.loggingService, this.alarmLoggingService];
} else {
    return [informationService, this.sensorService, this.loggingService];
}

I will try later today remove all other accessory code and test only one accessory with one history service and if it will not working i will attach code and homebridge logs.

Thank you for cooperation :)

matopeto commented 3 years ago

@simont77 you was right, i created one accessory with two services: temperature and contact which each has own logging service. And this was problem for EVE app.

If i create only one contact service with history - it is working for "times opened" but not for "contact" state history, and also "Last Opened" info is wrong (i think it shows time of first log entry)

I manage to this state: https://github.com/simont77/fakegato-history/issues/29#issuecomment-378197180

But now i known that problem is in my code and as you say, I must simulate real eve door device as much is possible :)

PS: logs seems OK:

[1/19/2021, 20:13:31] [rtl_433] **Fakegato-timer: addData  Door obyvacka Alarm { time: 1611083611, status: 0 }  immediate:  true
[1/19/2021, 20:13:31] [rtl_433] **Fakegato-timer callbackDoor:  Door obyvacka Alarm , immediate:  true , entry:  { time: 1611083611, status: 0 }
[1/19/2021, 20:13:31] [rtl_433] First entry Door obyvacka Alarm: 0
[1/19/2021, 20:13:31] [rtl_433] Last entry Door obyvacka Alarm: 2
[1/19/2021, 20:13:31] [rtl_433] Used memory Door obyvacka Alarm: 2
[1/19/2021, 20:13:31] [rtl_433] 116 Door obyvacka Alarm: 0000000000000000db66b72501 06010300c00f00000000000000000101
[1/19/2021, 20:13:58] [rtl_433] Data request Door obyvacka Alarm: 01140000000000
[1/19/2021, 20:13:58] [rtl_433] Address requested Door obyvacka Alarm: 0
[1/19/2021, 20:13:58] [rtl_433] Door obyvacka Alarm Entry: 2, Address: 2
[1/19/2021, 20:13:58] [rtl_433] Data Door obyvacka Alarm:  1501000000 0100 0000 81db66b7250000 0000 00 0000 0b 02000000000000000100
[1/19/2021, 20:19:45] [rtl_433] **Fakegato-timer callbackDoor:  Door obyvacka Alarm , immediate:  false , entry:  { time: 1611083985, status: 0 }
[1/19/2021, 20:19:45] [rtl_433] First entry Door obyvacka Alarm: 0
[1/19/2021, 20:19:45] [rtl_433] Last entry Door obyvacka Alarm: 3
[1/19/2021, 20:19:45] [rtl_433] Used memory Door obyvacka Alarm: 3
[1/19/2021, 20:19:45] [rtl_433] 116 Door obyvacka Alarm: 7601000000000000db66b72501 06010400c00f00000000000000000101
[1/19/2021, 20:20:10] [rtl_433] Data request Door obyvacka Alarm: 01140300000000
[1/19/2021, 20:20:10] [rtl_433] Address requested Door obyvacka Alarm: 3
[1/19/2021, 20:20:10] [rtl_433] Door obyvacka Alarm Entry: 3, Address: 3
[1/19/2021, 20:20:10] [rtl_433] Data Door obyvacka Alarm:  0b 03000000760100000100
[1/19/2021, 20:22:27] [rtl_433] **Fakegato-timer: addData  Door obyvacka Alarm { time: 1611084147, status: 1 }  immediate:  true
[1/19/2021, 20:22:27] [rtl_433] **Fakegato-timer callbackDoor:  Door obyvacka Alarm , immediate:  true , entry:  { time: 1611084147, status: 1 }
[1/19/2021, 20:22:27] [rtl_433] First entry Door obyvacka Alarm: 0
[1/19/2021, 20:22:27] [rtl_433] Last entry Door obyvacka Alarm: 4
[1/19/2021, 20:22:27] [rtl_433] Used memory Door obyvacka Alarm: 4
[1/19/2021, 20:22:27] [rtl_433] 116 Door obyvacka Alarm: 1802000000000000db66b72501 06010500c00f00000000000000000101
[1/19/2021, 20:22:27] [rtl_433] Data request Door obyvacka Alarm: 01140400000000
[1/19/2021, 20:22:27] [rtl_433] Address requested Door obyvacka Alarm: 4
[1/19/2021, 20:22:27] [rtl_433] Door obyvacka Alarm Entry: 4, Address: 4
[1/19/2021, 20:22:27] [rtl_433] Data Door obyvacka Alarm:  0b 04000000180200000101
[1/19/2021, 20:24:40] [rtl_433] **Fakegato-timer: addData  Door obyvacka Alarm { time: 1611084280, status: 1 }  immediate:  true
[1/19/2021, 20:24:40] [rtl_433] **Fakegato-timer callbackDoor:  Door obyvacka Alarm , immediate:  true , entry:  { time: 1611084280, status: 1 }
[1/19/2021, 20:24:40] [rtl_433] First entry Door obyvacka Alarm: 0
[1/19/2021, 20:24:40] [rtl_433] Last entry Door obyvacka Alarm: 5
[1/19/2021, 20:24:40] [rtl_433] Used memory Door obyvacka Alarm: 5
[1/19/2021, 20:24:40] [rtl_433] 116 Door obyvacka Alarm: 9d02000000000000db66b72501 06010600c00f00000000000000000101
[1/19/2021, 20:27:04] [rtl_433] Clock adjust Door obyvacka Alarm: 086ab725
[1/19/2021, 20:27:04] [rtl_433] Data request Door obyvacka Alarm: 01140500000000
[1/19/2021, 20:27:04] [rtl_433] Address requested Door obyvacka Alarm: 5
[1/19/2021, 20:27:04] [rtl_433] Door obyvacka Alarm Entry: 5, Address: 5
[1/19/2021, 20:27:04] [rtl_433] Data Door obyvacka Alarm:  0b 050000009d0200000101
[1/19/2021, 20:27:06] [rtl_433] Clock adjust Door obyvacka Alarm: 0a6ab725