Code Monkey home page Code Monkey logo

Comments (7)

coricidin12 avatar coricidin12 commented on August 27, 2024 1

the "ready" event still isn't firing, but I am getting connect and disconnect events now. Thanks.

from unifi-events.

AlfaJackal avatar AlfaJackal commented on August 27, 2024

Nothing? No problems at all or any help anyone?

from unifi-events.

AlfaJackal avatar AlfaJackal commented on August 27, 2024

Fixed it by myself.

from unifi-events.

coricidin12 avatar coricidin12 commented on August 27, 2024

How did you fix this? I can't get it to connect to my controller at all, ip of "http://192.168.xx.xx:8443". Does the controller need to have an SSL cert for this library to work?

It never fires the 'Connected To UniFi Controller' event and if when I issue a getDevices(), I get an error that says "error: self-signed certificate"

from unifi-events.

AlfaJackal avatar AlfaJackal commented on August 27, 2024

Have you set rejectUnauthorized: false?
This is for connecting to a controller without valid SSL cert.

from unifi-events.

coricidin12 avatar coricidin12 commented on August 27, 2024

yes, still doesn't work. Doesn't fire the connected event and when I issue getClients(), I get "bad request, this combination of host and port requires TLS".

This is my code:

`const UnifiEvents = require('unifi-events');

let unifi = new UnifiEvents({
controller: http://192.168.X.XX:8443,
username: settings.user,
password: settings.password,
rejectUnauthorized: false
})

unifi.on('ready', () => {
console.log('Connected To UniFi Controller')
})

unifi.on('connected', (data) => {
unifi.getAp(data.ap).then((ap) => {
sendNotification(Device *${data.hostname}* has Connected to *${data.ssid}* (${ap.name}) on channel ${data.channel}.)
})
})

unifi.on('disconnected', (data) => {
unifi.getAp(data.ap).then((ap) => {
sendNotification(Device *${data.hostname}* has Disconnected from *${data.ssid}* (${ap.name}))
})
})
unifi.getClients()`

from unifi-events.

AlfaJackal avatar AlfaJackal commented on August 27, 2024

You have configured HTTP instead of HTTPS.

Try controller: https://192.168.X.XX:8443,

from unifi-events.

Related Issues (10)

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.