MiguelRipoll23 / homebridge-securitysystem

Homebridge plugin that creates a security system accessory that can be triggered by HomeKit sensors.
https://www.npmjs.com/package/homebridge-securitysystem
MIT License
153 stars 13 forks source link

Request: Alarm Log #106

Closed jsiegenthaler closed 3 years ago

jsiegenthaler commented 3 years ago

I'd like to see a separate Alarm Log

It should record:

Yes, I know it is logged to Homebridge logs

But if I come back from a few days away and the neighbors tell me my alarm was triggered, then I want to know when and why, and going through thousands of lines of Homebridge logs is slow and cumbersome.

MiguelRipoll23 commented 3 years ago

Are you talking about an independent log file, right?

jsiegenthaler commented 3 years ago

Yeah. Write a log to a file on the raspberry pi. Then users can view it on their devices using Shortcuts. I do that to log people arriving and leaving.

MiguelRipoll23 commented 3 years ago

Custom path? Or the log file can be written in the plugin installation directory for example?

jsiegenthaler commented 3 years ago

Good question. I write my person logs to pi/Public and share the folder with all pi users. I think for flexibility I would suggest a logFolder config item, where the user can specify his own log folder. Then it would be up to the user to decide where, and what permissions.

PS: I'm now loving the Security System, now that I understand it. I now have it configured for automatic Home, Night and Away modes, and it broadcasts a voice message to the whole house when the alarm is triggered (I have 3 x Sonos speakers in 3 corners of the house).

MiguelRipoll23 commented 3 years ago

Thank you for the additional details, appreciate the feedback. A beta update will be released at the weekend with the feature and its own option to configure the log path.

Thanks!

MiguelRipoll23 commented 3 years ago

It's now available in the beta channel for testing:

npm install -g homebridge-securitysystem@beta

It will rename the log if the day changes to keep it current.

Thanks!

jsiegenthaler commented 3 years ago

Thanks. i installed 4.3.0-beta.1 and will monitor it over the weekend

jsiegenthaler commented 3 years ago

OK, I observed the following

I configured a path. and it was inaccessible. So I deleted the configured path, and the relevant section of the config looks like this:

            "test_mode": false,
            "log_directory": "",
            "override_off": false,

Now the plugin throws the following error on startup:

[17/04/2021, 15:09:07] [Security System] File logger (Error)
[17/04/2021, 15:09:07] [Security System] [Error: EACCES: permission denied, open '/securitysystem.log'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'open',
  path: '/securitysystem.log'
}

I think you may be only checking for a null log_directory. I then removed the config item completely Now the plugin starts without error

it looks like deleting the configured path using the config schema is insufficient to remove the config item from the config

MiguelRipoll23 commented 3 years ago

Thanks for testing! Fixed in beta 2.

MiguelRipoll23 commented 3 years ago

Is the implementation right? It will be released to the general public shortly.

jsiegenthaler commented 3 years ago

I haven't got it working yet. Ive been busy with other stuff

MiguelRipoll23 commented 3 years ago

Feature is now in the stable channel, feel free to reopen if there's anything you would like to change.

Thanks!