Yamahareceiver Binding problems

@zarusz I installed the new version and everything seems to work well. I think this is a brilliant solution. Thanks a lot.

I really like this solution. You should create a PR for it

Thanks everyone for the feedback. Yes, the plan is to make a PR once we test this. I know the input selection was a pain due to differences between models. I have added some documentation to the addon README, that will make its way to the PR.

Now, I propose we drop the existing mapping logic coded into the addon, and let the users leverage the introduced thing setting (Input mapping) to cater for their (older) models that work in this weird way (HDMI1 vs HDMI_1). Unfortunately, this might mean breaking functionality for some users, but I believe it would be more clean going forward. @David_Graeff please share your insight here.

To recap, the existing mapping logic is like this:

  • Each space to _ AND make upper case:
    • Example: Net Radio => NET_RADIO
    • Example: Hdmi 1 => HDMI_1
    • Example: AUDIO 1 => AUDIO_1
  • HDMI X => HDMI_X
  • HDMIX => HDMI_X

This could be replaced by the proposed thing mapping setting.

What do you think?

1 Like

The Binding Documentation Article would be the best place for something like this. :slight_smile:

@zarusz:
I like your proposal und would appreciate it. :slight_smile:

At first I was also thinking the same. The only problem is that we would have to build this database (and keep on updating the addon) as users report how it works for their model. I am not sure if this direction is pragmatic…

I have a feeling (pure speculation) the existing mapping present in 2.2 the code accounted for a smaller user base but didn’t work out for the majority, thus removing this logic in code and letting the minority user base adjust mapping via configuration would be more optimal. I am awaiting feedback here…

On the documentation note please let me know if it is clear enough.

@ganesh.ingle it seems you have encountered the same issue (and here) I ran into myself with the OH2.2 SNAPSHOT few weeks ago.

Please perform the actions mentioned in the link, which is:

  • Stop OH2.2 service
  • Delete tmp and cache (/var/lib/openhab2/cache and /var/lib/openhab2/tmp)
  • Remove the JAR/kar files from addons folder
  • Start OH2.2 service
  • Drop the yamaha JAR to addons folder
  • Wait some time :wink:

Also, I am almost certain the yamaha JAR won’t work in OH2.1. You need to deploy it to the OH2.2 SNAPSHOT runtime.

We do feature testing for the dab feature and for the go menu back command already. We can also feature test if it’s HDMI1 or HDMI_1. Less configuration is always preferable.

Cheers David

How would we go about detecting what the input name an AVR requires?

For instance, my AVR specifies HDMI_X as supported input, but reports HDMIX on status update (and in the selection command too) - see the <HDMI_1>Kodi:2</HDMI_1> here:

<YAMAHA_AV rsp="GET" RC="0">
    <System>
        <Config>
            <Model_Name>RX-S601D</Model_Name>
            <System_ID>0EE27BE3</System_ID>
            <Version>1.81/3.70</Version>
            <Feature_Existence>
                <Main_Zone>1</Main_Zone>
                <Zone_2>1</Zone_2>
                <Zone_3>0</Zone_3>
                <Zone_4>0</Zone_4>
                <Tuner>0</Tuner>
                <DAB>1</DAB>
                <HD_Radio>0</HD_Radio>
                <Rhapsody>0</Rhapsody>
                <Napster>0</Napster>
                <SiriusXM>0</SiriusXM>
                <Spotify>1</Spotify>
                <Pandora>0</Pandora>
                <JUKE>1</JUKE>
                <MusicCast_Link>1</MusicCast_Link>
                <SERVER>1</SERVER>
                <NET_RADIO>1</NET_RADIO>
                <Bluetooth>1</Bluetooth>
                <USB>1</USB>
                <iPod_USB>1</iPod_USB>
                <AirPlay>1</AirPlay>
            </Feature_Existence>
            <Name>
                <Input>
                    <HDMI_1>Kodi:2</HDMI_1>
                    <HDMI_2>Kodi</HDMI_2>
                    <HDMI_3>HDMI3</HDMI_3>
                    <HDMI_4>HDMI4</HDMI_4>
                    <HDMI_5>HDMI5</HDMI_5>
                    <HDMI_6>HDMI6</HDMI_6>
                    <AV_1>AV1</AV_1>
                    <AV_2>AV2</AV_2>
                    <AV_3>AV3</AV_3>
                    <AUX>AUX</AUX>
                    <AUDIO_1>AUDIO1</AUDIO_1>
                    <AUDIO_2>AUDIO2</AUDIO_2>
                    <AUDIO_3>AUDIO3</AUDIO_3>
                    <Bluetooth>Bluetooth</Bluetooth>
                    <USB>USB</USB>
                </Input>
            </Name>
        </Config>
    </System>
