Giter Club home page Giter Club logo

denonavr's Introduction

denonavr

Release Build Status PyPi License Code style: black

Automation Library for Denon AVR receivers

Installation

Use pip:

$ pip install denonavr

or

$ pip install --use-wheel denonavr

Usage with async

Writing async and await methods are outside the scope of the documentation. You can test async usage from the Python REPL. In a terminal run:

python3 -m asyncio

The asyncio library should automatically be imported in the REPL. Import the denonavr library and set up your receiver. If you know the IP address, enter it below replacing 192.168.1.119.

>>> import asyncio
>>> import denonavr
>>> d = denonavr.DenonAVR("192.168.1.119")
>>> await d.async_setup()
>>> await d.async_update()
>>> print(d.volume)
-36.5

Monitoring with telnet

In addition to retrieving the current device status via HTTP calls, denonavr library also has the ability to setup a task that will connect to the receiver via telnet on TCP port 23 and listen for real-time events to notify of status changes. This provides instant updates via a callback when the device status changes. Receivers support only one active telnet connection.

>>> import asyncio
>>> import denonavr
>>> d = denonavr.DenonAVR("192.168.1.119")
>>> await d.async_setup()
>>> await d.async_telnet_connect()
>>> await d.async_update()
>>> async def update_callback(zone, event, parameter):
>>>>>> print("Zone: " + zone + " Event: " + event + " Parameter: " + parameter)
>>> d.register_callback("ALL", update_callback)

Power & Input

>>> await d.async_power_on()
>>> await d.async_update()
>>> d.power
'ON'

>>> await d.async_power_off()
>>> await d.async_update()
>>> d.power
'OFF'

>>> d.input_func
'Tuner'
>>> await d.async_set_input_func("Phono")
>>> d.input_func
'Phono'

Sound

>>> await d.async_mute(True)
>>> await d.async_mute(False)

Other methods

Other async methods available include:

  • d.async_bass_down
  • d.async_bass_up
  • d.async_treble_down
  • d.async_treble_up
  • d.async_volume_down
  • d.async_volume_up
  • d.async_set_volume(50)

Collection of HTTP calls

For a collection of HTTP calls for Denon receivers please have a look at the doc folder.

License

MIT

Author

@ol-iver: https://github.com/ol-iver

Contributors

@soldag: https://github.com/soldag
@shapiromatron: https://github.com/shapiromatron
@glance-: https://github.com/glance-
@p3dda: https://github.com/p3dda
@russel: https://github.com/russell
@starkillerOG: https://github.com/starkillerOG
@andrewsayre: https://github.com/andrewsayre
@JPHutchins: https://github.com/JPHutchins
@MarBra: https://github.com/MarBra
@dcmeglio: https://github.com/dcmeglio
@bdraco: https://github.com/bdraco

Users

Home Assistant: https://github.com/home-assistant/home-assistant/
denonavr-cli: https://pypi.org/project/denonavr-cli/

denonavr's People

Contributors

albaintor avatar andrewsayre avatar appesteijn avatar bieniu avatar bjw-s avatar dcmeglio avatar edwardsre avatar freakalis avatar fstap avatar glance- avatar jphutchins avatar marbra avatar marijngiesen avatar mgorny avatar nellering avatar newt10 avatar nixon506e avatar ol-iver avatar philk avatar prcutler avatar russell avatar sbraz avatar scop avatar sebk-666 avatar soldag avatar starkillerog avatar thegunslingers avatar tommatheussen avatar trozen avatar xconverge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

denonavr's Issues

M-CR603 Sources

This component is great the only issue I have is that it doesn't list DAB radio correctly and many of the sources do not exist on the M-CR603

"volume_level": 0.06,
"is_volume_muted": false,
"media_content_type": "music",
"media_title": " 0.00",
"media_artist": "DA",
"source": "TUNER",
"source_list": [
"AUXA",
"AUXB",
"AUXC",
"AUXD",
"BD",
"CD",
"DOCK",
"DVD",
"DVR",
"GAME",
"HDRADIO",
"IPOD",
"IRADIO",
"LASTFM",
"M-XPORT",
"NAPSTER",
"NET/USB",
"PANDORA",
"PHONO",
"RHAPSODY",
"SAT/CBL",
"SERVER",
"SIRIUS",
"TUNER",
"TV",
"USB",
"USB/IPOD",
"V.AUX"
],
"friendly_name": "Marantz:[M-CR603]",
"supported_features": 3468

