I apricate your patience Phil.
For some reason I expected that using the Lovelace media card with the media_player.rotel_rsp_1570, the card buttons would work without any extra coding. No wonder it does not work. Sigh, - jet another moment in my N00b life.
I just can’t wrap my head around how to implement the media card with the Rotel. How do I pick up actions from the Media card GUI and pass the action to the Rotel, automations, script or …?
- alias: Rotel RSP-1570 Volume Up
trigger:
platform: ?
event_type: ?
event_data:
button_name: ?volume_set?
action:
service: media_player.volume_up
entity_id: media_player.rotel_rsp_1570
Using direct commands to go directly to settings rather than using SEL, is preferable, so looking forward to when your package with the commands.py is implemented in HA.
Hi,
Apologies - I wasn’t clear - the media player card definitely should work out of the box with no coding. The rest of the email was just in response to your request for services. The code snippet was just an example of how to address one of the existing services in an automation.
Does the media player card appear at all? If not then you may have a default_view group set up and you’d need to add the entity id to that. Try creating a new tab at the top of your overview page by adding this to your groups.yaml
. (I’m assuming here that you’ve defined those sensors in configuration.yaml
as described in the 6th message in this thread):
rotel_rsp1750_view:
name: Rotel RSP-1570
view: true
entities:
- media_player.rotel_rsp_1570
- group.rotel_rsp1570_info
rotel_rsp1570_info:
name: Rotel RSP-1570 Info
control: hidden
entities:
- sensor.rsp1570_source
- sensor.rsp1570_info
- sensor.rsp1570_volume
- sensor.rsp1570_is_muted
Or does the media player card appear but simply not respond to clicks? I looked at your log and couldn’t see anything odd so I’m not sure what that could be at the moment.
Regards,
Phil
P.S. These screen shots show the media player card:
This is all of the current entities available:
Here is my media card.
But maybe I have to install some files from the Rotel RSP-1570 processor asyncio RS-232 protocol to get this to work?
I have only installed config\custom_components\rotel_rsp1570_init_.py and the media_player.py
Hi,
Home Assistant takes care of installing the support library so I don’t think that’s the problem.
That message you’ve snapped is interesting. Let me think about this.
Regards,
Phil
If it can be of any help Made a Mute automation. Which did throw this error message:
- alias: Rotel RSP-1570 Mute
trigger:
platform: state
entity_id: input_boolean.test_mute
action:
service: media_player.volume_mute
data_template:
entity_id: media_player.rotel_rsp_1570
is_volume_muted: >-
{%- if states.media_player.rotel_rsp_1570.is_volume_muted == false -%}
true
{%- else -%}
false
{%- endif -%}
## Log Details (ERROR)
Sun Apr 14 2019 18:13:57 GMT+0200 (sentraleuropeisk sommertid)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 365, in _async_add_entity
await entity.async_update_ha_state()
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 225, in async_update_ha_state
self._async_write_ha_state()
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 255, in _async_write_ha_state
attr = self.state_attributes or {}
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/media_player/__init__.py", line 776, in state_attributes
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/media_player/__init__.py", line 776, in <dictcomp>
in ATTR_TO_PROPERTY if getattr(self, attr) is not None
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/openhome/media_player.py", line 202, in volume_level
return self._volume_level / 100.0
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'
Here is the HA log:
UPPDATE:
The standard media cards mute button works once in a while. Sometimes pressing the button and nothing happens, then suddenly after 20 seconds the mute works. The volume buttons and slider does not work.
UPPDATE2:
The volume buttons work sort off. Takes several minutes before the Rotel reacts with volume changes.
Hi,
Thanks for the extra info. Are you sure that error message is related to the RSP-1750 platform though? It seems to be related to the openhome platform. If I look in the log file it discovers a Linn Sneaky Music DS at 17:29:03. The error first appears 40 lines below that in the log file. Looking at the code of the openhome platform I can see that the error could be raised if the volume level is requested before the update method is called on the device so my current view is that it is unrelated to our current problem.
Is there anything in common between the Linn and the BF-430 in your physical setup?
One suggestion to eliminate it from our enquiries: Could you try commenting out the Rotel media_player from your configuration.yaml and see whether the Linn still raises that error? My guess is that it will.
A quick question. What happens if you physically turn the volume knob on the Rotel - does the slider move in real time or on a lag
As another direction to try to narrow things down. Do you have a PC or Linux box with Python 3.5 or above installed on it? We could try a really cut down test script.
FYI, I’ve started work on the services. I have something working but I want to refine it. Will let you know when it’s ready.
Regards,
Phil
P.S. I tried your automation script with no edits on my HassOS VM with the serial bridge and it worked fine and responded instantly. I’m sure that it’s possible to get this working.
You where spot on. I deleted the Linn Sneaky media player which I did not use.
Using the standard media card, the mute and the volume up and down works now on the Rotel without any problems.
Does this mean that media players can somehow be in conflict?
Hi,
Thanks for this. It gives me some good lines of inquiry.
I can’t see anything obviously wrong but I can imagine a few ways that the components could conflict. It could be a name conflict or something wrong in the way that one or other of the media player platforms interact with the parent layer. Or perhaps it is a conflict in a lower level library - both components are using the socket library deep under the hood.for example. I’ll definitely continue to look at this.
Since it’s working for you now I will probably focus on implementing the services and investigate the issue on the back-burner. I’m hoping to have time to really get into this over the long weekend coming.
Regards,
Phil
Just some nit-picking, how was the «source_map:» intended to be used. Renaming the source name configured on the Rotel itself, or rename and limit the sources displayed/picked up by the media_player.rotel_1570 sensor?
Personally I would prefer just seeing the sources listed in the «source_map:», since the other sources are not in use.
Hi,
I will add a config parameter to specify whether you want me to merge the source_map or explicitly specify it.
The reason that it’s the way it is is because on mine I haven’t customised inputs like CD and TUNER but I have customised the Video inputs. However, I think that your suggestion makes perfect sense so it’s on the list.
Regards,
Phil
This is shaping up really well : D
My I poke your brain, how you templated the speaker sensors from the media_player entity?
speaker_icons: {
"CBL": false,
"CBR": false,
"SL": false,
"SR": false,
"SW": false,
"FL": true,
"C": false,
"FR": true
}
Hi,
Have a look at the yaml files here.
configuration.yaml
contains a bunch of sensor definitions that you can cut/paste. groups.yaml
has the various groupings.
Some of this may change in the next version but I’ll update the examples as I change things. Also note that if this is accepted into Home Assistant then all of the names will change. Again, I will update the examples.
Hope this helps!
Regards,
Phil
Just a small detail. The RSP has two subwoofer outputs. I think your code just displays one SW. I use both and I only get one SW in the sensor attribute.
Hi,
The icons reflect the lights that you see on the front display of the processor and I think that there is only one subwoofer icon on the display. I think that the sub1 and sub2 outputs are the same channel. (it’s a 7.1 processor)
Regards,
Phil
He he. You are so right : ) I think I need Easter vacation
Have been playing with a GUI set up for the Rotel.
Some thoughts about the media_player.rsp_1570 attributes. This would make it easier to set up a GUI for the Rotel.
-
The “input_icons:” is an array where juts one can have a true value.
Why not, in the addition to the array, have a “source_in” attribute with the used input source.
-
This also would apply to the “sound_mode_icons” array.
A “sound_mode” attribute, in addition, containing the sound mode in use.
-
The attribute “icons:” with the string (A,Standby LED,FR,FL) is useful, but difficult to manipulate if you don’t wont to display, let’s say “Standby LED”. Maybe an option to deselect items?
-
Maybe translate “A” to “Analog” in the input_icons attribute (just my personal preference)?
Your code has been working fine after I configured to ignore media “Openhome”, with just some connection problems (had to restart HA) : )
Hi @Tomahawk,
That looks great. Glad to hear that things are working.
-
In fact, you can have multiple input icons active. For example, a device that uses HDMI for video and an Optical audio cable plugged into the Optical 1 input will show HDMI
, Optical
and 1
.
-
Similarly, in the sound mode icons I might see Pro Logic
, II
and x
all on at the same time.
-
(& 4.) The icons state was really meant for debugging. I’ll have a think about how to make it more friendly though, I have built friendly names for the icons into the underlying library so I will think about a way to expose them to the media player.
If you are feeling adventurous then you might want to grab the latest version of the component. New features are:
-
source_map
parameter in configuration.yaml
replaced by source_aliases
(breaking change!). I’ve reversed the map which allows you to suppress a source if you want to.
-
rotel_send_command
service (as requested)
-
rotel_reconnect
service
-
Example scripts.yaml
that shows how to use the services. (You can add each script to an entities card so that you can conveniently execute them from Lovelace.)
-
sends a DISPLAY_REFRESH command at start up and on reconnect. This means that the card should immediately sync with the physical device if it is already on when you start Home Assistant.
Review the updated README
here.
I strongly suggest that you start by backing up! There are quite a few recent changes so it may not be rock solid yet.
To upgrade, upload the files from the dothomeassistant/custom_components/rotel_rsp1570
folder in my GitHub project. Then replace the source_map
in your configuration.yaml with a source_aliases
equivalent. The example config files in dothomeassistant
have been updated so you might want to take a look (especially at scripts.yaml
)
One other small breaking change that may or may not affect you is that I moved the SB icon from the misc_icons state to the speaker_icons state. I realised that it is the Center Back icon in a 6.1 arrangement. If you copied my binary sensors and group definitions as-is then you may need to tweak that entry.
Regards,
Phil
I haven’t changed my Rotel setup for nine years. And you are correct concerning the source input and the sound mode. Since my Rotel has been re revitalized with your code, its time for my to read up on the Rotel manual again : )
I have reloaded HA with the latest version of your code. And at first glance it looks good, and displayed sources are filtered!
Just me wondering again, any reason ’ CD’ is defined differently than the other sources(?)
source_aliases:
' CD': STREAM
MULTI:
TAPE:
TUNER:
VIDEO 1: TV GET
VIDEO 2: PS4
VIDEO 3:
VIDEO 4:
VIDEO 5:
I use some days testing the new functionality.
Hi,
Great - glad to hear that it is OK so far.
Yes, the ' CD'
thing is a bit odd isn’t it? The aliases map maps the original name for an input to your alias for that input. By default the CD input (and only the CD input) shows on the display with a space in front of it. No idea why - it might be simply aesthetics on the part of the Rotel designers.
I did consider using a code for each input like INPUT_CD
, INPUT_VIDEO_1
etc. and hiding the default display names behind the scenes. Unfortunately I didn’t get round to it and now it would be another breaking change. One for the list I think.
Regards,
Phil
Your code still works fine : D
Any chance your code bundle will support update using HACS (Home Assistant Community Store)?