</YAMAHA_AV>

Unless, you are thinking about building a mapping configuration for each known model and applying the config during feature detection based on model name. Yet, I think building the mapping based on user feedback would take time…

Going back to my initial question, do we know for what AVR models was the built in mapping logic added (see my previous post)?

Feature testing is done by just sending the command to the AVR and analyse the result. This means, that the AVR switches inputs on binding start (and switches back as well, if we write good code). This way no mapping needs to be created.

No I guess not. The input constants stay the same. The binding reads the name property today already to support an optional set name.

Cheers
David

@ganesh.ingle I think @David_Graeff already provided an idea for the solution in an earlier post. Mainly during addon initialization we would have to switch the inputs to detect what comes back from the AVR (and restore original input). This would make the addon stateful. I think this is the best way forward.

On my side, I cannot implement this change currently as I switched apartments and left my AVR in another city - nowhere to test the changes. Unless you can wait, feel free to take a stab at the PR.

Another idea is to implement the json protocol. I assume that they have fixed those naming issues and all receivers 2014+ support the new protocol.

Cheers David

1 Like

I think json would be needed anyway to support Musiccast devices too.

I am using MusicCast in Multiroom with one source nearly everday, so i think it depends on the individual usecase for everyone.
I have never worked with Kodi before and i dont have a need for it at the moment.

With your approach i would not be Independent like i would be with a native binding.
I would have to dig into kodi, which i would need then only for using my yamaha hardware.
This sounds not efficient for me and my usecase.

I’m struggling with the Yamahareceiver binding for a while - getting the warning “Cannot delegate update” on all items:

2017-11-14 20:21:48.268 [WARN ] [nternal.profiles.ProfileCallbackImpl] - Cannot delegate update 'OFF' for item 'RXA2040Main_Zone_Zone_channels_Power' to handler for channel 'yamahareceiver:zone:5f9ec1b3_ed59_1900_4530_00a0deb772fc:Main_Zone:zone_channels#power', because no handler is assigned. Maybe the binding is not installed or not propertly initialized.

It’s not possible to send command to the receiver - that means the receiver is not responding.
But all items receiving correct updates from the receiver (operated via web-interface).

I’m now here:

  • RX-A2040 with zone: main, 2,3,
  • latest OH snapshot 2.2
  • .jar from the dropbox above

Update: same behavior after complete new install - only with yamaha binding.
I’m using now the http-binding to make progress with my concerns.

example:

Switch Yamaha_Main "Yamaha Main" (gYamahaHTTP) { http=">[ON:POST:http://192.168.178.66/YamahaRemoteControl/ctrl:<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>On</Power></Power_Control></Main_Zone></YAMAHA_AV>] >[OFF:POST:http://192.168.178.66/YamahaRemoteControl/ctrl:<YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>Standby</Power></Power_Control></Main_Zone></YAMAHA_AV>]" }

I could deliver logfiles or any other necessary information …

Thank’s for the hint.
While reinstalling and using a current snapshot #1098 I did so.
And it’s working again.

Hey there! :wave:
Wish I’d see this thread sooner :disappointed:
I have the following three regressions since upgrading to the binding that shipped with 2.2 stable:

  1. My receiver (RX-V479) accepts inputs like HDMI1 and NET RADIO, those with underscores (enforced by the binding) don’t work:
