Skip to content
This repository has been archived by the owner on Oct 25, 2019. It is now read-only.

Unable to launch module configuration #4

Open
Molkobain opened this issue Oct 27, 2018 · 16 comments
Open

Unable to launch module configuration #4

Molkobain opened this issue Oct 27, 2018 · 16 comments

Comments

@Molkobain
Copy link
Contributor

Molkobain commented Oct 27, 2018

Describe the bug
Exception thrown when launching module configuration from Gladys backend.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Gladys backend > Modules menu
  2. Click on Configuration on the module's row
  3. Nothing happens in the backend but there is the error below showing up in the logs
  4. No device is shown in the Devices menu (I'm able to access it through the Onkyo Android app)
Unhandled rejection TimeoutError: operation timed out
    at afterTimeout (/opt/gladys/api/hooks/onkyo/node_modules/bluebird/js/release/timers.js:46:19)
    at Timeout.timeoutTimeout [as _onTimeout] (/opt/gladys/api/hooks/onkyo/node_modules/bluebird/js/release/timers.js:76:13)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)

Informations:

  • OS: Raspbian 8 (Jessie)
  • Gladys version: 3.10.3
  • Node version: 10.12.0
  • Module version: 1.1.1
  • Onkyo Model: TX-NR515
@VonOx
Copy link
Owner

VonOx commented Oct 27, 2018

I have some timeout also with my onkyo avr. I need to completly shutdown and power on. (remove plug)

@Molkobain
Copy link
Contributor Author

I tried that but got no luck 😕
Maybe the receiver is too old and not compatible.

@VonOx
Copy link
Owner

VonOx commented Oct 28, 2018

No it's OK your model is compatible.

Can you test the python version?

https://github.com/miracle2k/onkyo-eiscp

@Molkobain
Copy link
Contributor Author

Molkobain commented Oct 28, 2018

The python version works, I tried the following commands:

$ onkyo --discover
TX-NR515        192.168.xx.yy:zzzz     0009B0CAxyz
$ onkyo -i 0009B0CAxyz volume=2
TX-NR515: master-volume = 2
$ onkyo -i 0009B0CAxyz volume=20
TX-NR515: master-volume = 20
$ onkyo -i 0009B0CAxyz volume=15
TX-NR515: master-volume = 15

That being said, it takes arount 5s to execute which seems to be quite long no?

@VonOx
Copy link
Owner

VonOx commented Oct 29, 2018

@Molkobain good catch , 5s is to mutch.

I have no idea on how to solve this...

@VonOx
Copy link
Owner

VonOx commented Oct 29, 2018

Can you test on other Platform ( not rpi ) ?

@Molkobain
Copy link
Contributor Author

Do you mean your module through another Gladys device or the python lib? I'm gonna set up an Ubuntu VM :)

@VonOx
Copy link
Owner

VonOx commented Oct 29, 2018

No just the python lib is ok

@Molkobain
Copy link
Contributor Author

Molkobain commented Oct 29, 2018

Tested on 2 Ubuntu VMs (17.04 & 18.04), the python lib takes less than 1 second when a give both the --host and --port parameters. Around 3-4 seconds when I just give --id parameter.

On the RPi with --host and --port it takes around 3-4s. Yesterday I was giving only the --id parameter when I measured 5s.

@Molkobain
Copy link
Contributor Author

What command do you send to the receiver? I saw in the package.json that there is a dependancy to the onkyo.js package, but I didn't found it in npm.

@VonOx
Copy link
Owner

VonOx commented Oct 29, 2018

Weird because it is available

Sources are here https://github.com/jupe/onkyo.js

I use a discover function

@Molkobain
Copy link
Contributor Author

From what I see in the lib, using the discover function takes some time as it broadcasts to the whole network and waits for answers.

I tried to modify your lib/onkyo.setup.js to make it use the Onkyo object instead of the OnkyoDiscover with the following code:

const {Onkyo} = require('onkyo.js');
const onkyo = Onkyo({address: '192.168.xx.yy'});
sails.log.debug(onkyo);

And I got results!

Onkyo {
  domain: null,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined,
  logger:
   { debug:
      { [Function: debug]
        namespace: 'onkyo.js',
        enabled: false,
        useColors: true,
        color: 2,
        destroy: [Function: destroy],
        extend: [Function: extend],
        inspectOpts: {} },
     ...,
  device:
   { name: 'onkyo',
     address: '192.168.xx.yy',
     port: 60128,
     info: undefined },
  _client: null,
  _buffer: <Buffer >,
  deviceState: {},
  powerOn: [Function: f],
  powerOff: [Function: f],
  powerStatus: [Function: f],
  ...

So the lib is working with this receiver, just a timeout issue maybe. I'll check into onkyo.js to see if the timeout comes from it or my nodejs server.

Note: As you can see, the onkyo.device.info is undefined so I to manually populate it in order for your setup script to complete.

@VonOx
Copy link
Owner

VonOx commented Oct 29, 2018

If you create device and devicetype manually in Gladys the setup is useless.

The timeout come from bluebird promise.
I want to handle this behavior and document manual setup.

And thank you for feedback 😊

@Molkobain
Copy link
Contributor Author

Maybe this is a lead. Do you where dependancies are stored? I could try to hack the timeout part to see if it solves the problem.

@Molkobain
Copy link
Contributor Author

If you create device and devicetype manually in Gladys the setup is useless.

Yeah obviously, I wanted to run it like this to be sure what the issue was (and create the deviceTypes in the process)

@VonOx
Copy link
Owner

VonOx commented Oct 29, 2018

It's stored in node_module folder

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants