Coder Social home page Coder Social logo

limych / media_player.linkplay Goto Github PK

View Code? Open in Web Editor NEW
30.0 10.0 53.0 1.07 MB

Deprecated. Please, use https://github.com/nagyrobi/home-assistant-custom-components-linkplay

License: MIT License

Python 99.68% Shell 0.32%
linkplay home-assistant custom-component media-player

media_player.linkplay's People

Contributors

limych avatar mgustavsso avatar smgt 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

media_player.linkplay's Issues

Restore music playback after TTS

We need to make services to save the current state of playing music and restore it. Same as media_player_sonos_snapshot and media_player_sonos_restore.

Connection refused

Source: https://community.home-assistant.io/t/linkplay-integration/33878/128?u=limych

I tried connecting to my Linkplay wireless ceiling speakers with this plugin and getting the following error on the logs:

Update for media_player.kitchen_speakers fails

Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/urllib3/connection.py”, line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File “/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py”, line 84, in create_connection
raise err
File “/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py”, line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

I can connect to the speakers fine and get a json response:

http://my-ip/httpapi.asp?command=getStatus

{ “language”: “en_us”, “ssid”: “Wifi Speaker_5F10”, “hideSSID”: “0”, “firmware”: “3.6.4122”, “build”: “release”, “project”: “Lumi_WSP-6_A31”, “priv_prj”: “Lumi_WSP-6_A31”, “Release”: “20170222”, “group”: “0”, “expired”: “0”, “internet”: “1”, “uuid”: “FF31F01281534F88B617C394”, “MAC”: “removed”, “date”: “2020:01:21”, “time”: “16:38:16”, “netstat”: “2”, “essid”: “486F6D655F57696669”, “apcli0”: “ip-removed”, “eth2”: “0.0.0.0”, “hardware”: “A31”, “VersionUpdate”: “0”, “NewVer”: “0”, “mcu_ver”: “1611”, “mcu_ver_new”: “0”, “ra0”: “ip-removed”, “temp_uuid”: “CE407CCBF3E01539”, “cap1”: “0x0”, “capability”: “0x20680200”, “languages”: “0x6”, “dsp_ver”: “”, “streams_all”: “0xfffffff”, “streams”: “0xfffffff”, “region”: “unknown”, “external”: “0x0”, “preset_key”: “6”, “plm_support”: “0x2”, “WifiChannel”: “11”, “RSSI”: “-70”, “battery”: “0”, “battery_percent”: “0”, “securemode”: “1”, “auth”: “WPAPSKWPA2PSK”, “encry”: “AES”, “psk”: “removed”, “upnp_version”: “1004”, “upnp_uuid”: “uuid:FF31F012-8153-4F88-B617-C394FF31F012”, “uart_pass_port”: “8899”, “communication_port”: “8819”, “web_firmware_update_hide”: “0”, “privacy_mode”: “0”, “user1”: “278:524”, “user2”: “5959:6291”, “DeviceName”: “Kitchen Speakers”, “GroupName”: “Kitchen Speakers” }

The speakers work with any commands I’ve tried from here:

GitHub

AndersFluur/IEastMediaRoom
The specification of the Sonoe IEast protocol translated from French and PDF. The protocol is also valid for receivers branded 'Roxcore' - AndersFluur/IEastMediaRoom

Any ideas where to go from here?
Thanks

Also seeing this in the logs if it helps:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 279, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/linkplay/media_player.py”, line 705, in update
lxml.etree.XMLSyntaxError):
NameError: name ‘lxml’ is not defined

ImportError: failed to find libmagic

2019-12-29 19:28:53 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.kitchen fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 281, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/linkplay/media_player.py", line 764, in update
self._update_from_id3()
File "/config/custom_components/linkplay/media_player.py", line 656, in _update_from_id3
import eyed3
File "/usr/local/lib/python3.7/site-packages/eyed3/init.py", line 32, in
from .utils.log import log # noqa: E402
File "/usr/local/lib/python3.7/site-packages/eyed3/utils/init.py", line 27, in
import magic
File "/usr/local/lib/python3.7/site-packages/magic.py", line 181, in
raise ImportError('failed to find libmagic. Check your installation')
ImportError: failed to find libmagic. Check your installation

Tunein metadata

Not an issue as such but not quite a feature request either.