07:43:18.393 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Yamaha_Input' received command HDMI_1
07:43:18.446 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Input changed from NET_RADIO to HDMI_1
07:43:18.634 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Input changed from HDMI_1 to NET_RADIO
...
07:43:47.200 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Yamaha_Input' received command HDMI1
07:43:47.233 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Input changed from NET_RADIO to HDMI1
07:43:47.397 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Input changed from HDMI1 to HDMI_1
07:43:47.427 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Surround changed from 5ch Stereo to Standard
07:43:47.423 [DEBUG] [ceiver.handler.YamahaZoneThingHandler] - Input changed to HDMI_1
...
07:52:44.223 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Yamaha_Input' received command NET_RADIO
07:52:44.259 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Input changed from HDMI_1 to NET_RADIO
07:52:44.465 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Input changed from NET_RADIO to HDMI_1
...
07:53:01.352 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Yamaha_Input' received command NET RADIO
07:53:01.415 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Input changed from HDMI_1 to NET RADIO
07:53:01.564 [DEBUG] [ceiver.handler.YamahaZoneThingHandler] - Input changed to NET_RADIO
07:53:01.664 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Input changed from NET RADIO to NET_RADIO

It also reports inputs without underscores:

<?xml version="1.0" encoding="UTF-8"?>
<YAMAHA_AV rsp="GET" RC="0">
   <Main_Zone>
      <Basic_Status>
...
         <Input>
            <Input_Sel>HDMI1</Input_Sel>
            <Input_Sel_Item_Info>
               <Param>HDMI1</Param>
               <RW>RW</RW>
               <Title>Kodi</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon004.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number>1</Src_Number>
            </Input_Sel_Item_Info>
         </Input>
...
      </Basic_Status>
   </Main_Zone>
</YAMAHA_AV>
<?xml version="1.0" encoding="UTF-8"?>
<YAMAHA_AV rsp="GET" RC="0">
   <Main_Zone>
...
         <Input>
            <Input_Sel>NET RADIO</Input_Sel>
            <Input_Sel_Item_Info>
               <Param>NET RADIO</Param>
               <RW>RW</RW>
               <Title>NET RADIO</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon005.png</On>
                  <Off />
               </Icon>
               <Src_Name>NET_RADIO</Src_Name>
               <Src_Number>1</Src_Number>
            </Input_Sel_Item_Info>
         </Input>
...
      </Basic_Status>
   </Main_Zone>
</YAMAHA_AV>

I’ve read the discussions above and understand the need for those shenanigans introduced by other models, but in any case the state of the item should remain stable and not changed from the value of the command. Otherwise this breaks selection controls and menus (mappings in sitemaps) etc. So it’s fine to use the underscore alternatives but switching to e.g. HDMI_1 should change the input to the correct value on all receivers (by checking the available inputs and removing the underscore if needed).

Here’s a proposal: maybe it isn’t the cleanest way but for simplicity’s sake, maybe the binding could send both versions of HDMIx / HDMI_x and NET RADIO / NET_RADIO input to the receiver when receiving the command. One of them is going to be ignored and the other will go through.

  1. I wonder if it’s just me, but when I flip the power switch on or off (on the receiver thing/bridge or the zone thing), it immediately reverts to the previous value and only gets the proper state on the next refresh:
08:11:10.707 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Yamaha_Power' received command ON
08:11:10.778 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Power changed from OFF to ON
08:11:10.936 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Power changed from ON to OFF
..
08:12:01.758 [INFO ] [smarthome.event.ItemStateChangedEvent] - Yamaha_Power changed from OFF to ON

Does anyone else have this problem?

  1. I used to be able to launch Spotify playlists I have saved as favourites with this technique:

Now the binding won’t allow me because:

08:19:21.655 [DEBUG] [ceiver.handler.YamahaZoneThingHandler] - preset control not supported by Spotify
08:19:29.780 [WARN ] [ceiver.handler.YamahaZoneThingHandler] - Channel preset not working with this input!

I might file a PR to add Spotify to the list of the inputs supporting preset controls - any objections?

Thanks!

