alexryd / node-shellies

Handles communication with Shelly devices
MIT License
36 stars 13 forks source link

Offline not emitting #15

Closed donoli1st closed 3 years ago

donoli1st commented 4 years ago

Hi In my Project the Offline will not be emitted.

I used it like in the description: device.on('offline', () => { // the device went offline console.log('Device with ID', device.id, 'went offline') }) i also used: this.shellies.staleTimeout = 1000; also with tifferend times, but it never emitted..

Maybe someone could give me a hint, why.. i could if you wna't also give more info about the project. The change and discover emitt as normal..

(Sorry for the english, not native)

donoli1st commented 4 years ago

i did the offline/online by my self, with a setTimeout and "isReachable"..

But do you have a clue, why i can't get the name of the Shelly? There is a option in the Shelly GUI where one could put a name to the shelly.. but in the "discover" phase of your tool, i don't get the "name" property, it's always "undefined"

Also i think the "setAuthCredentials" didn't do any thing... at least for me..

alexryd commented 4 years ago

Are you sure it should be this.shellies.staleTimeout and not shellies.staleTimeout?

Device names aren't included in the CoAP API. After a device has been discovered, you can retrieve the name using the HTTP API by calling the device.getSettings() method.

setAuthCredentials() will affect all subsequent HTTP requests.