Thanks Trevor

identify_denonavr_receivers() returning None

Not sure what is the point of this:

    if receivers:
        return receivers
    else:
        return None

but it doesn't seem to be the "pythonic" way. And because of this you can't do:

for denon in denonavr.discover():
    ...

Because NoneType is not iterable.

Error: No mapping for source AirPlay

HA: hassio 0.62.1
AVR: Denon AVR-X2300W
Source: AirPlay

log:
"No mapping for source AirPlay
19:51 components/media_player/denonavr.py (ERROR)"

Hi!
Have I understood that I need to provide a set of mapping for my AVR?
Can someone fill me in?

Sound Mode - DOLBY SURROUND not supported

I have Denon X5200, when playing using sound mode - DOLBY SURROUND - i get an error in HA:
[DenonAVR] Not able to match sound mode, returning raw sound mode.

It also happens when device is turned off

  • platform: denonavr
    host: *******
    name: Denon AVR-X5200W
    show_all_sources: True
    timeout: 2
    sound_mode: True

Change the input to Media Player causes errors

After upgrade HA to 0.48 (denonavr 0.5.1) when I change the input to the Media Player errors occur every about 10 seconds. When I change to another input I get "Connection error".

2017-07-05 10:57:27 ERROR (Thread-6) [DenonAVR] No mapping for source MPLAY
2017-07-05 10:57:38 ERROR (Thread-3) [DenonAVR] No mapping for source MPLAY
2017-07-05 10:57:49 ERROR (Thread-9) [DenonAVR] No mapping for source MPLAY
2017-07-05 10:58:00 ERROR (Thread-10) [DenonAVR] No mapping for source MPLAY
2017-07-05 10:58:11 ERROR (Thread-4) [DenonAVR] No mapping for source MPLAY
2017-07-05 10:58:21 ERROR (Thread-6) [DenonAVR] No mapping for source MPLAY
2017-07-05 10:58:22 ERROR (Thread-10) [DenonAVR] No mapping for source MPLAY
2017-07-05 10:58:23 ERROR (Thread-10) [DenonAVR] Host denon.bieniu.lan returned malformed XML for: /goform/Deviceinfo.xml
2017-07-05 10:58:23 ERROR (Thread-10) [DenonAVR] Connection error: Receiver sources list empty. Please check if device is powered on.
2017-07-05 10:58:23 ERROR (Thread-10) [DenonAVR] Input function list for Denon receiver at host 192.168.1.70 could not be updated.

This is a zip with the xml files generated by Your script.
denon_avr_x2100w.zip

Issue with getting AVR-S940H functioning with denonavr

I am having issues with getting an AVR-S940H working with home assistant (unable to get status or turn/off unit). This is a newer model but I am able to access the unit through the web interface as well as through the denon mobile app.

I was successfully able to turn on / off device using the following commands in a browser/postman.
http://10.0.1.172:8080/goform/formiPhoneAppDirect.xml?PWSTANDBY
http://10.0.1.172:8080/goform/formiPhoneAppDirect.xml?PWON

configuration.yaml
media_player:

  • platform: denonavr
    host: 10.0.1.172

Home assistant log details:
2018-06-30 22:19:51 ERROR (SyncWorker_8) [DenonAVR] Missing status information from XML of Main for: Power, InputFuncSelect, Mute, MasterVolume, selectSurround, SurrMode
2018-06-30 22:20:01 ERROR (SyncWorker_7) [DenonAVR] Host 10.0.1.172 returned HTTP status code 403 to GET request at end point /goform/formMainZone_MainZoneXmlStatus.xml
2018-06-30 22:20:02 ERROR (SyncWorker_7) [DenonAVR] Host 10.0.1.172 returned HTTP status code 403 to GET request at end point /goform/formMainZone_MainZoneXml.xml