If I play media from Tunein on the linkplay speakers via the SmartSonix app on my phone then the correct media metadata is interpreted and homeassistant shows the current radio station name/details and logo.

If I play the same radio station directly from the audio stream link URL from Tunein using mediaplayer.play_media via a script then no media info is shown.
Is there a way to get this component to read the metadata from the stream URL or what is the source of the metadata?

For folks using a Audio Pro Device

Hi, me and my friend named @pnbruckner have fixed this component to work with audio pro speakers or atleast the c5. I dont really want to make a PR as the code is modified to work just with audio pro and the other ones have not been taken into consideration.
But if youre using a audio pro speaker, feel free to contact me on discord or email and i'll try to help you with it.
Discord: Svemat#8259
E-mail: [email protected]
Credit for it should go to pnbruckner as he was the one who told me how to do the stuff, so thanks again :)

[tts] speaker fails to playback tts

Version of the custom_component

VERSOIN = '1.1.6' plus #25 patch

Configuration

media_player:
  - platform: linkplay
    host: 192.168.2.12
    device_name: livingroom
  - platform: linkplay
    host: 192.168.2.13
    device_name: office

tts:
  - plattform: google_translate
    language: de

Describe the bug

With Version 0.110.0 when the enaming of the MediaPlayerDevice entitiy is started. That the playback of tts is failing on my linkplay speakers. I tested it with my other setup and it works with other speakers still well. Anyone else having the problem or may knows a fix? Yes I patched the component as decribed in #25.

Steps to reprouce:

open speaker in the HA ui
type in text for tts
play press
you will hear nothing (ui grays out the speaker for a moment)

Debug log


