Git Product home page Git Product logo

node-deepstackai-trigger's People

Contributors

dependabot[bot] avatar mattbho avatar mmbhatk avatar neilenns avatar rakeshdas1 avatar salcio avatar tonybrobston avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-deepstackai-trigger's Issues

Mock (?) webRequestHandler calls in dev builds

It's kind of annoying to see connection refused errors when doing development against this, since webRequest tries to make an actual HTTP call.

This isn't a problem for MQTT because a little MQTT server is running as part of the development docker stack.

Is there a tiny Docker container that exists with a super tiny web server on it that could be used? Is there a way to easily mock the call out to avoid the connection refused error in logs?

Replace some try/catch blocks with .catch()

There are quite a few places in the code where try/catch blocks with let variables just outside the try statement can be replaced with the cleaner .catch() method for handling errors.

Add a note to the readme about timezones

There's nothing in the readme about having to set TZ in the docker-compose.yml file. This is actually super important since without it all of the time checking around images doesn't work.

MQTT should be disabled by default

If MQTT is enabled but the configuration wasn't changed from the sample then the container will fail to come up because MQTT can't get connected.

This is a bad first user experience. MQTT should be opt-in.

Simple change to comment out one line in the docker-compose.yml file after #18 is fixed.

Scrub extensions in devcontainer.json

Only include extensions required for code hygiene. There's a bunch that don't strictly have to be there:

  • christian-kohler.npm-intellisense
  • mikestead.dotenv
  • github.vscode-pull-request-github

Double-check and make sure there aren't other ones that should be included too

Do some cleanup on the sample docker-compose.yml

  • Move secrets to the bottom since they don't need to be changed as long as the config files are in the same directory as the .yml file.
  • Add a comment to the time zone environment variable.
  • Add a comment about how to disable MQTT if it isn't needed.

Add updated contribution guidelines

  • All changes must be done in a feature branch, no direct merges in master
  • Anything making a change to src/ must roll the version number and update CHANGELOG.md

Add a dedicated cooldownTime for Telegram triggers

It's suuuuuuuper noisy without a separate cooldown timer for Telegram timers. Easy enough to add the value to the schema and plumb it through. The fun part will be managing it in TelegramManager.

It will likely require a map, key is the trigger name, value is the last trigger date. Then it's the same logic as in TriggerManager.

Make a base class for trigger handlers

All the trigger handlers should support the enabled property. It's dumb that there's now three separate classes that have enabled and all have the same default value behaviour in the constructor.

Generics to the rescue I think. Make a base class. Use generics to handle the partial object creation.

Document the trigger.config and mqtt.config properties

The trigger.config and mqtt.config properties will show documentation as you type if edited in VS Code but people shouldn't have to run VS Code just to find out what the various settings are.

Add some tables to the readme that outline all the properties.

Format the VS Code output window text

The logging messages were designed to be easily formatted in the VSCode output window. There's a way to do this using language service features, I think via a package.json extension, but I can't for the life of me find the page that described it.

Dig into this to figure out how to highlight lines in the output window.

This will probably require modifying the loggers to include info, warn, and error (which should be simple since they are all contained in the Log.ts file for this very reason).

Run this project in Visual Studio Codespaces

The project's been designed from the start to work in Remote - Dev Containers and, in theory, Visual Studio Codespaces.

Currently this is blocked by several Codespaces issues as the base image is node:alpine.

In theory once those two issues are resolved by Microsoft this should Just Work as a Codespace. Try it out and see. If it doesn't work open bugs here (if it's an issue in the project) or against Microsoft (more likely reason ๐Ÿ˜‚).

Document local DNS resolution for Docker

Right now if you just clone the repo and run docker-compose up you have to use local IP addresses, rather than domain names, to access machines on the local network (e.g. a BlueIris server, MQTT server, etc.)

It would be nice to figure out how to enable this, and:

  • Update the sample docker-compose.yml if necessary
  • Document any Docker Desktop changes required to make this work

Docker Desktop for Windows and Mac both default to Google DNS resolution. Maybe that's all that's necessary to change?

Set MQTT client ID

Right now no client ID is specified in the MQTT connection request so it's auto-generated by the underlying library.

It'd be better to set it to "node-deepstackai-trigger".

Add support for detection exclusion zones

The DeepStack API returns a bounding box for the detected object. If the object is one that's supposed to trigger (based on class), there should be an optional secondary check on whether the rectangle intersects at all with a list of defined exclusion zones in the trigger's configuration.

This will enable blocking out parts of an image that are prone to false positives.

Add a timestamp to the log messages

Docker Desktop doesn't show timestamps in the log so it's hard to tell what's going on. Add a timestamp in short date/time format to the front of all log messages.

Should be a simple change in Log.ts.

Document how to really set this up with BlueIris

That's the whole point to this project. There should be a specific readme on how to get this set up with Blue Iris, including how to configure a single camera. Reference The Hook Up for the walkthrough on how to configure the cameras.

Warning in webpack builds

Module not found: Error: Can't resolve 'utf-8-validate' in '/home/node/app/node_modules/ws/lib'

Whyyyyy?

Disabling MQTT doesn't work

Commenting out the mqtt secret in docker-compose.yml should be sufficient to disable MQTT. I swear I fixed this bug before but it looks like the code changes didn't get checked in.

The problem is in how handlers/mqttManager/MqttManager.ts throws an exception when fsPromise.readFile() fails. The reality is this shouldn't be an exception, it should just log and return null. Then farther up the chain can check for null and just return quietly.

This is the offending exception that should log and return null instead: https://github.com/danecreekphotography/node-deepstackai-trigger/blob/e5234b1c7a917ab060135456664085477a6edef5/src/handlers/mqttManager/MqttManager.ts#L90

This needs to check for a null response and return quietly: https://github.com/danecreekphotography/node-deepstackai-trigger/blob/e5234b1c7a917ab060135456664085477a6edef5/src/handlers/mqttManager/MqttManager.ts#L25

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.