Giter Club home page Giter Club logo

lovelace-time-picker-card's Introduction

Time Picker Card

HACS Downloads GitHub Release CI Project Maintenance License

Overview

This is a Time Picker Card for Home Assistant's Lovelace UI.

Requires an Input Datetime that has time (has_time: true).

Installation

HACS

Install using HACS and add the following to your config:

resources:
  - url: /hacsfiles/lovelace-time-picker-card/time-picker-card.js
    type: module

Manual

Download time-picker-card.js from the latest realease and place it in your config/www folder. Add the following to your config:

resources:
  - url: /local/time-picker-card.js
    type: module

Usage

Visual Editor

Time Picker Card supports Lovelace's Visual Editor. Click the + button to add a card and search for time picker.

Visual Editor

Examples

Default config - card name shown, 24 hour mode

Default theme with card name

type: 'custom:time-picker-card'
entity: input_datetime.alarm_time

Custom config - hidden card name, 12 hour mode

Default theme with no card name

type: 'custom:time-picker-card'
entity: input_datetime.alarm_time
hour_mode: 12
hide:
  name: true

Custom config - hidden card name, 12 hour mode with a "single" hour mode picker

Default theme with single hour mode

type: 'custom:time-picker-card'
entity: input_datetime.alarm_time
hour_mode: 12
layout:
  hour_mode: single
  align_controls: right
hide:
  name: true

Custom config - card name inside card and controls aligned right

Default theme with single hour mode

type: 'custom:time-picker-card'
entity: input_datetime.alarm_time
layout:
  name: inside
  align_controls: center

Dark theme, embedded layout

Dark theme embedded

Dark theme, thin layout

Dark theme thin layout

With a custom lovelace theme

Custom theme

Options

Name Type Requirement Description Default
type string Required custom:time-picker-card
entity string Required Input Datetime entity with has_time: true
name string Optional Card name Entity's friendly_name
link_values boolean Optional If enabled, will change hour when minutes overflow. E.g. will go from 11:55 to 12:00, instead of 11:00 false
hour_mode 12 or 24 Optional Hour format. If 12, card will show AM/PM picker 24
hour_step number Optional Hour change when clicking arrows 1
minute_step number Optional Minute change when clicking arrows 5
delay number Optional Delay in ms before updating entity 0
layout object Optional Card Layout configuration none
hide object Optional Hide object none
tap_action action Optional Home assistant action to perform on tap more-info
double_tap_action action Optional Home assistant action to perform on tap more-info
hold_action action Optional Home assistant action to perform on tap more-info

Layout Object

Name Value Requirement Description Default
hour_mode single, double Optional Whether to show both AM/PM or just the current mode. In single mode, tap the value to change it. double
align_controls left, center, right Optional Horizontal alignment of the controls center
name header, inside Optional Whether to show the name as a header or inside the card header
embedded boolean Optional Render with embedded style - disables padding, box shadow, and card header false
thin boolean Optional Render with reduced paddings false

Hide Object

Name Type Requirement Description Default
name boolean Optional Hides the card name false
icon boolean Optional Hides the card icon (only with controls "inside") false
seconds boolean Optional Hides seconds input true

Theme Variables

Time Picker Card will automatically pick up colors from your lovelace theme, but if you want to customize some of them, you can use the following variables in your theme's config file:

Name Default Description
time-picker-elements-background-color var(--primary-color) Background color for header and inputs
time-picker-icon-color var(--primary-text-color) Arrow color
time-picker-text-color white Text color
time-picker-accent-color var(--primary-color) AM / PM active color
time-picker-off-color var(--disabled-text-color) AM / PM inactive color
time-picker-border-radius var(--ha-card-border-radius) Border radius of the card
time-picker-control-padding 8px Padding for interactive elements. Increase for larger hitboxes of the controls. Example: 10px 12px

Meta

Georgi Gardev

lovelace-time-picker-card's People

Contributors

dependabot[bot] avatar georgesg avatar otoussaint avatar wrt54g 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lovelace-time-picker-card's Issues

Visual Editor crashes when trying to add an action

Checklist:

  • I updated to the latest version available
  • I cleared the cache of my browser (tried Strg+F5 several times, and deleted the history)

The problem

The Visual editor crashes when I try to add an action. Please see the attached image -when I click on any of these entries, the popup/window closes. I don't see any error in the browser console. Some times strings are visible next to the icon -sometimes not. I cannot reproduce it.

I installed this addon through HACS. After installing it, I restarted the service and cleared the browser cache. The error occurs in Firefox and Chrome.

Environment

  • Time Picker Card 1.4.0
  • HACS 1.29.0
  • Firefox 108.0.1 / Chrome 108.0.5359.125 (Windows 10)
  • Home Assistant 2022.12.7 (Frontend 20221213.1 - latest)

error

Just a little detail

Please correct documentation. The right lines to write in resources.yaml are:

  • url: /hacsfiles/lovelace-time-picker-card/time-picker-card.js
    type: module
    not
  • url: /local/time-picker-card.js
    type: module
    Congrats for this plugin!!!!!

Sensor with time-picker-card data formatted without seconds.

Hello George;

Great work on the card! I just installed it and love it!

I am trying to make a sensor to filter the data produced by the time-picker-card to shave off the seconds characters from the string to send to an LCD display. I can't seem to add the input_datetime as a sensor on the LCD as it is a string and handles it better as text, but this adds 3 extra characters to my output on the LCD that I really don't need, ":00". I could use the extra character space on the display.

I have been researching time template sensors on Home Assistant, but I am not really trying to do a calculation from current time, I am trying to use the numbers input by your picker. How can I do this???

Dynamic Hours when using Minutes Picker

Firstly.. awesome card !! Makes a great addition to my setup 🥳

Problem

When navigating with the minutes picker, the hour remains fixed.

Is it possible to make this more dynamic ? This will help to improve WAF

Suggested feature / solution

If the current time is 05:00, pressing the minutes down arrow should change to 04:55, rather than 05:55

Additional context

Add input_boolean toggle option

Problem

When using this to set my wake up alarm time it would be nice to have an option to toggle the alarm on and off

Suggested feature / solution

Option to add an input_boolean toggle to the card in order to toggle automations related to the selected time

Need update for borders in HA 2022.11.0 when embedded

Checklist:

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

The problem

In the new HA UI, a border is shown when used as embedded.
This should be removed.

Environment

frontend==20221031.0
homeassistant==2022.11.0b5

  • time-picker-card release with the issue: Not relevant
  • Last working time-picker-card release (if known): Not relevant
  • Browser and Operating System: Edge, Windows 10

Problem-relevant configuration

- type: entities
  entities:
    - type: custom:time-picker-card
      entity: input_datetime.shower
      name: Shower time
      hour_mode: 24
      link_values: true
      hide:
        icon: true
      layout:
        name: inside
        align_controls: right
        embedded: true

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

Not applicable

Workaround, using card-mod

      style: |
        ha-card {
          border: none;
        }

Is it possible to embed in a entities ?

Is it possible to remove this extra frame?
image
`

  • type: entities
    show_header_toggle: false
    entities:
    • entity: switch.teplyi_pol
      state_color: true
    • type: 'custom:time-picker-card'
      entity: input_datetime.input_time_timerwarmfloor
      layout:
      name: inside
      align_controls: right
    • input_datetime.input_time_timerwarmfloor
    • automation.avto_vykl_teplogo_pola_nochiu
      `

Round edges when using header

Problem

When using layout>name as header the top corners are not rounded like the bottom corners when using a custom theme. When using Layout>name as inside all the corners are rounded like they should be according to the theme.
Feature request

Suggested feature / solution

Make the header bar reference corner rounding from themes.

Thanks for making an EPIC card!!

Background color not displaying correctly

Checklist:

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

The problem