denon_reciever_xml.py output
HTTP Status Code of /goform/AppCommand.xml: 403
HTTP Status Code of /goform/AppCommand.xml: 403
HTTP Status Code of /goform/Deviceinfo.xml: 403
HTTP Status Code of /goform/formMainZone_MainZoneXmlStatus.xml: 403
HTTP Status Code of /goform/formMainZone_MainZoneXml.xml: 403
HTTP Status Code of /goform/formNetAudio_StatusXml.xml: 403
HTTP Status Code of /goform/formTuner_TunerXml.xml: 403
HTTP Status Code of /goform/formTuner_HdXml.xml: 403
HTTP Status Code of /goform/formZone2_Zone2XmlStatus.xml: 403
HTTP Status Code of /goform/formZone3_Zone3XmlStatus.xml: 403
HTTP Status Code of /goform/AppCommand.xml: 200
HTTP Status Code of /goform/AppCommand.xml: 200
HTTP Status Code of /goform/Deviceinfo.xml: 200
HTTP Status Code of /goform/formMainZone_MainZoneXmlStatus.xml: 403
HTTP Status Code of /goform/formMainZone_MainZoneXml.xml: 403
HTTP Status Code of /goform/formNetAudio_StatusXml.xml: 403
HTTP Status Code of /goform/formTuner_TunerXml.xml: 403
HTTP Status Code of /goform/formTuner_HdXml.xml: 403
HTTP Status Code of /goform/formZone2_Zone2XmlStatus.xml: 403
HTTP Status Code of /goform/formZone3_Zone3XmlStatus.xml: 403

As the above shows I am getting 403, access denied on all requests EXCEPT:
AppCommand-2016-8080-200.xml
AppCommand-8080-200.xml
Deviceinfo.xml-8080-200.xml

Am I doing something wrong? Thanks for any help.

Support for Marantz

I wondered if you'd be interested in adding support for Marantz? The API looks very similar to Denon, and in fact it more or less works out of the box (I'm using it in HomeAssistant for my M-CR610).

I haven't tried all of the functions, but powering on, selecting sources and changing volume all work. The only issue so far is that the mute status and volume aren't shown.

On the Marantz, the MAINZONE_URL doesn't return MasterVolume or Mute. They're both returned by the STATUS_URL, which unfortunately doesn't supply FriendlyName (which is still in MAINZONE_URL). Since FriendlyName is unlikely to change, I figure it's fine to get that at init time and use STATUS_URL for getting volume and mute status.

Doesn't seem worth a dedicated fork just for those changes. The DEVICEINFO_URL returns BrandCode and ModelName, either of which might be options to choose the URLs?

Not able to match sound mode, returning raw sound mode.

Hi,

I got a Denon AVR-X2200W and I got the "Not able to match sound mode, returning raw sound mode." warning in the HA log.

Here are the states:

sound_mode: DTS Neural:X
sound_mode_list: MUSIC,MOVIE,GAME,AUTO,VIRTUAL,PURE DIRECT,DOLBY DIGITAL,MCH STEREO,STEREO
sound_mode_raw: DTS Neural:X

DENON AVR-4306

Hi There,

I have a very old Denon AVR-4306 - works perfect with web interface and the AVR-Remote app https://play.google.com/store/apps/details?id=de.pskiwi.avrremote

I've added the following to my configuration.yaml:

media_player:

  • platform: denonavr
    host: 192.168.1.11
    name: AVR-4306
    show_all_sources: True
    timeout: 4

I can see the machine, but it don't show correct state and it don't work.

Is the protocol used in this old machine suitable for the denonavr or should I forget it?

ImportError: No module named parse

Installed denonavr using pip and get this ImportError (even after using pip to install parse as well):

The directory '/Users/allen/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/allen/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: denonavr in /Library/Python/2.7/site-packages/denonavr-0.3.1-py2.7.egg
Requirement already satisfied: requests in /Library/Python/2.7/site-packages (from denonavr)

$ python
Python 2.7.10 (default, Jul 30 2016, 18:31:42) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import denonavr
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/denonavr-0.3.1-py2.7.egg/denonavr/__init__.py", line 15, in <module>
    from . import ssdp
  File "/Library/Python/2.7/site-packages/denonavr-0.3.1-py2.7.egg/denonavr/ssdp.py", line 13, in <module>
    from urllib.parse import urlparse
ImportError: No module named parse
>>> 

No connection to /goform/AppCommand.xml

Hi,

I'm running HA 0.69.1 on a Raspberry Pi 3 B+ in a Python 3.5 virtual environment. I was using denonavr with marantz SR6007 without any issues till 0.68.? and possibly before the code was pushed to 0.7.0.

Yesterday, I've changed the code to accommodate with the unavailable sources after noticing #36 and got rid of the "no mapping for source " errors. However, I am still getting the following errors:

No connection to /goform/AppCommand.xml end point on host 192.168.0.3
Getting renamed and deleted sources failed.
Receiver sources list empty. Please check if device is powered on.

Modified code is:

