Harmon/Kardon AVR

I’d love to control my AVR through the network as opposed to IR control. Is there any scope for this, it already has a phone app for android and iPhone.

I’ve found this ‘API’ for Harmon/Kardon equipment, has anyone implemented this in any way?

If not the code is PHP, what would be the best way to implement it with Home Assistant?

Edit: Added more information

1 Like

Did you ever get anywhere with this?

I would be interested as well.

+1 interested.

I assume it could be done using a shell script using the platform “command_line” but I haven’t had the time to try it yet. Anyone else?

It’s working - except I cannot figure out how to run the PHP scripts through a shell_command in HASS.IO - any clues?

did you get this working? can you control the harman kardon speakers and play music using home assistant

Did you use the HKAPI from Karim Geiger?

I suppose we should rewrite the API in python first and then integrated in HASS.

I see it’s quit easy to control via socket connection and POST request, I just tested it with a unit test and it work on my JBL AVR101 (same API as the Harman/Kardon)

import unittest
import socket
import time

class HarmanCarbonTest(unittest.TestCase):
    def test_socket(selfself):
        xml = """<?xml version="1.0" encoding="UTF-8"?>
                        <zone>Main Zone</zone>
        command2 = """POST AVR HTTP/1.1\r\nHost: :10025\r\nUser-Agent: Harman Kardon AVR Remote Controller /2.0\r\nContent-Length: """ + str(xml.__len__())\
                     + """\r\n\r\n""" + xml
        command = '<xml version="1.0" encoding="UTF-8"><header/><body><code><body/>'

        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect(("", 10025))
        print("going to do it")
        s.sendto(command2.encode(), ("", 10025))
        print("has done it")

I have a working version :slight_smile:

I’d like a few person to try it out before I merge it in home-assistant main code.

To try it out, simply save the code in a harman_kardon_avr.py file under config/custom_components/media_player/ (if the directories doesn’t exist, simply create them).
The code is available here:

You can them configure the component like that:

  - platform: harman_kardon_avr

Of course change the ip address to point to your avr.

The turn on/off is working, volume up/down, volume mute, next and previous key are working.
Source selection is also supported.

Status of the avr is not reported, if you turn it on through the remote, home-assistant won’t be aware that the avr is on.

1 Like

hi, will this work to harman kardon omni speakers?


Hi, I doubt it will, but I cannot know for sure…

I tried it with my Harman Kardon AVR 151S
I can turn it on and off. I can also change the volume
unfortunatley I cannot select the source

What call did you use to change source?

Ah my mistake
I thought I will have select input within the media player itself

No, but you can call the service media_player.select_source with this service data:

  "source":"source name"

You’ll have to replace “source name” with the name of the source you want to set. You should use the source name as it appear on the on-screen menu.
(Example values: Cable Sat, Disc, DVR, Radio, TV, USB, Game, Media Server, Home Network, AUX, Source A, Source B, Source C, Source D)

thank you. works fine.

I tried this with my Harman Kardon BDS 280.
I cannot turn it on or off, change volume or select any source.

On the HKAPI github i saw they added support for the BDS.
Do you think its possible to add support for the BDS in the custom component?

Best regards


I noticed that the link https://www.home-assistant.io/components/media_player.harman_kardon_avr/ doesn’t work anymore, does this mean that it isn’t supported anymore?

The platform is still in development and hasn’t been integrated to home assistant yet, so the documentation also doesn’t exist yet.

Awesome thank you, it seems to work great for my AVR 151S!