Hey, @ysc few comments from my end:

  1. Myself and other also have the issues with HDMI input naming inconsistencies. This was described in earlier posts, yet I have not heard nor tested NET RADIO.
    There is a verbal proposal to fix this input HDMI mapping (that could be expanded to handle NET RADIO too). In short, the root cause is command names required by AVR and state updates names reported by AVR vary per model. The proposed improvement would be to perform initial detection and perform mapping to adjust to a particular mode.
    I could contribute a PR for this after the holiday since I got my AVR back and ready to test this. Not sure if @ganesh.ingle made any progress here.
  2. Regarding addition of preset to Spotify, I am not sure how would this work? Few months back I contributed playback functionality for Spotify (next, prev, pause, play, stop) - wouldn’t that be sufficiet for your case? It’s hard for me to image what would preset do for Spotify.

Sure, I understand, I can live with that and a few additional rules to cope with those issues. I mostly blame myself for only noticing the add-on was completely rewritten after upgrading my productive system… Somehow it missed the release notes too.

As a matter of fact I coded a remote app for the Pebble swartwatch a while ago, if this helps I can offer how I retrieved the input names:

The output of these <Scene><Scene_Sel_Item>GetParam</Scene_Sel_Item></Scene> requests is as follows and includes both scenes (the 4 buttons you have on the receiver and the remote, at least on mine) and inputs:

