foxy82 / hacs-onkyo-repository

Onkyo Async component to be used whilst waiting for the official version to be updated.
7 stars 0 forks source link

2 extra/bogus Zones generated #3

Open taw123 opened 9 months ago

taw123 commented 9 months ago

My Onkyo has only 2 zones but like the "offical" Integration it seems this integration has unfortunately generated 4 zones.

I am left with same problem unfortunately. I filed my feature request for the orignal integration ( that spawned a discussion/creation of this integration year ago)one can't delete or modify devices in this integration (outside the YAML platform definition) I can't delete these bogus zones that are cluttering the default UI pages.

Any suggestions on how to purge these bogus zones/entities. It can't be done from the configuration override (which I am using to add the model number as an attribute to this integration.

My questions where is the device definition made that defines the number of zones? This dosen't SEEM to be created dynamically from the platform YAML as mine only has 2 zones defined by 4 entities/zones created

  - platform: onkyo_async
    host: 192.168.42.86
    name: "Onkyo AVR Living Room"
    max_volume: 78
    sources:
      cd: "Amazon"
      fm: "fm"
      net: "net"
      video1: "DirectTV"
      video2: "AppleTV"
      video3: "Games"
      video4: "Aux"
      video6: "MacMini"
    zones:
      zone2:
        name: Onkyo Dining Room zone
        max_volume: 78

Thanks!

foxy82 commented 9 months ago

At the moment I'm looking to see if I can add config flow to the official integration with no other changes.

My plan is then to port that config flow (hopefully with zero changes) to this integration.

When I do that I'll create them with unique IDs which will hopefully mean you can remove them.

Also hopefully that will pave the way to get the async version into the official code base.

Daneish commented 9 months ago

Thank you for your update plans! I have been using your integration for quite a few months (maybe a year) and it has been great. Wishing you good luck navigating the treacherous terrane of getting changes merged into Core, but let me know if you need any testing, happy to help with that.

taw123 commented 9 months ago

