GithubHelp home page GithubHelp logo

georgesg / lovelace-folder-card Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 5.0 572 KB

๐Ÿ“‚ Folder Card for Home Assistant's Lovelace UI

License: MIT License

JavaScript 5.67% TypeScript 94.33%
homeassistant lovelace lovelace-card lovelace-custom-card home-assistant

lovelace-folder-card's Introduction

Folder Card

HACS Downloads GitHub Release CI Project Maintenance License

Overview

This is a Lovelace card for Home Assistant that displays files listed by a Folder sensor.

If you define a call-service tap_action, the service will receive a file variable with the file path of the selected file.

example

Installation

Install using HACS or follow this guide

resources:
  - url: /local/folder-card.js
    type: module

Usage

Visual Editor

Folder Card supports Lovelace's Visual Editor. Click the + button to add a card and search for folder card.

Visual Editor

YAML

type: 'custom:folder-card'
title: 'My file list'
icon: 'mdi:folder'
entity: sensor.folder
tap_action:
  action: 'call-service'
  service: script.use_file

Options

Name Type Requirement Description Default
type string Required custom:folder-card
title string Optional Card name Folder's friendly_name
icon string Optional Card icon none
entity string Optional Folder sensor entity none
tap_action object Optional Action to take on tap none
sort string Optional ascending, descending, or default default - as sorted in sensor
max_count number Optional Number of files to show. Applied after sort none - show all files
show_count boolean Optional Show total file count in header false
show_hidden boolean Optional Show files without extension. Set to true to hide subfolders false

Action Options

Name Type Requirement Description Default
action string Required Action to perform (more-info, toggle, call-service, navigate url, none) none
navigation_path string Optional Path to navigate to (e.g. /lovelace/0/) when action defined as navigate none
url string Optional URL to open on click when action is url. The URL will open in a new tab none
service string Optional Service to call (e.g. media_player.media_play_pause) when action defined as call-service none
service_data object Optional Service data to include (e.g. entity_id: media_player.bedroom) when action defined as call-service. Automatically adds "file" property with the file addrerss to service_data. none
haptic string Optional Haptic feedback for the Beta IOS App success, warning, failure, light, medium, heavy, selection none
repeat number Optional How often to repeat the hold_action in milliseconds. none

Meta

Georgi Gardev

lovelace-folder-card's People

Contributors

dependabot[bot] avatar georgesg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lovelace-folder-card's Issues

Card not working in stacks

Lovelace will not show the card if you placed it in a stack.

No errors in console from what I can see. Latest version of card and HASS

Navigate to sub folder

Hi GeorgeSG
Is it possible to navigate to subfolder and back to parent path?

Thanks for any suggestion.

Why Not Use("media_content_id:") instead of ("File") property?

Checklist:

  • [ YES ] I updated to the latest version available
  • [ YES ] I cleared the cache of my browser

The problem

I see Great Potential for this card, Revolutionary for me at-least.
However; Your documentation is a bit limited.
The instructions here on the README.md say

" If you define a call-service tap_action, the service will receive a file variable with the file path of the selected file."

tap_action: call-service: service: media_player.media_play service_data: entity_id: media_player.bedroom_clock

I've Tried Many Many Times with many different methods of "tap_action:" defined within the card its-self; most especially I tried all variations of call_service, service_data, data, that I could think of. I also tried defined as a Script referenced as "tap_action:"-"action: call-service"-"script.use_file .....
Unfortunately I have failed to accomplish this. No mater the "tap_action:" "action:" I chose, nothing results in success after clicking on the file shown in the card on the lovelace front-end. (only the Errors listed Below.)

My Bug report is more of a Question. I could not find another method to PM you so here goes.
"Why Not Use("media_content_id:") instead of ("File") property?" As the Output for the tap_action command? (all Media Players that I have found in Hassio; - Expect to receive the Field "media_content_id:" and the Field "data:" never excepts "file:" as valid key. )

All of my errors as listed in the logs;
Either references the need for; or lack of; "media_content_id:". SO it stands to reason that "media_content_id:" is not being supplied or provided.

Example of Error type 1:

  • required key not provided @ data['media_content_id']
  • string value is None for dictionary value @ data['media_content_id']

The other errors make reference to "extra keys not allowed" "file" is not allowed in "data:"

Example of Error type 2:

  • extra keys not allowed @ data['file']

Environment

arch x86_64
chassis vm
dev false
docker true
docker_version 19.03.11
hassio true
host_os HassOS 4.13
installation_type Home Assistant OS
os_name Linux
os_version 5.4.63
python_version 3.8.3
supervisor 244
timezone America/New_York
version 0.114.4
virtualenv false
  • folder-card release with the issue: 0.4
  • Last working folder-card release (if known): unknown
  • Browser and Operating System:

Browser: = "Google Chrome" - "Product Version: 85.0.4183.102"
OS: = "Windows 10 Pro for Workstations x64" Product Version
Run_msinfo32_OS_Name
Windows10ProForWorkstations

Problem-relevant configuration

 NOT APPLICABLE

Javascript errors shown in the web inspector (if applicable):


 NOT APPLICABLE

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.