SOURCE_MAPPING = {"TV AUDIO": "TV", "iPod/USB": "USB/IPOD", "Bluetooth": "BT", "Blu-ray": "BD", "CBL/SAT": "SAT/CBL", "NETWORK": "NET", "Media Player": "MPLAY", "AUX": "AUX1", "Tuner": "TUNER", "CD": "CD", "DVD": "DVD", "VCR": "VCR", "GAME": "GAME"}

I'm also experiencing difficulties in connecting to the marantz SR6007 through the Remote app. The remote app either finds the IP or name and IP together but doesn't connect.

Could you please help?

Thanks in advance.

Mute status

Is it possible to determine mute status? Would help if doing a mute toggle with Denonavr when another control system also might be muting or un-muting as well.

Custom name for input source no longer used in HA

After updating Home Assistant to 0.64.3, the denonavr component started to list the default names for my Marantz NR1506, rather than the custom names I configured. I'm not sure this is a expected? It was nice to have the custom names come through ("Chromecast" vs "AUX").

Denon AVR 3311ci timeout problems

Hi,

I'm having troubles with Home Assistant time out exceptions in my logs with a Denon AVR 3311ci.

urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='192.168.34.6', port=8 0): Read timed out. (read timeout=15)

And during that exception another exception occurred:

requests.exceptions.ReadTimeout: HTTPConnectionPool(host='192.168.34.6', port=80): Read timed out. (read timeout=15)

While trying to understand whats going on I also saw the following in my logs.

2018-02-21 08:56:05 WARNING (MainThread) [homeassistant.components.media_player] Updating denonavr media_player took longer than the scheduled update interval 0:00:10

This seems similar to #21 I have tried increasing the timeout which does have to improved the likelihood that the component will work.

denonavr 0.5.5
homeassistant 0.63.3

On python 3.5, everything was installed with pip into a virtualenv.

Quick Select?

Not sure if I'm blind or if it isn't supported.

Is there a way to basically tell the avr to run/execute Quick Select n?
If it isn't, would it be possible to add?

Thanks for the module btw. :)

Current Playing Audio-Stream

Is it possible to get the current playing audio stream or any media (audio/video) information?

I am essentially trying to dim lights when playing media, but my Fire TV and my vizio are not supported, so the Denon seems like a good place and it has all the information available to identify the type of media.

I can see this info in the Denon iOS App. If so, can it be available with the denonavr component ?

Compile to EXE?

Anyone tried using Py2EXE to compile and run stand-alone?

My goal with this would be to run this stand-alone to be able to feed data to another app and allow that app to run the EXE as needed. The app is Homeseer. Home runs VB and C# but doesnt work with Python.

thx for the info.

Invalid album art

When my receiver is playing content without album art (for example plain fm radio), Home Assistant keeps trying to load the unexisting album art for it. This is not a big problem, but when it tries loading the album art, for a fraction of a second, a square image show up in the control panel, before jumping back to the default.

Maybe denonavr can mark that there is no album art in this case?

The image it tries to load is:

https://*mylocalserver*/api/media_player_proxy/media_player.marantz?token=43b0d5633fa6ffc097436e452f19fa8e10eaf767b56b12da83f077cfb571ead2&cache=df4bb

Denon AVR 3808CI

It seemed to me based on documentation from HASS that this should support the AVR-3808CI as well.
Trying however I got errors such as:
Missing status information from XML of Main for: Power, InputFuncSelect, Mute, MasterVolume

Is this AVR supposed to be supported? If not, what information or what would be required to try to get it supported (if possible)>

Thx.

Cannot increase timeout

Hi,

I am having an issue where the receiver's state will be off for one update(), then back on. I eventually found that the issue was that /goform/formMainZone_MainZoneXmlStatus.xml was sometimes taking more than 2 seconds to reply. Timeout is currently hardwired, would you consider adding a parameter to set the timeout when creating a DenonAVR device?

state in HA flaps between ON/OFF even though AVR is turned on

Since upgrading to HA 59.2 (HASS.io), HA has issues to track the state of my AVR. It keeps flapping between ON and OFF even though the AVR is ON.
I also see many of these messages in the logs:

Updating denonavr media_player took longer than the scheduled update interval 0:00:10
6:51 AM helpers/entity_component.py (WARNING)
Updating denonavr media_player took longer than the scheduled update interval 0:00:10
6:51 AM helpers/entity_component.py (WARNING)
Update of media_player.denon_avr is taking over 10 seconds
6:51 AM core.py (WARNING)

