Giter VIP home page Giter VIP logo

kodi-media-sensors's Introduction

Kodi Recently Added Media for Home Assistant

hacs_badge

This Home Assistant component is used to feed custom cards like Upcoming Media Card, Kodi Playlist Card or Kodi Search Card with data coming from Kodi. It is based on the project of Aaron Godfrey (https://github.com/boralyl/kodi-recently-added). Check the credits section.

Upcoming Media Card Kodi Playlist Card

Table of Contents

Installation

Pre-Installation

NOTE: This component has been tested with Home Assistant 2021.1.3 only. Additionally Kodi must be setup via the UI in the integrations section of the Home Assistant configuration.

HACS Install

  1. Search for Kodi Media Sensors under Integrations in the HACS Store tab.
  2. You will need to restart after installation for the component to start working.
  3. Go to Integration Installation your sensor using the options.

Manual Install

** This method is not recommended **

  1. In your /config directory, create a custom_components folder if one does not exist.
  2. Copy the kodi_media_sensors folder and all of it's contents from to your custom_components directory.
  3. Restart Home Assistant.
  4. Go to Integration Installation your sensor using the options.

Integration Installation

  1. After Automatic install or manual install, go to the Integration panel (under Configuration section) and search for the ne component by clicking on the button 'Add Integration'. Enter the name of the component (Kodi Media Sensors).
  2. During the installation, choose the Kodi entity previously installed.
  3. Select the sensors you want to use (see Available Sensors)
  4. Click Submit
  5. You should now see new entities in Home Assistant (one for each sensor activated)

It's not possible to add new sensors after installation, so if you need new ones (or if you don't need one anymore), just uninstall the integration and add it again. You will then be able to select the sensors you need.

Configuration

Configuring via Integrations

An Options button will appear on the integration. Clicking this will allow you to toggle additional options.

Option Description
hide_watched Excludes recently added video media that is marked as watched (movie sensors) when option is schecked
use_auth_url Adds the kodi username:password in the url's to access ressources from kodi (like images)
search_limit Sets the limit of the results returned by a search call. The limits applies to each media type (songs, album, movie, ...)

Card Configuration

Sample for ui-lovelace.yaml:

Depending on the sensors you added and the custom card you installed, you can use the code below to display information from Kodi.

Here two examples with Upcoming Media Card and Kodi Playlist Card

- type: custom:upcoming-media-card
  entity: sensor.kodi_recently_added_tv
  title: Recently Added Episodes
  image_style: fanart
- type: custom:kodi-playlist-card
  entity: sensor.kodi_media_sensor_playlist

Available Sensors

  • sensor.kodi_media_sensor_recently_added_tvshow tracks your recently added tv shows
  • sensor.kodi_media_sensor_recently_added_movie tracks your recently added movies
  • sensor.kodi_media_sensor_playlist tracks your playlist in Kodi (audio and video)
  • sensor.kodi_media_sensor_search tracks your search results

Services available with sensors

Some sensors come with services you can use. The definition of the services depends on each sensor. The service can be called via call_method

kodi_media_sensor_search

  1. search(media_type, value)
    Searches in the specified media type for the referenced value. The media type 'all' will return result for songs, albums, artists, movies and tv shows.
    • media_type: { all | artist | tvshow }
    • value: { str (title) | int (artistid) | int (tvshowid) }

Example:

entity_id: sensor.kodi_media_sensor_search
method: search
item:
  media_type: all
  value: beatles
  1. clear()
    This function clears the data of the sensor

Example:

entity_id: sensor.kodi_media_sensor_search
method: clear
  1. play(arg)
    This function plays the desired object wth the good player. The argument depends on what object has to be played. the argument can be one of songid, albumid, movieid, episodeid.

Examples:

entity_id: sensor.kodi_media_sensor_search
method: play
songid: 1
entity_id: sensor.kodi_media_sensor_search
method: play
movieid: 15

kodi_media_sensor_playlist

  1. goto(posn, player)
    This function plays the object at the given position for the given player

Example:

entity_id: sensor.kodi_media_sensor_playlist
method: goto
item: 
  playerid: 0
  to: 5
  1. remove(posn, player)
    This function removes an object from the given playlist

Example:

entity_id: sensor.kodi_media_sensor_playlist
method: remove
item:
  playlistid: 0
  position: 5

Cards to use with sensors

The goal is to group all the sensors and have seperate Cards to display the sensors data. The cards that where tested are:

Upgrading from configuration.yaml to UI Integration

  1. Remove any sensors in your configuration.yaml that reference the kodi_media_sensors platform.
  2. Restart Home Assistant.
  3. Follow the steps from the begining in the section Installation

Known Issues

Below is a list of known issues that either can't be fixed by changes to the component itself due to external factors.

Artwork does not load

One reason this could occur is if you setup you Home Assistance instance to use SSL and your Kodi instance does not use SSL. When the upcoming-media-card tries to load the artwork it will fail to do so since modern browsers do not allow loading insecure requests. See #6 for more details and possible workarounds.

Genres, ratings and studios don't show up for TV Shows

Currently genres, rating, and studio are only populated for Movies. This is a limitation of the data Kodi stores for TV shows.

Credits

Aaron Godfrey is the original developer of this project and did an excellent job. As I needed something similar to display my running playlist in Kodi, I started to enhance the component. Thanks a lot Aaron for letting me enhance your project! Let's hope other people might find it useful. Do not hesitate to support Aaron and his many projects.

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.