Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Szene Switch button #9

Open
master2033 opened this issue Feb 15, 2018 · 13 comments
Open

Szene Switch button #9

master2033 opened this issue Feb 15, 2018 · 13 comments

Comments

@master2033
Copy link

Thanks for this plugin!
It works great. Could you add a scene switch?

Or does it depend on the AVR model that I have?

@mwittig
Copy link
Owner

mwittig commented Feb 15, 2018

Thanks for the positive feedback and for using this plugin!

Aren't the scene switches on the AVR what is covered by the YamahaAvrInputSelector?
(see https://github.com/mwittig/pimatic-yamaha-avr#yamahaavrinputselector). Did you try this?

As far as I understand this, the button id of the input selector must match the scene name given in capital letters (your owners manual should contain a summary of scene names). If your AVR has a printed button labeling it may be abbreviated in some cases, e.g. for the "Net" button the scene name is "NET RADIO". Unfortunately, there isn't a fixed list of scene names as these vary among the different AVR models and newer models even allow for changing the scene name. So, it may require a bit of poking to find the right scene name for your setup, but it should work.

@master2033
Copy link
Author

For the input sources I only have the following ones (see pictures in the appendix).

If I select the source "TV" as a rule I get an ERROR

My model is a HTR 4065 according to instructions is called the scene TV
yamaha input 1
yamaha input 2
yamaha input 3

@mwittig
Copy link
Owner

mwittig commented Feb 15, 2018

Which error do you get?

@mwittig
Copy link
Owner

mwittig commented Feb 16, 2018

I have digged a little deeper. The API specification documentation I'm aware of doesn't not even mention a "scene" concept, even though this feature has been provided with various AVRs in the past. Reading various manuals I came to the conclusion that "input selection" can't be the same than a "scene selection", even though some manuals are suggesting this (which is confusing). On one of the various libraries to control the AVR I have seen a (undocumented) scene command. I'll use this to draft a YamahaAvrSceneSelector which you can trial. So, please stay tuned.

@mwittig
Copy link
Owner

mwittig commented Feb 16, 2018

Released pimatic-yamaha-avr@0.9.4 which contains an experimental YamahaAvrSceneSelector device class. Basically, it has the same properties than the input selector. Note, there is no action definition for scenes, yet.

Please give it a try a let me know if it works for you. Please also provide some debug output which you can get if you enable and set the debug property of the plugin to true. Particularly, I am looking for the debug output similar to the following:

15:26:47.883 [pimatic-yamaha-avr] [Plugin] Requesting status update
15:26:47.884 [pimatic-yamaha-avr] [Plugin] Request: <YAMAHA_AV cmd="GET"><Main_Zone><Basic_Status>GetParam</Basic_Status></Main_Zone></YAMAHA_AV>
15:26:47.889 [pimatic-yamaha-avr] [Plugin] Response: {"YAMAHA_AV":{"$":{"rsp":"GET","RC":"0"},"Main_Zone":[{"Basic_Status":[{"Power_Control":[{"Power":["Off"]}],"Volume":[{"Mute":["Off"],"Lvl":[{"Val":["0"],"Exp":["1"],"Unit":["dB"]}]}],"Input":[{"Input_Sel":["TUNER"]}]}]}]}}

@master2033
Copy link
Author

master2033 commented Feb 16, 2018

I have tested the new plugin. The following is output in the logfile:

Unhandled rejection Error: Command <YAMAHA_AV cmd="PUT"><Main_Zone><Scene><Scene_Sel>TV</Scene_Sel></Scene></Main_Zone></YAMAHA_AV> failed with return code 3
    at /home/pi/pimatic-app/node_modules/pimatic-yamaha-avr/yamaha-avr.coffee:120:19
    at tryCatcher (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/async.js:17:14)
    at processImmediate [as _immediateCallback] (timers.js:383:17)

@mwittig
Copy link
Owner

mwittig commented Feb 16, 2018

OK, thanks. Too Bad! Error 3 is returned on "Invalid Request (A method did not exist, a method wasn’t appropriate etc.)"

@mwittig
Copy link
Owner

mwittig commented Feb 16, 2018

Can you please use Scene 1 instead of TV to see whether or not that works? Thanks!

EDIT: You may also try Scene 2, Scene 3, or Scene 4

@master2033
Copy link
Author

it works great. Right off the TV turns on and the AVR is on the right input.

Thank you so much.

Can I buy you a coffee or a beer?

@mwittig
Copy link
Owner

mwittig commented Feb 16, 2018

Beer preferred as weekend is approaching!

I think the functionality around scenes can still be made somewhat nicer. Basically, it is possible to read all the scene configuration from the receiver to get it filed into the device configuration. For the time being, you can manually assign scene names to the scene ids by using the the text property as shown below.

{
      "id": "avr-5",
      "name": "AVR Scene Selector",
      "class": "YamahaAvrSceneSelector"
      "buttons": [
           {
             "id": "Scene 1",
             "text": "TV"
           }
      ]
}

Can you please also post me the debug output for the basic status updates? Thanks

@mwittig
Copy link
Owner

mwittig commented Feb 18, 2018

@ccvh @joenex1 @M1rk0

Perhaps, you can also help with debugging the new feature? In particular, I would like to make sure status updates will be handled properly for scene selection.

@master2033
Copy link
Author

I have one more question.

it would be possible the error message for HOST not reachable. Off.

I would like to switch my technology as far as possible without power. Unfortunately, I then get the error message continuously.

error [pimatic-yamaha-avr]: [Plugin] Error: { [Error: connect EHOSTUNREACH 192.168.15.12:80] code: 'EHOSTUNREACH', errno: 'EHOSTUNREACH', syscall: 'connect', address: '192.168.15.12', port: 80, __trace: 'Error: From connect\n at Socket.connect (/home/pi/pimatic-app/node_modules/pimatic/startup.coffee:55:29)\n at Agent.exports.connect.exports.createConnection (net.js:68:26)\n at Agent.createSocket (_http_agent.js:180:16)\n at Agent.addRequest (_http_agent.js:149:23)\n at new ClientRequest (_http_client.js:142:16)\n at Object.exports.request (http.js:31:10)\n at new Request (/home/pi/pimatic-app/node_modules/pimatic-yamaha-avr/node_modules/restler-promise/node_modules/restler-base/lib/restler.js:76:26)\n at request (/home/pi/pimatic-app/node_modules/pimatic-yamaha-avr/node_modules/restler-promise/node_modules/restler-base/lib/restler.js:333:17)\n at Object.post (/home/pi/pimatic-app/node_modules/pimatic-yamaha-avr/node_modules/restler-promise/node_modules/restler-base/lib/restler.js:348:10)\n at /home/pi/pimatic-app/node_modules/pimatic-yamaha-avr/node_modules/restler-promise/lib/restler-promise.js:32:38\n at Promise._execute (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/debuggability.js:300:9)\n at Promise._resolveFromExecutor (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:483:18)\n at new Promise (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:79:10)\n at Object.post (/home/pi/pimatic-app/node_modules/pimatic-yamaha-avr/node_modules/restler-promise/lib/restler-promise.js:31:20)\n at /home/pi/pimatic-app/node_modules/pimatic-yamaha-avr/yamaha-avr.coffee:111:14\n at Promise._execute (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/debuggability.js:300:9)\n at Promise._resolveFromExecutor (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:483:18)\n at new Promise (/home/pi/pimatic-app/node_modules/pimatic/node_modules/bluebird/js/release/promise.js:79:10)\n at YamahaAvrPlugin.sendRequest (/home/pi/pimatic-app/node_modules/pimatic-yamaha-avr/yamaha-avr.coffee:109:14)\n at YamahaAvrPlugin._requestStatusUpdates (/home/pi/pimatic-app/node_modules/pimatic-yamaha-avr/yamaha-avr.coffee:86:8)\n at null._onTimeout (/home/pi/pimatic-app/node_modules/pimatic-yamaha-avr/node_modules/pimatic-plugin-commons/lib/index.js:311:27)\n at Timer.listOnTimeout (timers.js:92:15)' }

Thank you for the effort

@mwittig
Copy link
Owner

mwittig commented Feb 26, 2018

@master2033 Maybe you have overlooked my previous request on providing debug output. I'll need this to complete the implementation of the scene selector feature.

To obtain debug output you need to enable and set the debug property of the plugin to true. Particularly, I am looking for the debug output on the basic status updates, similar to the following:

15:26:47.883 [pimatic-yamaha-avr] [Plugin] Requesting status update
15:26:47.884 [pimatic-yamaha-avr] [Plugin] Request: <YAMAHA_AV cmd="GET"><Main_Zone><Basic_Status>GetParam</Basic_Status></Main_Zone></YAMAHA_AV>
15:26:47.889 [pimatic-yamaha-avr] [Plugin] Response: {"YAMAHA_AV":{"$":{"rsp":"GET","RC":"0"},"Main_Zone":[{"Basic_Statu

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

No branches or pull requests

2 participants