AVR: Denon X3200W (Connected via ethernet, not wifi)

denonavr

Zone 2 Power and Input

I see the code only references control of the Main Zone, though some of the supported models support Zone 2. Are there any plans to add controls for Zone 2? Power toggle? Input selection? Volume control?

Unmatched Sound Mode

WARNING (Thread-10) [DenonAVR] Not able to match sound mode: 'Dolby Digital + Neural:X', returning raw sound mode.

I used to get no match for Dolby D + Neural:X before 0.7.6. Since I updated HA to 82.1 which included 0.7.6 I'm now getting unmatched for Dolby Digital + Neural:X

I thought about changing line 50, Dolby D to Dolby Digital.

media_player.volume_mute doesn't work

Home Assistant 0.64.3 // Denon AVR-X2200W

media_player.volume_mute works neither as

  action:
    - service: media_player.volume_mute
      entity_id: media_player.denon_avr

nor as dev-service

media_player.volume_mute
{
  "entity_id": "media_player.denon_avr"
}

Log Details (ERROR)
Tue Mar 06 2018 17:53:17 GMT+0100 (Central Europe Standard Time)

Invalid service data for media_player.volume_mute: required key not provided @ data['is_volume_muted']. Got None

Input mapping: ERROR:DenonAVR:No mapping for source Internet Radio

AVR: Denon 3312
Source: Internet Radio
Source ID: NET/USB

INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state media_player.denon3312=on; media_title=Internet Radio, source=Internet Radio, source_list=['BD', 'CD', 'DOCK', 'DVD', 'DVR', 'GAME1', 'GAME2', 'NET/USB', 'PHONO', 'SAT/CBL', 'TUNER', 'TV', 'V.AUX'], is_volume_muted=False, media_content_type=channel, friendly_name=Denon-3312, supported_features=3468, volume_level=0.02 @ 2017-12-09T12:42:25.456553+01:00>, old_state=None, entity_id=media_player.denon3312>

What can be done to fix this ?

Regards, Tran

Change input to TV Audio or AUX is not working from HomeAssistant

Hi,

For me switch to Input "Aux" and "TV Audio" is not working from HomeAssistant.
Every other Input works just fine.

My Denon is an X2000

I found this in your code:

SOURCE_MAPPING = {"TV AUDIO": "TV", "iPod/USB": "USB/IPOD", "Bluetooth": "BT",
                  "Blu-ray": "BD", "CBL/SAT": "SAT/CBL", "NETWORK": "NET"}

CHANGE_INPUT_MAPPING = {"Internet Radio": "IRP", "Online Music": "NET",
                        "Media Player": "MPLAY", "Media Server": "SERVER",
                        "Spotify": "SPOTIFY", "Flickr": "FLICKR",
                        "Favorites": "FAVORITES"}

Do i have to rename my Inputs? My Inputs are all set to default naming.
Any Ideas?

BR

LUkas

SR5006 Zone2 Source List Not Available

I started having a problem with my Zone2 sources several weeks ago, after updating Home Assistant. I'm not sure which version though, unfortunately...

Zone2 sources do not appear in the source_list field, and I am unable to change Zone2 sources using the services tool in HA. All other Zone2 functions (power, volume, mute, etc.) still work, however. In Home Assistant, the error log shows the following two errors:
Input function list for Denon receiver at host 192.168.1.127 could not be updated.
and
Receiver sources list empty. Please check if device is powered on.
These error log entries appear about 6 times a minute, presumably because this is the update interval.

I ran the denon_receiver_xml.py and have attached my XML files for your reference: xml_test_sr5006.zip

Are there any further tests I can run to try and determine what is causing the issue? The XML for Zone2 appears normal, and has the sources listed, so I'm not sure where else to look...

I'm not entirely sure whether this is an issue with denonavr, or whether the media_player implementation of Zone2 controls in HA has changed, so my apologies in advance if I'm not posting this issue in the correct repo.

volume doesn't update

init.py:version = "0.5.4"

I was trying some new things and I noticed a problem. Am I doing something wrong? No matter what I do to the volume it always reads -80

# python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import denonavr
>>> d = denonavr.DenonAVR("x.x.x.x", "Name of device (Optional)")
>>> d.update()
True
>>> d.volume
-80.0
---Changed volume on device
>>> d.update()
True
>>> d.volume
-80.0
>>> d.volume_up()
True
>>> d.volume
-80.0
>>> d.update()
True
>>> d.volume
-80.0
>>>