When selecting Embedded from layout menu, card blends in with HA background;
TPC doesn't pick up correct card background color.

Environment

TPC v: 1.4.0
HA OS: 10.3
HA Core: 2023.6.3

  • time-picker-card release with the issue: 1.4.0
  • Last working time-picker-card release (if known):
  • Browser and Operating System: Chrome/MacOS

Problem-relevant configuration

type: custom:time-picker-card
entity: input_datetime.next_sunset
hour_mode: 24
hour_step: 1
minute_step: 5
layout:
  hour_mode: double
  align_controls: right
  name: header
  embedded: true
hide:
  seconds: true

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


Add last update as secondary info/line

Hi
Thanks for the nice card !

I'd love to be able to able to have a secondary info/line right below the title showing when the last update was made.

Thanks

Hide icon not working in companion

Hello,
it seems that the hide icon setting is not working in the companion app ? Impossible to hide it in companion ?
It works well on computer ...
Thanks
card_code
companion
UI computer

minute_step, round to the nearest time without remainder

First of all thank you for the great card!

Problem

Suggested feature / solution

Currently if I have for example 15:24 as a time and minute_step=15 in the config, if I press "ᐱ" button it will change time to 15:39, then to 15:54, 16:09, etc. Instead as an option I'd like to have it first changed to 15:30, then to to 15:45, 16:00, etc. So to have after each interaction minutes without remainder.

Additional context

Change the font

How can I change the font so it is the same of the theme font ?

image

Duration picker

This is a beautiful project. I wonder if it'd be difficult to extend to work as a duration picker for timers.

I'd love to see this as a timer interface in lovelace, with the arrows for setting the timer duration and numbers that count down while the timer is active, providing quick access to add minutes or seconds to the running timer.

Time values not showing

On the mobile companion app (ios) for home assistant, the numbers for the time picker do now show up, however when the arrows are tapped the time does change.
8FCE3C58-F242-4ECA-BCCB-1BF25DB5754E

Modding styles with card-mod

I'm trying to mod the styles of this card with lovelace-card-mod, but I don't seem to be able to target the time-unit elements.

I have tried adding this to the card in lovelace, but it's not changing the cards CSS:

type: 'custom:time-picker-card'
entity: input_datetime.alarmclock_time
hour_step: 1
minute_step: 5
name: ''
layout:
name: header
align_controls: center
hour_mode: double
hour_mode: 24
link_values: false
hide:
name: false
style: |
ha-card{
border:solid 5px blue !important;
}
.time-unit{
font-weight: 900 !important;
border:solid 5px green !important;
}

Specifying color, a little help?

Hi, I am not sure how to define time-picker-elements-background-color in the yaml? I have not found an example for this.

Does it go under a theme header and what how is the rgb format specified, eg. 0xFF00FF or something?

Thank you

Add date support

Problem

Suggested feature / solution

Would be cool to have full control of a datetime entity. The card in it's current state seems to have enough space for a date picker. We would have more precise control of a potential alarm (what this card is mostly used for) and, overall, this card could be the card for the whole datetime entity instead of utilizing only the "set time" functions.

Additional context

Embedding style

Thanks for the card! I really like it a lot.

Problem

When putting the card inside another card, like an entities card, the padding is a bit much:

image

Suggested feature / solution

It would be nice to be able to have a setting to make the card use less padding and no box shadow to fit in more in the middle of other entities.

Additional context

I have manually edited the CSS to:

  • Remove the 16px padding from .time-picker-row
  • Set box-shadow: none on <ha-card class="type-custom-time-picker-card">

That makes it look like this:
image

Which is already a huge improvement imho.

Size adjustable

Problem

I am trying to use this as an alarm set on a small tablet near my bed but it is too small to really use. I am looking for ways to increase the box size. I have found ways to adjust the font by putting this in a custom button card but then the numbers run outside the boxes.

Suggested feature / solution

Can there be a setting to adjust the proportions of the elements.

