grzegorz914 / homebridge-denon-tv

Homebridge plugin for Denon/Marantz AV Receivers, publish as independent external platform accessory.
MIT License
74 stars 15 forks source link

Toggle for Buttons #85

Closed intrepidsilence closed 2 years ago

intrepidsilence commented 3 years ago

When creating a new button for something like PS LFC ON/ OFF is there a way to make that a toggle rather than separate buttons for each on and off?

intrepidsilence commented 3 years ago

Since Homebridge keeps up with beta releases I got your last push. Now I can't even assign PS LFC any more and the interface is becoming more restrictive. Could you update this report with your plans for buttons since the code is changed but the docs are not?

grzegorz914 commented 3 years ago

The button functions are hard coded in the code, You have choice to select what function You want to use, just use Config UI X and plugin settings menu. No need manually edit the config.json

intrepidsilence commented 3 years ago

Yes, I see that. The issue is that it appears that you have not added everything in the standard. For example the item that I am trying to use is called Audyssey LFC. I see it on the spreadsheet bu no way to choose it now with the new method.

Also, since you are making buttons work differently, will you be making a single button that is either on or off for stateful switches like the PS LFC item, or will we have stateless ON and OFF buttons that are separate?

grzegorz914 commented 3 years ago

U mean the lack of options in the Inputs list? Not the buttons. I will add it tomorrow again to the input modes list.

The buttons are stateless, some function are available also as toggle function, just look in the functions list where is ON/OFF.

intrepidsilence commented 3 years ago

Unfortunately I do not know what you mean. If you mean Audyssey LFC ON/OFF would be in the same scroll wheel as picking HDMI 1 then that is not what I think is a workable solution. This has all kinds of issues. Is that what you mean?

To be more specific on my side, PS LFC is not stateless. It has the command PS LFC ? to get the state.

grzegorz914 commented 3 years ago

PS LFC and many more can U now select from available functions.

intrepidsilence commented 3 years ago

Agreed. I can now add the PS LFC buttons. Thanks!

I have an idea around these buttons regarding the state. Since some of them are stateful, it may be possible to split them into those that are stateful (where the status can be requested) and those that are not. Let the ones that are not stateful be handled the way they are today (in 3.10) and make a new method for handling the ones with state so that they switches/buttons are stateful with them. Might even be good to split a third class off for those that have a value that could be represented with a slider.

I know this might be a lot. Just something to consider as this plugin grows. I might even start hacking on this in the background and let you know if I come up with anything useful (but might be a while due to my time constraints right now).

grzegorz914 commented 3 years ago

Represent the state of function corespondent with button is no problem, the problem is get the data from receiver. I do not know the right request to get the state of all this functions from receiver. The standard request - function and ?, always get empty respose.

I will working on it to get the plugin more comfortable. Also the HomeKit does not allow represent all what we need. If I create some custom Characteristics like in other my plygin, eg. enphase-envoy then the HomeKit app display it as unsupported. Workaround is use other app like Controller or EVE app.

If U have some god idea free to pull request. Thanks for correct my readme.md.

intrepidsilence commented 3 years ago

I see. I have been able to use other projects that link to the receiver and use the ? and get a response just fine. Perhaps there is an issue with escape sequences around the ? to make it not get interpreted before being sent? Or maybe it needs to be sent as a code rather than the character itself to prevent interpretation.

Anyway, I am happy that I have been able to help with the docs. Not done yet. I hope to keep going.

intrepidsilence commented 3 years ago

I did find a python2 based project that is able to query the status of items correctly. It is called MarantzIP. It looks like it clears some kind of buffer on the device and then asks the question. Here is a transaction to get the PW? status from that project:

>>> avr.get_power()
Testing existing connection... [CONNECTED]
Resetting timer.
Clearing previous buffer... ZMOFF\rPWSTANDBY\rZ2OFF\rSSINFAISSIG 02\rSSINFAISFSV 48K\rOPINFINS 22111111111111000000\rOPINFASP 22121100000000000110000000000000\rSSINFSIGRES I4K:60Hz\rSSINFSIGRES O --- \rSSAUDSTS 1202122021000000\rSSAST CMP\rOPSTS 0000000000000000000000200220\r
Sending: \'PW?\r\'
Looking for: \'PW([^\r]+)\r\'
Response: PWSTANDBY\r
Resetting timer.
{'PW': 'STANDBY'}