I then tried set_volume which does work but it still reports -80.

>>> d.update()
True
>>> d.volume
-80.0
>>> d.set_volume(-40.0)
True
>>> d.set_volume(-42.0)
True
>>> d.volume
-80.0
>>> d.update()
True
>>> d.volume
-80.0
>>>

I wonder if this is somehow related to the other issue I have.

Not able to match sound mode, returning raw sound mode

Error showing up on Hassio (Home Assistant) 1.7

2018-07-29 22:10:46 WARNING (SyncWorker_4) [DenonAVR] Not able to match sound mode, returning raw sound mode.
2018-07-29 22:10:57 WARNING (SyncWorker_9) [DenonAVR] Not able to match sound mode, returning raw sound mode.
2018-07-29 22:11:08 WARNING (SyncWorker_6) [DenonAVR] Not able to match sound mode, returning raw sound mode.
2018-07-29 22:11:19 WARNING (SyncWorker_12) [DenonAVR] Not able to match sound mode, returning raw sound mode.
2018-07-29 22:11:30 WARNING (SyncWorker_14) [DenonAVR] Not able to match sound mode, returning raw sound mode.
2018-07-29 22:11:41 WARNING (SyncWorker_4) [DenonAVR] Not able to match sound mode, returning raw sound mode.

This is with STEREO sound with the receiver on or off

Sound mode support

I am trying to get Sound mode supported for the denonavr platform in Home Assistant.
I already have my code working and I have tested it.
My pull request is in: home-assistant/core#11764 (comment)

However I implemented my code directly in the denonavr component of HA, but it would be way nicer to have the parsing code in this denonavr library.

Could Sound Mode be supported in this denonavr library.

The relevant code I would like to implement in this library is:

Setup:

sound_mode_dict = OrderedDict([('MUSIC', 'PLII MUSIC'),
                                       ('MOVIE', 'PLII MOVIE'),
                                       ('GAME', 'PLII GAME'),
                                       ('PURE DIRECT', 'DIRECT'),
                                       ('AUTO', 'None'),
                                       ('DOLBY DIGITAL', 'DOLBY DIGITAL'),
                                       ('MCH STEREO', 'MULTI CH STEREO'),
('STEREO', 'STEREO')])

self._sound_mode_list = list(sound_mode_dict)
self._sound_mode_dict = sound_mode_dict

The key-value structure in the sound_mode_dict is needed because the commands to set an sound mode and the reported sound mode are diffrent. This structure matches the reported sound mode with the commands to set a sound mode. The key needs to be identical with the command to set a specific sound mode and the corresponding value needs to be the sound mode as reported by the AVR. Of course it would be awesom if this information could be obtained from the AVR and it schould be possible because the list is also displayed in the official phone application, but I could not figure out how to do it.

Get the current sound mode and parse the data:

        if self._sound_mode_support:
            try:
                url = ('http://' + str(self._host) +
                       '/goform/formMainZone_MainZoneXml.xml')
                xml_data = urllib.request.urlopen(url)
            except urllib.error.URLError:
                err = "Denon receiver failed to get sound mode, URL-Error"
                _LOGGER.error(err)
                return
            parsed_data = ET.parse(xml_data).getroot()
            sound_mode_raw = parsed_data.find('selectSurround/value')
            sound_mode_raw = sound_mode_raw.text.rstrip()
            try:
                mode_list = list(self._sound_mode_dict.values())
                mode_index = mode_list.index(sound_mode_raw.upper())
                sound_mode = list(self._sound_mode_dict.keys())[mode_index]
                self._current_sound_mode = sound_mode
            except ValueError:
self._current_sound_mode = sound_mode_raw

Set the sound mode to some value:

    def select_sound_mode(self, sound_mode):
        """Select sound mode."""
        url = ('http://' + str(self._host) +
               '/MainZone/index.put.asp?cmd0=PutSurroundMode%2F'
               + sound_mode.upper().replace(" ", "+"))
        urllib.request.urlopen(url)
return sound_mode

The complete code can be vieuwed in my PR: https://github.com/starkillerOG/home-assistant/blob/soundModeSupport/homeassistant/components/media_player/denonavr.py

Does someone have time to implement this in this library?

More examples

Can you add some examples how to play a position from Favourites?

UPNP Play

Hi,

Would you be interested in supporting upnp play? I know that my denon avr (x1200) supports playing al url over upnp & have some code that supposedly works.

