GithubHelp home page GithubHelp logo

mmuffins / hass-nowplaying Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 44 KB

Controls Home Assistant media players from the linux desktop

License: MIT License

Dockerfile 0.38% C# 98.66% Shell 0.96%

hass-nowplaying's Introduction

Home Assistant Now Playing Daemon

hass-nowplaying connects to a local to home assistant instance and exposes its media players to the linux D-Bbus. This lets the local desktop display information about the currently playing media to be displayed on the and allows for remote control of the media player.

Setup

Manual installation

To manually install the application download the latest tarball from the releases section and extract it with

tar -xzvf hass-nowplaying.tar.gz

Copy the extracted file to the /usr/bin directory

cp hass-nowplaying/hass-nowplaying /usr/bin

Copy appsettings json to a valid config file location and configure all required settings. See the configuration section for more information.

mkdir ~/.config/hass-nowplaying
cp hass-nowplaying/appsettings.json ~/.config/hass-nowplaying

Via deb file

To install the application via deb file, download the latest version from the releases section and install it with

dpkg -i hass-nowplaying.deb

Copy the example configuration file to the user directory

mkdir ~/.config/hass-nowplaying/
cp /usr/share/doc/hass-nowplaying/appsettings.json ~/.config/hass-nowplaying/

Via rpm file

To install the application via rpm file, download the latest version from the releases section and install it with

rpm -ivh hass-nowplaying-<version>.rmp

Copy the example configuration file to the user directory

mkdir ~/.config/hass-nowplaying/
cp /usr/share/doc/hass-nowplaying/appsettings.json ~/.config/hass-nowplaying/

Configuration

Config file

The application is configured in the appsettings.json which it tries to find in different locations, in the following order:

  • The path configured in the HASSNOWPLAYING_CONFIG_PATH environment variable
  • $XDG_CONFIG_HOME/hass-nowplaying/appsettings.json if the XDG_CONFIG_HOME environment variable is set
  • ~/.config/hass-nowplaying/appsettings.json if no other option applies

Supported properties

The following options are supported in the configuration file:

  • Logging - Optional. Supports standard .net core logging settings, see https://learn.microsoft.com/en-us/aspnet/core/fundamentals/logging
  • HomeAssistant
    • Host - The hostname or IP address of the Home Assistant instance to connect to.
    • Port - The port number on which Home Assistant is running.
    • Ssl - Boolean value indicating whether to use SSL/TLS to connect to Home Assistant.
    • Token - Long-lived access to authenticate with Home Assistant.
  • MediaplayerEntity - The entity ID of the media player in Home Assistant to connect to.
  • MediaArtSize - Size of the media cover art in pixels. If not set, it defaults to using the original artwork size. Set to 0 if you explicitly want to always use the full artwork size.

Running the application

Interactively

Once it has been installed and configured the application can now be started interactively by running hass-nowplaying. There are no parameters or switches, all configuration is done with the configuration file. Once started, the application will create an mpris media player service that automatically integrates itself with all distributions that support it to display the currently playing track and enable media key controls.

As service

Note that the application needs to access the user D-Bus session, so it's not possible to run it as regular root service! The hass-nowplaying supports being run as service. To do so, copy the service file to the systemd user directory and reload the daemon.

cp /usr/share/hass-nowplaying/hass-nowplaying.service ~/.config/systemd/user/
systemctl --user daemon-reload

The application can now be started as service.

systemctl --user start hass-nowplaying.service

To enable it to run on startup, configure it with

systemctl --user enable hass-nowplaying.service

When running the application as daemon it is recommended to change the log level in appsettings.json to Warning to prevent spamming the system log with unneeded information.

To uninstall the service, disable it and delete the service file:

systemctl --user stop hass-nowplaying.service
systemctl --user disable hass-nowplaying.service
rm ~/.config/systemd/user/hass-nowplaying.service
systemctl --user daemon-reload

hass-nowplaying's People

Contributors

mmuffins avatar dependabot[bot] avatar

Watchers

 avatar

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.