toto / homebridge-airrohr

HomeBridge module for the DIY luftdaten.info particulates sensor. See http://luftdaten.info how to build your own
http://luftdaten.info
MIT License
52 stars 12 forks source link

Enhancement: Add history to sensor data #4

Closed honkmaster closed 6 years ago

honkmaster commented 6 years ago

Using fakegato-history, you can simply add a history functionality to your sensors. The history, then will be available in the Elgato Eve App. I first seen this feature in homebridge-dht, and really like it. homebridge-airrohr could replicate an Elgato Eve Room device, e.g.:

this.loggingService.addEntry({time: moment().unix(), temp:this.temperature, humidity:this.humidity, ppm:this.ppm});

See: https://github.com/simont77/fakegato-history

h0lz commented 6 years ago

That would be nice. +1 :)

DJay-X commented 6 years ago

@toto Any chance to see ongoing development integrating fakegato-history? Would be awesome. Wouldn't want to miss homebridge-airrohr and fakegato would be the cherry on top. :) Thanks in advance for the time you are investing and sharing you work with us.

toto commented 6 years ago

@DJay-X I published 1.1.6 which contains #14 and #17 so history should be supported

DJay-X commented 6 years ago

@toto First, thanks for your work. I already updated to v1.1.6 restart homebridge but didn't see any history starting to record. Am I doing anything wrong or missed something than just updating your plugin? Thanks.

img_0966

brandungskieker commented 6 years ago

@DJay-X just wait about one day. Fakegato obviously don't show any graph if no historical data are available.

DJay-X commented 6 years ago

Thanks @brandungskieker But shouldn't there be at least a drop down arrow and an empty graph field saying "no data" at the moment? Anyways.. I will check tomorrow again. Thanks again for your reply.

DJay-X commented 6 years ago

It's working here. History is filling. Thx. 👍🏻

toto commented 6 years ago

Perfect!

Mischaaaaa commented 5 years ago

@toto Thank you for the hard work and support.

I installed homebridge and fakegato-history like this: sudo npm install -g homebridge-airrohr sudo npm install -g fakegato-history

I run homebridge with the following command: DEBUG=* homebridge -D

Connection with HomeKit is there and also temperature, humidity, PM2.5 and PM10 shows up correctly in Eve on my iPhone. For temperature and humidity the history is also there.

However history for PM2.5 and PM10 is missing: no data available I think it has something to do with the fact that it isn't stored in the file *._persist.json. See below:

[7/12/2019, 8:18:50 AM] [AirRohr] Measured temperature 17.5 °C [7/12/2019, 8:18:50 AM] [AirRohr] Measured humidity 97.2 % [7/12/2019, 8:18:50 AM] [AirRohr] Measured PM2.5 44.7 µg/m³ [7/12/2019, 8:18:50 AM] [AirRohr] Measured PM10 59.8 µg/m³ [7/12/2019, 8:18:50 AM] [AirRohr] Fakegato-timer: addData AirRohr { time: 1562912330, temp: 17.5, pressure: null, humidity: 97.2 } immediate: false [7/12/2019, 8:18:51 AM] [AirRohr] Fakegato-timer: executeCallbacks [7/12/2019, 8:18:51 AM] [AirRohr] First entry AirRohr: 0 [7/12/2019, 8:18:51 AM] [AirRohr] Last entry AirRohr: 497 [7/12/2019, 8:18:51 AM] [AirRohr] Used memory AirRohr: 497 [7/12/2019, 8:18:51 AM] [AirRohr] 116 AirRohr: 4f910c00000000007ccccb2203 0102 0202 03029804c00f00000000000000000101 [7/12/2019, 8:18:51 AM] [AirRohr] Fakegato-storage write FS file: /home/linaro/.homebridge/tinkerboard_AirRohr_persist.json "firstEntry":0,"lastEntry":1175,"usedMemory":1175,"refTime":583781500,"initialTi [7/12/2019, 8:18:51 AM] [AirRohr] Fakegato-timer: emptyData AirRohr [7/12/2019, 8:21:50 AM] [AirRohr] Measured temperature 17.6 °C [7/12/2019, 8:21:50 AM] [AirRohr] Measured humidity 97.1 % [7/12/2019, 8:21:50 AM] [AirRohr] Measured PM2.5 45.57 µg/m³ [7/12/2019, 8:21:50 AM] [AirRohr] Measured PM10 61.47 µg/m³ [7/12/2019, 8:21:50 AM] [AirRohr] **Fakegato-timer: addData AirRohr { time: 1562912510, temp: 17.6, pressure: null, humidity: 97.1 } immediate: false

Can you confirm this and tell me how I can solve this?

Thanks in advance.

Regards, Mischa