This could add extra functionality for Home Assistant, allowing us to play, for example, TTS files.

Would you be interested in a pull request?

denonavr for CEOL PICCOLO N4?

Hi!

As I understand it denonavr isn´t really supposed to work for me, but since it seems to be so close now I thought i should share part of my home assistant log;

2017-05-26 23:37:37 ERROR (Thread-5) [DenonAVR] No mapping for network audio source SERVER
2017-05-26 23:37:38 ERROR (Thread-5) [DenonAVR] Host 192.168.1.21 returned malformed XML after command: /goform/Deviceinfo.xml
2017-05-26 23:37:38 ERROR (Thread-5) [DenonAVR] Connection Error: Receiver sources list empty
2017-05-26 23:37:38 ERROR (Thread-5) [DenonAVR] Input function list for Denon receiver at host 192.168.1.21 could not be updated
2017-05-26 23:37:47 ERROR (Thread-10) [DenonAVR] No mapping for network audio source SERVER
2017-05-26 23:37:58 ERROR (Thread-3) [DenonAVR] No mapping for network audio source SERVER
2017-05-26 23:38:09 ERROR (Thread-6) [DenonAVR] No mapping for network audio source SERVER

repeats...

I´ll attach some of the files I thought you are using. Please let me know if there is anything else I should provide.

Regards,
Johan

denon.zip

slow to respond

After upgrading home assistant from 0.47 to 0.48 I can no longer use my TV remote because the volume commands take too long to respond. They used to be instant. For now I have downgraded to 0.47 because it uses an older version of this software.

home-assistant/core#8330

AVR-X1400H - AppCommand empty?

Hello there
I'm having some trouble with my AVR-X1400H

>>> import denonavr
>>> d = denonavr.DenonAVR("192.168.1.3")
No connection to /goform/AppCommand.xml end point on host 192.168.1.3
Getting renamed and deleted sources failed.
No connection to /goform/AppCommand.xml end point on host 192.168.1.3
Getting ZoneName failed.
No connection to /goform/AppCommand.xml end point on host 192.168.1.3
Update failed.
>>> denonavr.__version__
'0.7.7'

Response for http://192.168.1.3:8080/goform/Deviceinfo.xml is here
https://gist.github.com/lenisko/1643f6c0837bfde47fae2c69845ebea4

Response for http://192.168.1.3:8080/goform/AppCommand.xml here (looks empty...)

<?xml version="1.0" encoding="utf-8" ?>
<rx>
</rx>

Wrong source reported when selecting source while powered off

When I select a source when the receiver (AVR-x3400h, a 2017 model) is powered off, the receiver turns on directly to the requested source. However, the reported source is incorrect in denonavr, seeming to show to the previously selected state:

>>> import denonavr
>>> d = denonavr.DenonAVR("x3400h")
>>> d.update()
True
>>> d.state
'off'
>>> d.set_input_func("DVD")
True
>>> d.update()
True
>>> d.state
'on'
>>> d.input_func
'Shield'
>>>

The receiver itself is using the 'DVD' input at this point. The incorrect source is also reflected in Home Assistant.

Sound mode ALL_ZONE_STEREO to sticky

Hi, thanks for all the work the denonavr module.

Using the sound modes: after ALL_ZONE_STEREO I can no longer switch to the other sound modes.

It is a special Denon feature, that ALL_ZONE_STEREO must be OFF, or you cannot set any of the other sound modes.

Just like in Harmony Hub, there needs to be a ALL_ZONE_STEREO_OFF option. Or, call ALL_ZONE_STEREO_OFF internally before setting the new sound mode.

Can help with testing, have: X1000, X2100 and X3400

Thank you again !

Power State is "flickering" on pre 2016 AVR

Hi,

whenever my AVR-X2300W is on, Home Assistant sometimes displays it as being off for a brief moment (see screenshot).
I traced the issue back to potentially being in denonavr.py#L413.

The comment says On timeout and connection error, the device is probably off, but I'd argue that connection errors or timeouts can also be due to the bad WiFi capabilities of the AVR, so at least in my case the state probably hasn't changed.

I don't know the original reasoning behind the choice of setting the state to POWER_OFF on connection errors and timeouts, but I'd propose that it should only change the state if self._power == None and not blindly set it to POWER_OFF, but rather keep the current state if it is not None.

What do you think of that?


Screenshot in the Home Assistant History view displaying a timespan of 1 day:

screen shot 2018-06-07 at 21 17 10

Marantz SR7013