Let me thank you again for picking up the torch here after the death/closure of the uber PR last year. I am also presently surprised to see that you are planning planning to revise the original integration (though I HOPE that it won't meet a similar fate, since you are agreeing to do it in multiple steps as was demanded originally)... which of course Let me apologize up front for my lack of knowledge regarding HA & HACS internals (as "former" engineer, I have been reverse engineering and tinkering to try to come up to speed).

Assumptions: (to put what are more accurately termed guesses more kindly...)

  1. Current integration here ALREADY includes config_flow (as implemented by klaashoekstra94 in the PR referenced above
  2. Thus you are planing to factor it out and back port (just) that config flow to the mainline/system integration for step 1 (as zthe comments in the original PR demanded). If the config flow wasn't already part of that/this integration then I THINK I understand your reasoning for doing this as it's needed for BOTH integration at some point.

Result:

  1. This also would mean that if I wanted to be able to manage the entities created by an Onkyo Integration via UI (which of course requires unique IDs), I wouldn't need to go move BACK to the built in integration (when HA gets around to qualifying and scheduling it for release), but stay on this fork and hold until HA ACCEPTS the future PR with the config flow, and you can then port the config flows to THIS integration with unique IDs.
  2. The result then SHOULD be an integration HERE should be an integration that uses same/current async lib but with config flow (potential removal of YAML config) and config flow revision to create unique IDs.

Observation/Questions (general):

  1. Would it be possible to revise THIS integration to add config flow (if it doesn't AREADY have) with unique IDs? In this way creating a validated test platform/goal state THEN for factored submission to HA? THAT (factored) submission containing unique ID/config flow could be processed by HA admin/approval at their own pace/process with the added benefit of not your progress and activities here on THIS integration? I propose that not merely out of self interest but given the well known past effort(s) to update the system Onkyo integration and a desire to not see the past repeated. If you have to/choose to wait until they approve and deliver the config flow BEFORE adding the config flow & unique ids here it could be a veery long time before you can move to you planed step 2....
  2. I do see how this would be more effort for you than the logical plan you suggested of the simple back port of config flow (IF present here), as it would mean effectively removing/unifying that part of the current forked from the code base here, though wouldn't you STILL have to change the flow to ADD support for unique ID regardless thus again adding support to my suggestion you add that support here FIRST? (again I need to learn more about internals to truly weigh in here). But given the past statement that they want many small changes rather than a large monolithic release that may be another reason you are considering 2 config submissions.

Offer of assistance and receiver model customization (listening mode, zones supported, other device specifics):

I am willing to help code/test/vet/whatever you would find helpful. As I said I have a reasonably logical approach and willing to go with what you think best. I will again stated through that I don't know python, and only have VERY rudimentary knowledge of HA internals gained from hacking and reverse engineering with huge gaps in some key areas though I am striving to address).

Finally at the risk of potentially delaying/derailing all the good you are/have done I wonder if it is possible to use the model specific data in miracle2k / onkyo-eiscp to create the actual configs? This would allow for creation of entities that contain the CORRECT listening modes and zones (of particular concern to me) as well as the inputs (currently addressed by user entered YAML) ? May thinking is of course this would be a LATER step. Ideally after the creation of a process to MANUALLY enter listening modes (either YAML or config UI). What do you think? Again I'm assuming there is no way to do this today short of manually revising and overriding the component's media_player.py which I would be open as well to do personally as workaround on the road to a more universal solution that would benefit all.

Thanks again and please don't take any of may questions as anything but reverent quests for knowledge and a sincere desire to assist any way you think makes sense. Also if you want to discuss the specifics of my config (erroneously generated extra zones) that were the original reason for this issue I am more than willing to do that as well.

All the best! --T

taw123 commented 9 months ago

Apologies to for the bad form of following up to my OWN (very long) post...

I MAY have found part of the problem (again since I don't know exactly how the integration works internally I am just guessing)...

I managed to use eISCP to view the ACTUAL data from my receiver and it seem Onkyo themselves may actually be part of the problem. So despite their own documentation (published through their own protocol doc- ISCP_AVR_1.46.xls) saying that zone 3 and zones 4 have NO valid codes for my receiver (TX-NR636), a query of the receiver using NRIQSTN (Network Receiver Info- Query, I think) returns 4 zones but clearly shows zones 3 & 4 have a = 0

I reformatted the XML returned for legibility.

HomeAssistant:/config# onkyo -v --host 192.168.42.86 NRIQSTN
sending to TX-NR636: NRIQSTN
TX-NR636: NRI

<?xml version="1.0" encoding="utf-8"?>
<response status="ok">
    <device id="TX-NR636">
        <brand>ONKYO</brand>
        <category>AV Receiver</category>
        <year>2014</year>
        <model>TX-NR636</model>
        <destination>Dx</destination>
        <firmwareversion>2051-5110-2001-0602-0203</firmwareversion>
        <netservicelist count="16">
            <netservice id="0e" value="1" name="TuneIn" account="Username" password="Password" />
            <netservice id="04" value="1" name="Pandora" account="Email" password="Password" />
            <netservice id="05" value="0" name="Rhapsody" account="Username" password="Password" />
            <netservice id="03" value="1" name="SiriusXM Internet Radio" account="User Name" password="Password" />
            <netservice id="06" value="0" name="Last.fm Internet Radio" account="User Name" password="Password" />
            <netservice id="08" value="1" name="Slacker Personal Radio" account="Email" password="Password" />
            <netservice id="0a" value="1" name="Spotify" account="Username" password="Password" />
            <netservice id="0b" value="1" name="AUPEO! PERSONAL RADIO" account="User Name" password="Password" />
            <netservice id="0d" value="0" name="e-onkyo music" />
            <netservice id="0c" value="0" name="radiko.jp" />
            <netservice id="10" value="0" name="simfy" account="Username or email address." password="Password" />
            <netservice id="0f" value="0" name="MP3tunes" account="Email" password="Password" />
            <netservice id="12" value="1" name="Deezer" account="Email address" password="Password" />
            <netservice id="01" value="1" name="My Favorites" />
            <netservice id="00" value="1" name="DLNA" />
            <netservice id="11" value="1" name="Home Media" account="User Name" password="Password" />
        </netservicelist>
        <zonelist count="4">
            <zone id="1" value="1" name="Main" volmax="80" volstep="1" />
            <zone id="2" value="1" name="Zone2" volmax="80" volstep="1" />
            <zone id="3" value="0" name="Zone3" volmax="0" volstep="1" />
            <zone id="4" value="0" name="Zone4" volmax="0" volstep="1" />
        </zonelist>
        <selectorlist count="26">
            <selector id="10" value="1" name="BD/DVD    " zone="03" iconid="10" />
            <selector id="01" value="1" name="Apple TV  " zone="03" iconid="01" />
            <selector id="00" value="1" name="DirecTV   " zone="03" iconid="00" />
            <selector id="02" value="1" name="Games     " zone="03" iconid="02" />
            <selector id="02" value="0" name="" zone="00" iconid="02" />
            <selector id="04" value="0" name="" zone="00" iconid="04" />
            <selector id="05" value="1" name="Mac Mini  " zone="03" iconid="05" />
            <selector id="03" value="1" name="AUX       " zone="01" iconid="03" />
            <selector id="26" value="0" name="" zone="00" iconid="26" />
            <selector id="25" value="1" name="AM" zone="03" iconid="25" />
            <selector id="24" value="1" name="FM" zone="03" iconid="24" />
            <selector id="23" value="1" name="Amazon    " zone="03" iconid="23" />
            <selector id="22" value="1" name="PHONO     " zone="03" iconid="22" />
            <selector id="2b" value="1" name="NET" zone="03" iconid="2b" />
            <selector id="29" value="1" name="USB" zone="03" iconid="29" />
            <selector id="29" value="0" name="" zone="00" iconid="29" />
            <selector id="2a" value="0" name="" zone="00" iconid="2a" />
            <selector id="2c" value="0" name="" zone="00" iconid="2c" />
            <selector id="2e" value="1" name="BLUETOOTH" zone="03" iconid="2e" />
            <selector id="07" value="0" name="" zone="00" iconid="10" />
            <selector id="08" value="0" name="" zone="00" iconid="01" />
            <selector id="09" value="0" name="" zone="00" iconid="00" />
            <selector id="80" value="1" name="Source" zone="02" />
            <selector id="44" value="0" name="" zone="00" iconid="44" />
            <selector id="45" value="0" name="" zone="00" iconid="45" />
            <selector id="41" value="0" name="" zone="00" iconid="41" />
        </selectorlist>
        <presetlist count="40">
            <preset id="01" band="1" freq="88.50" name="" />
            <preset id="02" band="1" freq="106.90" name="" />
            <preset id="03" band="1" freq="103.70" name="" />
            <preset id="04" band="1" freq="101.30" name="" />
            <preset id="05" band="1" freq="99.70" name="" />
            <preset id="06" band="1" freq="97.30" name="" />
            <preset id="07" band="1" freq="96.50" name="" />
            <preset id="08" band="1" freq="94.90" name="" />
            <preset id="09" band="1" freq="105.30" name="" />
            <preset id="0a" band="1" freq="107.70" name="" />
            <preset id="0b" band="1" freq="104.50" name="" />
            <preset id="0c" band="0" freq="0" name="" />
            <preset id="0d" band="0" freq="0" name="" />
            <preset id="0e" band="0" freq="0" name="" />
            <preset id="0f" band="0" freq="0" name="" />
            <preset id="10" band="0" freq="0" name="" />
            <preset id="11" band="0" freq="0" name="" />
            <preset id="12" band="0" freq="0" name="" />
            <preset id="13" band="0" freq="0" name="" />
            <preset id="14" band="0" freq="0" name="" />
            <preset id="15" band="0" freq="0" name="" />
            <preset id="16" band="0" freq="0" name="" />
            <preset id="17" band="0" freq="0" name="" />
            <preset id="18" band="0" freq="0" name="" />
            <preset id="19" band="0" freq="0" name="" />
            <preset id="1a" band="0" freq="0" name="" />
            <preset id="1b" band="0" freq="0" name="" />
            <preset id="1c" band="0" freq="0" name="" />
            <preset id="1d" band="0" freq="0" name="" />
            <preset id="1e" band="0" freq="0" name="" />
            <preset id="1f" band="0" freq="0" name="" />
            <preset id="20" band="0" freq="0" name="" />
            <preset id="21" band="0" freq="0" name="" />
            <preset id="22" band="0" freq="0" name="" />
            <preset id="23" band="0" freq="0" name="" />
            <preset id="24" band="0" freq="0" name="" />
            <preset id="25" band="0" freq="0" name="" />
            <preset id="26" band="0" freq="0" name="" />
            <preset id="27" band="0" freq="0" name="" />
            <preset id="28" band="0" freq="0" name="" />
        </presetlist>
        <controllist count="32">
            <control id="Bass" value="1" zone="1" min="-10" max="10" step="2" />
            <control id="Treble" value="1" zone="1" min="-10" max="10" step="2" />
            <control id="Center Level" value="1" zone="1" min="-12" max="12" step="1" />
            <control id="Subwoofer Level" value="1" zone="1" min="-15" max="12" step="1" />
            <control id="Subwoofer1 Level" value="0" zone="1" min="-15" max="12" step="1" />
            <control id="Subwoofer2 Level" value="0" zone="1" min="-15" max="12" step="1" />
            <control id="Phase Matching Bass" value="1" />
            <control id="LMD Movie/TV" value="1" code="MOVIE" position="1" />
            <control id="LMD Music" value="1" code="MUSIC" position="2" />
            <control id="LMD Game" value="1" code="GAME" position="3" />
            <control id="LMD THX" value="0" code="04" position="4" />
            <control id="LMD Stereo" value="1" code="00" position="4" />
            <control id="LMD Direct" value="0" code="01" position="1" />
            <control id="LMD Pure Audio" value="0" code="11" position="2" />
            <control id="TUNER Control" value="1" />
            <control id="TUNER Freq Control" value="0" />
            <control id="Info" value="1" />
            <control id="NoVideoInfo" value="0" />
            <control id="NoAudioInfo" value="0" />
            <control id="Cursor" value="1" />
            <control id="Home" value="1" code="HOME" position="2" />
            <control id="Quick" value="1" code="QUICK" position="1" />
            <control id="Menu" value="0" code="MENU" position="1" />
            <control id="AMP Control(RI)" value="0" />
            <control id="CD Control(RI)" value="0" />
            <control id="CD Control" value="0" />
            <control id="BD Control(CEC)" value="1" />
            <control id="TV Control(CEC)" value="1" />
            <control id="NoPowerButton" value="0" />
            <control id="DownSample" value="0" />
            <control id="Dimmer" value="0" />
            <control id="time_hhmmss" value="1" />
        </controllist>
        <functionlist count="6">
            <function id="UsbUpdate" value="0" />
            <function id="NetUpdate" value="0" />
            <function id="WebSetup" value="1" />
            <function id="WifiSetup" value="1" />
            <function id="Nettune" value="0" />
            <function id="Initialize" value="0" />
        </functionlist>
    </device>
</response>

Does this integration pull data any data from the receiver using the Onkyo commands?

I'm also curious if we/I can perhaps add support for Onkyo's OSD/popup to push info in XML to the screen since this also seems to be clearly published and supported by at least the RAW Onkyo commands that the integration's library is built on...

Again trying to understand the relationship btwn the support libraries used and the actually integration.

Thank for any guidance.

taw123 commented 8 months ago

Not to push you, but hopefully provide additional diagnostic info when you should find yourself again working on this integration...

To troubleshoot, yesterday, I tried removing the integration and all remnants of original HA-Onkyo integration from my system and config.YAML. Which finally removing ALL Onkyo based media_players....

Confirmed both in Lovelace and by confirming they were indeed removed from the system in the entity browser from Dev Tools (as well as scanning through .storage)

When I added the Onkyo-Async back (via HACS custom repo), and added the config originally posted, all 4 Zones were re-created (which I BELEVE is consistent with the system based Onkyo Integration). I did look at the code a bit to see what it was matching to determine Zone count when/if you decide to fix the library.

--T