<?xml version="1.0" encoding="UTF-8"?>
<YAMAHA_AV rsp="GET" RC="0">
   <Main_Zone>
      <Scene>
         <Scene_Sel_Item>
            <Item_1>
               <Param>Scene 1</Param>
               <RW>W</RW>
               <Title>BD/DVD</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon040.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number>1</Src_Number>
            </Item_1>
            <Item_2>
               <Param>Scene 2</Param>
               <RW>W</RW>
               <Title>TV</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon044.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number />
            </Item_2>
            <Item_3>
               <Param>Scene 3</Param>
               <RW>W</RW>
               <Title>NET</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon069.png</On>
                  <Off />
               </Icon>
               <Src_Name>NET_RADIO</Src_Name>
               <Src_Number>1</Src_Number>
            </Item_3>
            <Item_4>
               <Param>Scene 4</Param>
               <RW>W</RW>
               <Title>RADIO</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon043.png</On>
                  <Off />
               </Icon>
               <Src_Name>Tuner</Src_Name>
               <Src_Number>1</Src_Number>
            </Item_4>
            <Item_5>
               <Param>Spotify</Param>
               <RW>R</RW>
               <Title>Spotify</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon102.png</On>
                  <Off />
               </Icon>
               <Src_Name>Spotify</Src_Name>
               <Src_Number>1</Src_Number>
            </Item_5>
            <Item_6>
               <Param>JUKE</Param>
               <RW>R</RW>
               <Title>JUKE</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon103.png</On>
                  <Off />
               </Icon>
               <Src_Name>JUKE</Src_Name>
               <Src_Number>1</Src_Number>
            </Item_6>
            <Item_7>
               <Param>AirPlay</Param>
               <RW>R</RW>
               <Title>AirPlay</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon067.png</On>
                  <Off />
               </Icon>
               <Src_Name>AirPlay</Src_Name>
               <Src_Number>1</Src_Number>
            </Item_7>
            <Item_8>
               <Param>MusicCast Link</Param>
               <RW>R</RW>
               <Title>MusicCast Link</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon107.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number />
            </Item_8>
            <Item_9>
               <Param>SERVER</Param>
               <RW>R</RW>
               <Title>SERVER</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon006.png</On>
                  <Off />
               </Icon>
               <Src_Name>SERVER</Src_Name>
               <Src_Number>1</Src_Number>
            </Item_9>
            <Item_10>
               <Param>NET RADIO</Param>
               <RW>R</RW>
               <Title>NET RADIO</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon005.png</On>
                  <Off />
               </Icon>
               <Src_Name>NET_RADIO</Src_Name>
               <Src_Number>1</Src_Number>
            </Item_10>
            <Item_11>
               <Param>Bluetooth</Param>
               <RW>R</RW>
               <Title>Bluetooth</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon105.png</On>
                  <Off />
               </Icon>
               <Src_Name>Bluetooth</Src_Name>
               <Src_Number>1</Src_Number>
            </Item_11>
            <Item_12>
               <Param>USB</Param>
               <RW>R</RW>
               <Title>USB</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon009.png</On>
                  <Off />
               </Icon>
               <Src_Name>USB</Src_Name>
               <Src_Number>1</Src_Number>
            </Item_12>
            <Item_13>
               <Param>iPod (USB)</Param>
               <RW>R</RW>
               <Title>USB</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon011.png</On>
                  <Off />
               </Icon>
               <Src_Name>iPod_USB</Src_Name>
               <Src_Number>1</Src_Number>
            </Item_13>
            <Item_14>
               <Param>TUNER</Param>
               <RW>R</RW>
               <Title>TUNER</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon008.png</On>
                  <Off />
               </Icon>
               <Src_Name>Tuner</Src_Name>
               <Src_Number>1</Src_Number>
            </Item_14>
            <Item_15>
               <Param>HDMI1</Param>
               <RW>R</RW>
               <Title>Kodi</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon004.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number>1</Src_Number>
            </Item_15>
            <Item_16>
               <Param>HDMI2</Param>
               <RW>R</RW>
               <Title>Xbox</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon004.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number>1</Src_Number>
            </Item_16>
            <Item_17>
               <Param>HDMI3</Param>
               <RW>R</RW>
               <Title>Freebox</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon004.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number>1</Src_Number>
            </Item_17>
            <Item_18>
               <Param>HDMI4</Param>
               <RW>R</RW>
               <Title>HDMI4</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon004.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number>1</Src_Number>
            </Item_18>
            <Item_19>
               <Param>HDMI5</Param>
               <RW>R</RW>
               <Title>HDMI5</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon004.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number>1</Src_Number>
            </Item_19>
            <Item_20>
               <Param>HDMI6</Param>
               <RW>R</RW>
               <Title>HDMI6</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon004.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number>1</Src_Number>
            </Item_20>
            <Item_21>
               <Param>AV1</Param>
               <RW>R</RW>
               <Title>AV1</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon003.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number />
            </Item_21>
            <Item_22>
               <Param>AV2</Param>
               <RW>R</RW>
               <Title>AV2</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon003.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number />
            </Item_22>
            <Item_23>
               <Param>AV3</Param>
               <RW>R</RW>
               <Title>AV3</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon003.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number />
            </Item_23>
            <Item_24>
               <Param>AV4</Param>
               <RW>R</RW>
               <Title>AV4</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon003.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number />
            </Item_24>
            <Item_25>
               <Param>AUDIO1</Param>
               <RW>R</RW>
               <Title>AUDIO1</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon002.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number />
            </Item_25>
            <Item_26>
               <Param>AUDIO2</Param>
               <RW>R</RW>
               <Title>AUDIO2</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon002.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number />
            </Item_26>
            <Item_27>
               <Param>AUX</Param>
               <RW>R</RW>
               <Title>AUX</Title>
               <Icon>
                  <On>/YamahaRemoteControl/Icons/icon104.png</On>
                  <Off />
               </Icon>
               <Src_Name />
               <Src_Number />
            </Item_27>
         </Scene_Sel_Item>
      </Scene>
   </Main_Zone>
</YAMAHA_AV>

You can apparently distinguish between scenes and simple inputs with the <RW> element (W for scenes, R for inputs) and it includes the title, and what could a reliable identifier (<Param>, NOT <Src_Name>, for instance HDMI inputs don’t have a Src_Name). I don’t know if this operation is supported on all devices.

Simple: Spotify presets are on the same list as Net Radio presets (they’re called “Network favorites” in the MusicCast app, see my post here) and the receiver switches inputs if necessary, the binding simply doesn’t need to block the preset selection when on the Spotify input because this actually works the same. This used to work without problems with the old binding.

2 Likes