Hi
This project was working for my Marantz SR7010 in home assistant, but not with my new SR7013:
"returned HTTP status code 403"
and
"End point /goform/AppCommand.xml on host [ip address] returned malformed XML."

DENON AVR-1912

Not able to match sound mode: 'MCH STEREO', returning raw sound mode.

sound_mode: STEREO
sound_mode_list: MUSIC,MOVIE,GAME,AUTO,VIRTUAL,PURE DIRECT,DOLBY DIGITAL,DTS SURROUND,MCH STEREO,STEREO,ALL ZONE STEREO
sound_mode_raw: STEREO
friendly_name: DENON:[AVR-1912]
supported_features: 69004

Denon AVR X3100W

Thu Jan 17 2019 21:50:37 GMT+0100 (centraleuropeisk normaltid)

Not able to match sound mode: 'PLIIx Cinema', returning raw sound mode.

Not able to match sound mode: Multi In + Neural:X

Not able to match sound mode so it appears this sound mode needs to be added.

Thank you in advance

source: Game
sound_mode: Multi In + Neural:X
media_title: Game
media_content_type: channel
sound_mode_raw: Multi In + Neural:X

Denon AVR-X4300H is unstable

I have a newer Denon AVR-X4300H model. Apparently the new models no longer support the web interface supported by older models (uggggg--- why remove the web or RESTFul interface). But the mobile app for the reciever works fantastically so there is definitely a stable mechanism to connect to these.

The original "denon" component does kinda sorta work -- via telnet access. But it's very unreliable. For example the volume change will work about 1 out of 5 times. The pattern I've seen is that once you set it via HomeAssistant it won't respond again for some timeout period . . . which is minutes. This miraculously it might respond and work at some later time.

So, I would MUCH rather get the denonavr component working well, so that it could be as stable as the mobile app is when changing volume, inputs, etc.! This is really a bummer because the Onkyo reciever this one replaced was very very stable and worked very well with HomeAssistant.

At this time I've fallen back to basic on/off automation using my Harmony remote integration with HomeAssistant and it's working well. But, is very very limited. Being able to set the volume and sources with HomeAssistant is a fantastic automation that I'm very much missing.

We were previously corresponding on this thread:
home-assistant/core#7645

But, per the recommendation over there I wanted ot open a ticket here and offer my help in testing /debugging however I can to get the latest series of AVR's working!

I've attached the results of the python test script you posed on the other thread here as well to provide the Xml files that it saved out:
Denon Python Requests - AVR-X4300H.zip

Unfortunately I don't think the web interface that is used by the denonavr platform is available on the higher end newer (2016+) models anymore.

On my AVR-X4300H, the urls you posted all return:

Error 403: Forbidden
Access Forbidden

This is also documented on AVS Forums:
http://www.avsforum.com/forum/90-receivers-amps-processors/2444306-official-2016-denon-s-series-x-series-avr-owner-s-thread-faq.html

Note: Although the Web Control feature is no longer provided on the X4300H and X6300H, a firmware update later in 2016 will provide the capability to SAVE the config file to a USB thumb drive and then LOAD it back from the thumb drive.

Please let me know what else I can do to help. I'll try to pay more attention and be more prompt than I was before on that last thread!

Song album, artist title from AirPlay?

I'm about to invest an an AVR-X4400 and this project looks like the most likely way to integrate it into my system in place of the Yamaha RX-A750 I'm using today.

It's critical that my overall system be able to retrieve the currently playing media when AirPlay is the source... can someone please kindly confirm that this should work? I did see the issue about changes to the interface on the AVR-X series, but it wasn't clear if that impact song metadata.

Thanks!

Add support for older Denon AVRs by making STATUS_URL configurable

Hi,

I have an older AVR-4810 which apparently only has a subset of the current web interface structure.
For example, it's missing the "/goform/formMainZone_MainZoneXmlStatus.xml" page which is kind of essential to denonavr.
However, I realized that I could just set
STATUS_URL = "/goform/formMainZone_MainZoneXml.xml"(i.e. to the same value as MAINZONE_URL)
to get denonavr working in large parts (I'm using it within home-assistant).

If STATUS_URL could be user-configurable (or maybe just be set to MAINZONE_URL in case /goform/formMainZone_MainZoneXmlStatus.xml returns a 404), that would be really great.

I'd be happy to assist with further information, e.g. a dump of the formMainZone_MainZoneXml.xml file from my AVR.

Sebastian

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.