Coder Social home page Coder Social logo

homebridge-http-motion-sensor's Introduction

homebridge-http-motion-sensor

This plugin offers you a motion sensor that can be triggerd via an HTTP request. This can be used in conjunction with an ESP8266 for instance or an Arduino with an ethernet shield. I will add an example Arduino script in the future.

Installation

Run the following command

npm install -g homebridge-http-motion-sensor

Chances are you are going to need sudo with that.

Config.json

This is an example configuration

"accessories" : [

    {
        "accessory": "http-motion-sensor",
        "name": "Hallway Motion Sensor",
        "port": 18089,
        "serial" : "E642011E3ECB",
        "bind_ip" : "0.0.0.0",
        "repeater" : [
                {
                    "host" : "192.168.2.11",
                    "port" : "22322",
                    "path" : "/turnonscreentilltimeout",
                    "auth" : "username:password"
                }
            ]
    }
]
Key Description
accessory Required. Has to be "http-motion-sensor"
name Required. The name of this accessory. This will appear in your homekit app
port Required. The port that you want this plugin to listen on. Choose a number above 1024.
serial Optional. Assigns a serial number. Not really required but I would advise in making up some arbitrary string.
repeater Optional. Whenever the http server setup by this plugin is hit, it will also make a request to each entry in this array. I am using it to turn on a screen in my hallway. See this for further information.
bind_ip Optional. If you know what this is, you'll know what to do with it.

homebridge-http-motion-sensor's People

Contributors

dependabot[bot] avatar lucavb avatar normen avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

homebridge-http-motion-sensor's Issues

1.1.0 causes UUID error

Updating to 1.1.0 causes my homebridge server to crash on boot because of a supposed UUID mismatch.. Something seems to go wrong with setting the accessory names.

The setup booted fine before with the same config:

        {
            "name": "Melder Eingang",
            "port": 8301,
            "accessory": "http-motion-sensor"
        },
        {
            "name": "Melder Indy",
            "port": 8302,
            "accessory": "http-motion-sensor"
        }

Heres the Error stack trace, for both accessories it's the same UUID:

Feb 14 21:56:31 homebridge homebridge[28515]: [2020-2-14 21:56:31] [Melder Eingang] Initializing http-motion-sensor accessory...
Feb 14 21:56:31 homebridge homebridge[28515]: [2020-2-14 21:56:31] Error: Cannot add a Characteristic with the same UUID as another Characteristic in this Service: 00000023-0000-1000-8000-0026BB765291
Feb 14 21:56:31 homebridge homebridge[28515]:     at AccessoryInformation.Service._this.addCharacteristic (/usr/local/lib/node_modules/homebridge-http-motion-sensor/node_modules/hap-nodejs/dist/lib/Service.js:79:27)
Feb 14 21:56:31 homebridge homebridge[28515]:     at new AccessoryInformation (/usr/local/lib/node_modules/homebridge-http-motion-sensor/node_modules/hap-nodejs/dist/lib/gen/HomeKit.js:3332:15)
Feb 14 21:56:31 homebridge homebridge[28515]:     at HomebridgeHttpMotionSensor.prepareServices (/usr/local/lib/node_modules/homebridge-http-motion-sensor/dist/index.js:30:36)
Feb 14 21:56:31 homebridge homebridge[28515]:     at new HomebridgeHttpMotionSensor (/usr/local/lib/node_modules/homebridge-http-motion-sensor/dist/index.js:21:14)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:308:29)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:91:38)
Feb 14 21:56:31 homebridge homebridge[28515]:     at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:59:10)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Module._compile (internal/modules/cjs/loader.js:701:30)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Module.load (internal/modules/cjs/loader.js:600:32)
Feb 14 21:56:31 homebridge homebridge[28515]:     at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Function.Module._load (internal/modules/cjs/loader.js:531:3)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
Feb 14 21:56:31 homebridge homebridge[28515]:     at startup (internal/bootstrap/node.js:283:19)
Feb 14 21:56:31 homebridge homebridge[28515]:     at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Feb 14 21:56:31 homebridge homebridge[28515]: Uncaught exception error:  Error: Cannot add a Characteristic with the same UUID as another Characteristic in this Service: 00000023-0000-1000-8000-0026BB765291
Feb 14 21:56:31 homebridge homebridge[28515]:     at AccessoryInformation.Service._this.addCharacteristic (/usr/local/lib/node_modules/homebridge-http-motion-sensor/node_modules/hap-nodejs/dist/lib/Service.js:79:27)
Feb 14 21:56:31 homebridge homebridge[28515]:     at new AccessoryInformation (/usr/local/lib/node_modules/homebridge-http-motion-sensor/node_modules/hap-nodejs/dist/lib/gen/HomeKit.js:3332:15)
Feb 14 21:56:31 homebridge homebridge[28515]:     at HomebridgeHttpMotionSensor.prepareServices (/usr/local/lib/node_modules/homebridge-http-motion-sensor/dist/index.js:30:36)
Feb 14 21:56:31 homebridge homebridge[28515]:     at new HomebridgeHttpMotionSensor (/usr/local/lib/node_modules/homebridge-http-motion-sensor/dist/index.js:21:14)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:308:29)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:91:38)
Feb 14 21:56:31 homebridge homebridge[28515]:     at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:59:10)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Module._compile (internal/modules/cjs/loader.js:701:30)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Module.load (internal/modules/cjs/loader.js:600:32)
Feb 14 21:56:31 homebridge homebridge[28515]:     at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Function.Module._load (internal/modules/cjs/loader.js:531:3)
Feb 14 21:56:31 homebridge homebridge[28515]:     at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
Feb 14 21:56:31 homebridge homebridge[28515]:     at startup (internal/bootstrap/node.js:283:19)
Feb 14 21:56:31 homebridge homebridge[28515]:     at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Sensor with no detection

