simont77 / fakegato-history

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

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

Closed ebaauw closed 6 years ago

ebaauw commented 6 years ago

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
ebaauw commented 6 years ago

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?

Bloody hell, I added the 118 and 119 characteristics and Eve now displays both the Contact history as well as the Reset Count.

simont77 commented 6 years ago

Good to know it worked for you.

ebaauw commented 6 years ago

Just released homebridge-hue@0.5.68 with fakegato for OpenClose sensors.

grover commented 6 years ago

@ebaauw 👍 This makes your hue plugin so much more useful. Thank you!

Samfox2 commented 6 years ago

@ebaauw @simont77 we like to add fakegato history to the homebridge-homematic plugin (contact service) and it seems that we got the same problem as you. As both characteristics "times opened" and "reset total" are working, the upper "duration" diagram in Eve shows "No Data available" and a busy wheel. Characteristics 118 and 119 are added but there must be a problem. What exactly did you assign to those characteristics?
Source is here: https://github.com/thkl/homebridge-homematic/tree/contact-service