Code Monkey home page Code Monkey logo

Comments (11)

HendrikRoth avatar HendrikRoth commented on June 12, 2024

Tried it this way:

var device = self.config.arlo.devices[n.device]

  device.subscribe(function(error, response) {
    if (error) {
     console.log(error)
   }
   response.on('statusUpdate', function(msg) {
     console.log(msg)
   })
  }

from node-arlo.

adam-lynch avatar adam-lynch commented on June 12, 2024

@HendrikRoth any luck?

from node-arlo.

HendrikRoth avatar HendrikRoth commented on June 12, 2024

No :(

I am able to enable/disable the cameras, but still have no idea how to listen to motion events.

https://github.com/HendrikRoth/node-red-contrib-arlo

from node-arlo.

adam-lynch avatar adam-lynch commented on June 12, 2024

I found a way to figure out when motion is detected. In the found event (callback), there's something like device._____lastImage or device.device.______lastImage (per camera). Request that S3 image URL and save the last-modified header from the response. Every N seconds, request it again and if the last-modified has changed, that camera has detected motion.

from node-arlo.

devbobo avatar devbobo commented on June 12, 2024

Sorry, I haven't had the bandwidth to look at this issue until now.

I've just pushed version 0.0.4 which adds support for motion events.

var device = self.config.arlo.devices[n.device];

device.on('motionDetected', function(state) {
  //state is true for motion detected, false for no motion
});

from node-arlo.

HendrikRoth avatar HendrikRoth commented on June 12, 2024

Thank you, will look at it at the weekend!
For listening on state changes (arm/disarm), we have to listen on the basestation, or? i did not see any committed event for this.

from node-arlo.

devbobo avatar devbobo commented on June 12, 2024

You should be able to listen for those events like this...

basestation.on(Arlo.ARMED, function() {
  //todo
});

basestation.on(Arlo.DISARMED, function() {
  //todo
});

from node-arlo.

devbobo avatar devbobo commented on June 12, 2024

I should also note that Arlo.DISARMED and Arlo.ARMED listen for mode0 and mode1 respectively. The default modes that are created when you register your Arlo basestation.

If you create additional custom modes, they take the names mode2, mode3, etc. You can subscribe to these custom modes using...

basestation.on('mode2', function() {
  //todo
});

from node-arlo.

HendrikRoth avatar HendrikRoth commented on June 12, 2024

perfect, thank you for the hint. i have now the listening and the triggering part finished for arlo states. just need to look for the motion events at the weekend. thanks!

from node-arlo.

ajcooper72 avatar ajcooper72 commented on June 12, 2024

Sorry for jumping on this thread but having trouble getting events from working in my script. Here's the code;

arlo.login(ARLO_USERNAME, ARLO_PASSWORD, function () {
    arlo.getDevices(function () {
        for (let device in arlo.devices) {

            if (arlo.devices[device].device.deviceType == "basestation") {
                var basestation = arlo.devices[device];
                basestation.on(Arlo.ARMED, function () {
                    console.log("armed");
                });
        
                basestation.on(Arlo.DISARMED, function () {
                    console.log("disarmed");
                });
            }

            if (arlo.devices[device].device.deviceType == "camera") {
                var camera = arlo.devices[device];
                camera.on('motionDetected', function (state) {
                    //state is true for motion detected, false for no motion
                    console.log("motion");
                });
            }
        }
    })
})

It's logging in, finding the devices (I've tested outputting the ID's) but none of the events are triggering.

For reference, node -v is showing v8.11.1.

Any pointers would be appreciated.

from node-arlo.

github-actions avatar github-actions commented on June 12, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from node-arlo.

Related Issues (20)

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.