I added the sensor in home app, but there always NO in Motion Detected.
This is from my config.json, I have also tried port 554 from rtsp stream, 465 from smtp,...:
"accessories": [{
"accessory": "http-motion-sensor",
"name": "xyz Motion Sensor",
"port": 8080,
"serial": "",
"repeater": [{
"host": "192.168.1.3",
"port": "8081",
"path": "/turnonscreentilltimeout",
"auth": "admin:password"
What should I do? Please help.

Regards W

Cannot read property "on" of undefined

TypeError: Cannot read property 'on' of undefined May 12 22:31:20 raspberrypi homebridge[3930]: at new HomebridgeHttpMotionSensor (/usr/local/lib/node_modules/homebridge-http-motion-sensor/dist/index.js:39:18) May 12 22:31:20 raspberrypi homebridge[3930]: at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:308:29) May 12 22:31:20 raspberrypi homebridge[3930]: at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:91:38) May 12 22:31:20 raspberrypi homebridge[3930]: at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:59:10) May 12 22:31:20 raspberrypi homebridge[3930]: at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22) May 12 22:31:20 raspberrypi homebridge[3930]: at Module._compile (internal/modules/cjs/loader.js:1158:30) May 12 22:31:20 raspberrypi homebridge[3930]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10) May 12 22:31:20 raspberrypi homebridge[3930]: at Module.load (internal/modules/cjs/loader.js:1002:32) May 12 22:31:20 raspberrypi homebridge[3930]: at Function.Module._load (internal/modules/cjs/loader.js:901:14) May 12 22:31:20 raspberrypi homebridge[3930]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)

just after an update :(

Strange behaviour at hb restart

Hi,
recently is happening that every time i reboot HB, some of homebridge-http-motion-sensor trigger Independently. (causing me wake up during the night 🙁 )

I see that’s homebridge restart and http motion sensor trigger is happening at the same hour that’s alexa receive the trigger

[2/12/2022, 05:03:43] Homebridge v1.6.0 (HAP v0.11.0) (Homebridge 258E) is running on port 51376.
[2/12/2022, 05:03:43] [SvegliaAlexa] The device 'SvegliaAlexa' can now be reached under http://0.0.0.0:18089

IMG_B91FC17C487B-1

Please is there any way to stop this behaviour?
Thanks

Limiting service to one network

My current implementation is using your service to provide motion detection from BlueIris (video application). It works reliably which is always a good thing :)

With that said, my server has both a private and public network. I would like to limit the http service to the private network. Obviously the current service was not written to support this but it would be nice addition in opinion. Maybe a config.json option that allows the ability to define the network address?

On another note the only oddity I have noted (I think it might be related to having two networks) is that it fires two (2) homekit notifications for each detection. After looking at the code its not obvious why this is happening.

Homebridge dependency warning

Hi there,

We've noticed your plugin is using homebridge as a prod-dependency.

Homebridge should only be included in plugins as a dev-dependency and used for TypeScript types.

In the next release of we are changing Homebridge to only export types and const enums which can be safely used in your code and not result in Homebridge becoming a runtime dependency.

Please also make sure you are using TypeScript 3.8 or later.

You can test this out using the current beta of Homebridge:

npm install --save-dev homebridge@beta

For examples of how to use Homebridge in a plugin for types/enums only see:

Arduino Script/Sketch

Hi there!

Could you please add an example Arduino Script/Sketch/.ino-File for this Homebridge-Plugin?

Cheers,
Dan

How does the triggering work ?

Hi

can i trigger this http-motion sensor from my edimax doorcam with http post ? (which hhtp string?)
how long the motion sensor will be "triggered" ? because the cam sends a http POST/GET comand when motion is detected ... but no comand when motion is over.....

regards, Richard

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.