nohing to see in the logs :(

![Bildschirmfoto 2020-09-05 um 14 11 40](https://user-images.githubusercontent.com/879178/92304849-15dfd900-ef82-11ea-8dce-52942a3d1c7d.png)


IEAST M5

Hi,
I have 3 IEAST M5 media player and have some issues.
I can control them but cannot get proper status.
From the start the state is "Unknown" as soon as I change the volume I get some status like audio source, volume level, but no audio title or others. I can plays/pause but the button icon does not change and get a banner in HA telling "Failed to call service media-player/media_play_pause. 'NoneType' oblect is not iterable"
I'm running HA 0.94.3

How to go further debugging ?

Error while calling service

Version of the custom_component

Configuration

automation:
  - alias: "[Media] Play Radio on Wake"
    initial_state: on
    trigger:
      - platform: state
        entity_id: group.motion
        to: 'on'
    condition:
      condition: and
      conditions:
        - condition: state
          entity_id: input_boolean.play_radio
          state: 'off'
          for:
            hours: 5
        - condition: state
          entity_id: input_select.day_mode
          state: 'Утро'
        - condition: state
          entity_id: input_boolean.guest_mode
          state: 'off'
    action:
      - service: media_player.volume_set
        data:
          entity_id: all
          volume_level: 0.35
      - service: input_boolean.turn_on
        entity_id: input_boolean.play_radio
      - service: notify.all
        data:
          message: 'С добрым утром!'

Describe the bug

Error while calling service

Debug log


2019-08-24 11:17:00 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.media_play_radio_on_wake. Unknown error for call_service at pos 1: 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 427, in action
    await script_obj.async_run(variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 151, in async_run
    await self._handle_action(action, variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 235, in _handle_action
    await self._actions[_determine_action(action)](action, variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 318, in _async_call_service
    context=context,
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 97, in async_call_from_config
    domain, service_name, service_data, blocking=blocking, context=context
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 210, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 334, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 349, in _handle_service_platform_call
    entity.supported_features & feature_set for feature_set in required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 349, in 
    entity.supported_features & feature_set for feature_set in required_features
TypeError: unsupported operand type(s) for &: 'NoneType' and 'int'

HA 0.96

Hi,
the component seems not working well with HA 0.96.
Any suggestions?
Thanks,

Manuel

MediaPlayerDevice is deprecated

HA Beta: 0.110.0b5
Supervisor Beta channel: 222
93EB7587-318C-4631-8AA1-97DA4F4D6150
HassOS 4.6
Deployment | staging

Hello I’m on HA Beta version: 0.110.0b5

The have changed somting so now I get a error, so I’m wondering if you are working on a updated to your add-on?

Log Details (WARNING)
Logger: homeassistant.components.media_player
Source: components/media_player/init.py:938
Integration: Media player (documentation, issues)
First occurred: 3:27:54 PM (1 occurrences)
Last logged: 3:27:54 PM

MediaPlayerDevice is deprecated, modify LinkPlayDevice to extend MediaPlayerEntity

Incorrect change of volume

When you change the volume for one speaker, it changes immediately on all connected devices - both on the master and on the slave.

Update for media_player.audiopro fails

Version of the custom_component

1.1.2 commit: 2db347b

Configuration

media_player:

  • platform: linkplay
    host: 192.XXX.XXX.XXX
    devicename: AudioPro_C3_XXXXXX
    name: 'AudioPro C3'

Describe the bug

Update for media_player.audiopro_c3 fails

Debug log

Log Details (ERROR)
Fri Aug 23 2019 13:19:17 GMT+0200 (CEST)

Update for media_player.audiopro_c3 fails
Traceback (most recent call last):
File "/usr/src/app/homeassistant/helpers/entity.py", line 249, in async_update_ha_state
await self.async_device_update()
File "/usr/src/app/homeassistant/helpers/entity.py", line 419, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/linkplay/media_player.py", line 701, in update
if upnpclient.Device(entry.location).friendly_name ==
File "/usr/local/lib/python3.7/site-packages/upnpclient/upnp.py", line 131, in init
self._read_services()
File "/usr/local/lib/python3.7/site-packages/upnpclient/upnp.py", line 180, in _read_services
findtext('eventSubURL')
File "/usr/local/lib/python3.7/site-packages/upnpclient/upnp.py", line 235, in init
self.scpd_xml = etree.fromstring(resp.content)
File "src/lxml/etree.pyx", line 3234, in lxml.etree.fromstring
File "src/lxml/parser.pxi", line 1876, in lxml.etree._parseMemoryDocument
File "src/lxml/parser.pxi", line 1764, in lxml.etree._parseDoc
File "src/lxml/parser.pxi", line 1127, in lxml.etree._BaseParser._parseDoc
File "src/lxml/parser.pxi", line 601, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 711, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 640, in lxml.etree._raiseParseError
File "", line 1
lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1

Audio Pro speaker modes

Hi, I managed to add my Audio Pro C10 speakers to hass. Unfortunately inputs are not alligned between hass and speakers:
Line-in within hass sets speakers to Aux mode (jack at the top of the speaker)
There is no option to set speakers in hass to Line-in mode (RCA input at the back of the speaker)

I'm not a programmer and hass beginner, but after having a look at media_player.py I assume it's a matter of mapping them in SOURCES_MAP. It also seems the mapping should be dynamic depending on brand of speakers being used.

Happy to add more details or contribute more, but please mind my limited skillset.

Help

Hello, i cannot get this to work with my home assistant setup

copied the three files to the custom_components-linkplay folder but configuration wont reboot??

Add support for Arylic devices

Hey,

I have an Acrylic media player and it should be a Linkplay chip inside.
But I tried the plugin but it does not work properly. Some things work others don't.
The API commands look like they should work with your plugin. I used the API with node red
and this works fine.

Arylic have some very cool devices for budget multi room audio.
https://www.arylic.com

API Docs:
https://www.dropbox.com/sh/es7djofs1bt83es/AACg62IPjuu0bVlyaFzZsqcza/API%20file?dl=0&preview=WIFI+AUDIO+HTTP+API.pdf&subfolder_nav_tracking=1

I'm not capable of doing this myself :-/

_update_via_upnp bug

2019-04-29 13:41:12 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.kitchen fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 220, in async_update_ha_state
    await self.async_device_update()
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity.py", line 377, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/linkplay/media_player.py", line 710, in update
    self._update_via_upnp()
  File "/config/custom_components/linkplay/media_player.py", line 591, in _update_via_upnp
    xml_tree = ET.fromstring(media_info)
  File "/usr/local/lib/python3.7/xml/etree/ElementTree.py", line 1315, in XML
    parser.feed(text)
  File "/usr/local/lib/python3.7/xml/etree/ElementTree.py", line 1630, in feed
    self.parser.Parse(data, 0)
TypeError: a bytes-like object is required, not 'NoneType'

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.