Increase minute_step by 2 or 5 when holding down on chevron

Problem

No problem, other than being impatient and time

Suggested feature / solution

It would be nice to be able to hold the minute chevron down to increase the step value to 2 or 5 and it updates twice a second or something like that

Horizontal stack

Would like to be able to add multiple controls on the same card.

White border surrounding card when used in grid

Checklist:

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

The problem

There is a white border around the edge of the card when using it in a grid.

Environment

Running on Proxmox:

System Health

version core-2021.3.4
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.8.7
os_name Linux
os_version 5.4.99
arch x86_64
timezone Europe/London
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 4796
Installed Version 1.11.3
Stage running
Available Repositories 776
Installed Repositories 29
Home Assistant Cloud
logged_in true
subscription_expiration 28 April 2021, 1:00
relayer_connected true
remote_enabled true
remote_connected true
alexa_enabled true
google_enabled true
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 5.12
update_channel stable
supervisor_version supervisor-2021.03.6
docker_version 19.03.13
disk_total 62.3 GB
disk_used 12.7 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons Samba share (9.3.1), deCONZ (6.8.0), Terminal & SSH (9.1.0), Node-RED (8.2.0), File editor (5.2.0), Hass.io Google Drive Backup (0.52), Almond (1.1.2), AirCast (3.0.0)
Lovelace
dashboards 4
resources 18
views 17
mode storage
Spotify
api_endpoint_reachable ok
  • time-picker-card release with the issue:
  • Last working time-picker-card release (if known):
  • Browser and Operating System:

Problem-relevant configuration

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


Screenshot 2021-03-29 at 16 51 51

Delay setting

Hello,
I'm missing Delay feature, which would be great to avoid unnecessary entity changes. For example, I have to change hour and then minutes, every time I click the entity changes. I'm using also numberbox-card and the feature is there and plays really nice.

More compact look when embedded

This is not a problem.
I wanted to share with you what I did to make it more compact looking when it is embedded.
I know you already did something but I came with a look that is pleasing me using card-mod.
Unfortunately, it is not that easy for me to propose that change myself in the code and would prefer you, if you like it, to include it in a release.

Suggested feature / solution

image

How it is made using card-mod:

            card_mod:
              style:
                .: |
                  ha-card {
                    margin: -20px -4px -38px 0px;
                  }
                .time-picker-row:
                  .time-picker-content:
                    time-unit:
                      $: |
                        .time-unit {
                          padding: 5px !important;
                        }
                        .time-input {
                          border: 1px solid var(--switch-checked-button-color) !important;
                          height: 5px;
                          background-color: rgba(0,0,0,0) !important;
                          color: var(--primary-text-color) !important;
                          border-radius: 7px;
                          margin: -12px;
                        }     
                        .time-picker-icon {
                          color: var(--switch-checked-button-color) !important;
                        }

Add tap action when embedded in entities

I'd like to be able to use the

double_tap_action:
  action: ...

And also, tap_action as well as hold_action when the card is embedded (but not only?) in an entities card like so:

type: entities
entities:
  - type: custom:time-picker-card
    entity: input_datetime.shower
    name: Time to shower, kids
    hour_mode: 24
    link_values: true
    layout:
      name: inside
      align_controls: right
      embedded: true
    double_tap_action:
      action: call-service
      service: automation.trigger
      data:
        entity_id: automation.time_to_shower

This to be able to trigger my linked automation on demand.

Maintain left and right padding when embedded

Hi, I'm wanting to use embedded: true to reduce the vertical padding between multiple instances of the card however when enabled the left and right padding is also lost making the start of the card misaligned with other cards in the view:
image
I had a look at the code and tried adding padding values to:

      .time-picker-row.embedded {
        padding: 0px 16px 16px;
      }

but that made no difference. My JS knowledge is very limited but if you could point me to what I need to tweak I'll adjust it myself.

EDIT: looks like it was just my browser cache misbehaving. This change is doing as I wanted.

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.