Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vlc telnet #24290

Merged
merged 20 commits into from
Jun 21, 2019
Merged

Vlc telnet #24290

merged 20 commits into from
Jun 21, 2019

Conversation

rodripf
Copy link
Contributor

@rodripf rodripf commented Jun 4, 2019

Description:

Trying to resolve this issue referenced in the vlc component doc I developed a component to control any instance of VLC running its built in telnet interface.

Alongside with this component, I've put together an add-on for the hassio platform to run a VLC instance locally.

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#9558

Example entry for configuration.yaml (if applicable):

# Example configuration.yaml entry
media_player:
  - platform: vlc-telnet
    name: speaker_1
    host: "192.168.1.56"
    port: 4321
    password: "secure_password"

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

homeassistant/components/vlc_telnet/media_player.py Outdated Show resolved Hide resolved
homeassistant/components/vlc_telnet/media_player.py Outdated Show resolved Hide resolved
homeassistant/components/vlc_telnet/media_player.py Outdated Show resolved Hide resolved
self._host = host
self._port = port
self._password = passwd
self._vlc = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though it's probably not too easy to achieve, this could have a timing issue: What if one of the functions like play_media is called before update? Please add , True to add_entities call to update on start.

Copy link
Contributor Author

@rodripf rodripf Jun 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the parameter! There is another case... what if the state is unavailable because the connection to VLC can't be made, but the user calls to play_media. The current behavior will be an exception thrown "None has no attribute...". Should I throw another exception or return False?

homeassistant/components/vlc_telnet/media_player.py Outdated Show resolved Hide resolved
homeassistant/components/vlc_telnet/media_player.py Outdated Show resolved Hide resolved
homeassistant/components/vlc_telnet/media_player.py Outdated Show resolved Hide resolved
homeassistant/components/vlc_telnet/media_player.py Outdated Show resolved Hide resolved
homeassistant/components/vlc_telnet/media_player.py Outdated Show resolved Hide resolved
rodripf and others added 6 commits June 4, 2019 12:55
Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>
Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>
Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>
Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>
+Manage error when the VLC dissapears to show status unavailable.
@pvizeli pvizeli self-assigned this Jun 5, 2019
@pvizeli pvizeli merged commit d468d0f into home-assistant:dev Jun 21, 2019
@pvizeli pvizeli added this to the 0.95.0 milestone Jun 21, 2019
balloob pushed a commit that referenced this pull request Jun 21, 2019
* Vlc telnet first commit

First functional version, remains to add more functionality.

* New functions added and bugfixes

* Compliance with dev checklist

* Compliance with dev checklist

* Compliance with pydocstyle

* Removed unused import

* Fixed wrong reference for exception

* Module renamed

* Fixed module rename in other

* Fixed wrong reference for exception


Module renamed


Fixed module rename in other

* Update homeassistant/components/vlc_telnet/media_player.py

Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* Update homeassistant/components/vlc_telnet/media_player.py

Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* Update homeassistant/components/vlc_telnet/media_player.py

Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* Update homeassistant/components/vlc_telnet/media_player.py

Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* Suggestions by @OttoWinter

+Manage error when the VLC dissapears to show status unavailable.

* Removed error log, instead set unavailable state

* Changes suggested by @pvizeli

-Import location
-Use of constants

* Implemented available method

* Improved available method
@balloob balloob mentioned this pull request Jun 26, 2019
alandtse pushed a commit to alandtse/home-assistant that referenced this pull request Oct 12, 2019
* Vlc telnet first commit

First functional version, remains to add more functionality.

* New functions added and bugfixes

* Compliance with dev checklist

* Compliance with dev checklist

* Compliance with pydocstyle

* Removed unused import

* Fixed wrong reference for exception

* Module renamed

* Fixed module rename in other

* Fixed wrong reference for exception


Module renamed


Fixed module rename in other

* Update homeassistant/components/vlc_telnet/media_player.py

Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* Update homeassistant/components/vlc_telnet/media_player.py

Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* Update homeassistant/components/vlc_telnet/media_player.py

Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* Update homeassistant/components/vlc_telnet/media_player.py

Accepted suggestion by @OttoWinter

Co-Authored-By: Otto Winter <otto@otto-winter.com>

* Suggestions by @OttoWinter

+Manage error when the VLC dissapears to show status unavailable.

* Removed error log, instead set unavailable state

* Changes suggested by @pvizeli

-Import location
-Use of constants

* Implemented available method

* Improved available method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants