UI-Lovelace-Minimalist / UI

UI-Lovelace-Minimalist is a "theme" for HomeAssistant
https://ui-lovelace-minimalist.github.io/UI/
Other
1.61k stars 430 forks source link

State not showing on input_number and input_datetime cards #1428

Open MrAJB opened 8 months ago

MrAJB commented 8 months ago

Describe the bug The current state of both input_number and datetime are not showing on the cards. The controls (i.e., increasing or decreasing the values) work fine, it just doesn't show. Furthermore, everything in the UI seems fine. Also, everything is updated to the newest version. I tried reloading the UI, restarting HA, clearing cache, doesn't resolve the issue. Anyone has any idea how to solve this?

Screenshots image

Related Card Config

### ATTIC THERMOSTAT SETTINGS ###
- type: "custom:button-card"
  template: card_title
  name: "Attic Thermostat Settings"
- type: "custom:button-card"
  template: card_input_datetime
  entity: input_datetime.attic_comfort_on
  variables:
    ulm_card_input_datetime_name: "Attic Comfort Temperature - On"
- type: "custom:button-card"
  template: card_input_datetime
  entity: input_datetime.attic_comfort_off
  variables:
    ulm_card_input_datetime_name: "Attic Comfort Temperature - Off"
- type: "custom:button-card"
  template: card_input_number
  entity: input_number.attic_comfort_temp
  variables:
    ulm_card_input_number_name: "Attic Comfort Temperature"
- type: "custom:button-card"
  template: card_input_number
  entity: input_number.attic_eco_temp
  variables:
    ulm_card_input_number_name: "Attic Eco Temperature"
Bastiencc commented 8 months ago

I have the same error

GleDel commented 7 months ago

Same issue for me.

CountOlaf87 commented 7 months ago

Same issue here

Bastiencc commented 7 months ago

some news?

MrAJB commented 7 months ago

Unfortunately not. The bug is still persistent on my end and I have no clue how to solve this. I'm hoping for someone more knowledgeable to help us out!

tv4you2016 commented 7 months ago

I'm also having the same problem

retogobat commented 7 months ago

Same here...

MrAJB commented 6 months ago

@basbruss would you mind taking a quick look at this? Apparently there are quite some people with the issue, I hope we can get this resolved!

Bastiencc commented 6 months ago

😰

Bastiencc commented 1 month ago

some news ?

MrAJB commented 1 month ago

Well, yes an no. No in the sense that there's no news from anyone working on Minimalist UI. Yes in the sense that I tried something myself which works OK'ish for both cards. I made a new custom card which is basically the same but retrieves the value in a different way. See below, I've added comments to clarify which changes I made compared to the original code. The layout of the card is not perfect, but as I only use it for some settings it's OK to me. I'm no pro, but I just needed something to work, which this does up until now...

Input Date

---
card_datetime_aj:
  show_name: false
  show_icon: false
  # START EDIT: THESE VARIABLES WERE ADDED
  variables:
    ulm_card_input_datetime_name: "[[[ return entity.attributes.friendly_name ]]]"
    ulm_card_input_datetime_value: "[[[ return entity.attributes.state ]]]"
  # END EDIT
  triggers_update: "all"
  styles:
    grid:
      - grid-template-areas: "'item1' 'item2'"
      - grid-template-columns: "1fr"
      - grid-template-rows: "min-content  min-content"
      - row-gap: "12px"
    card:
      - border-radius: "var(--border-radius)"
      - box-shadow: "var(--box-shadow)"
      - padding: "12px"
  custom_fields:
    item1:
      card:
        type: "custom:button-card"
        template:
          - "icon_info"
          - "ulm_translation_engine"
          - "input_datetime"
        tap_action:
          action: "more-info"
        entity: "[[[ return entity.entity_id ]]]"
        name: "[[[ return variables.ulm_card_input_datetime_name ]]]"
    item2:
      card:
        type: "custom:button-card"
        template: "list_3_items"
        custom_fields:
          item1:
            card:
              type: "custom:button-card"
              template: "widget_icon"
              tap_action:
                action: "call-service"
                service: "input_datetime.set_datetime"
                service_data:
                  entity_id: "[[[ return entity.entity_id ]]]"
                  time: >
                    [[[
                      var timestamp = entity.attributes.timestamp

                      let unix_timestamp = timestamp - 4500;
                      // Create a new JavaScript Date object based on the timestamp
                      // multiplied by 1000 so that the argument is in milliseconds, not seconds.
                      var date = new Date(unix_timestamp * 1000);
                      // Hours part from the timestamp
                      var hours = date.getHours();
                      // Minutes part from the timestamp
                      var minutes = "0" + date.getMinutes();
                      // Seconds part from the timestamp
                      var seconds = "0" + date.getSeconds();

                      // Will display time in 10:30:23 format
                      var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);

                      return formattedTime;
                    ]]]
              icon: "mdi:arrow-down"
          item2:
            # START EDIT: THIS ITEM IS CHANGED TO FIX THE VALUE NOT SHOWING UP
            card:
              type: "custom:button-card"
              entity: "[[[ return entity.entity_id ]]]"
              name: >
                [[[
                  var timestamp = entity.attributes.timestamp

                  let unix_timestamp = timestamp - 3600;
                  // Create a new JavaScript Date object based on the timestamp
                  // multiplied by 1000 so that the argument is in milliseconds, not seconds.
                  var date = new Date(unix_timestamp * 1000);
                  // Hours part from the timestamp
                  var hours = date.getHours();
                  // Minutes part from the timestamp
                  var minutes = "0" + date.getMinutes();
                  // Seconds part from the timestamp
                  var seconds = "0" + date.getSeconds();

                  // Will display time in 10:30:23 format
                  var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);

                  return formattedTime;
                ]]]
              show_icon: false
              show_label: false
              hold_action:
                action: "more-info"
                entity: "[[[ return entity.entity_id ]]]"
                name: "[[[ return variables.ulm_card_input_datetime_name ]]]"
              # END EDIT
          item3:
            card:
              type: "custom:button-card"
              template: "widget_icon"
              tap_action:
                action: "call-service"
                service: "input_datetime.set_datetime"
                service_data:
                  entity_id: "[[[ return entity.entity_id ]]]"
                  time: >
                    [[[
                      var timestamp = entity.attributes.timestamp

                      let unix_timestamp = timestamp - 2700;
                      var date = new Date(unix_timestamp * 1000);
                      var hours = date.getHours();
                      var minutes = "0" + date.getMinutes();
                      var seconds = "0" + date.getSeconds();
                      var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);

                      return formattedTime;
                    ]]]
              icon: "mdi:arrow-up"

input_datetime:
  tap_action:
    action: "more-info"
  show_last_changed: true

widget_text:
  tap_action:
    action: "toggle"
  template:
    - "ulm_translation_engine"
  show_icon: false
  show_label: true
  show_name: false
  label: "[[[ return variables.ulm_translation_state_unit ]]]"
  styles:
    grid:
      - grid-template-areas: "'l'"
    card:
      - box-shadow: "none"
      - padding: "0px"
      - background-color: "rgba(var(--color-theme),0.05)"
      - border-radius: "14px"
      - place-self: "center"
      - height: "42px"
    state:
      - color: "rgba(var(--color-theme),0.9)"
  size: "20px"
  color: "var(--google-grey)"

Input Number

---
card_number_aj:
  # START EDIT: THIS TEMPLATE WAS ADDED
  template:
    - "ulm_translation_engine"
  # END EDIT
  variables:
    ulm_card_input_number_name: "[[[ return entity.attributes.friendly_name ]]]"
  triggers_update: "all"
  show_icon: false
  show_label: false
  show_name: false
  styles:
    grid:
      - grid-template-areas: "'item1' 'item2'"
      - grid-template-columns: "1fr"
      - grid-template-rows: "min-content  min-content"
      - row-gap: "12px"
    card:
      - border-radius: "var(--border-radius)"
      - box-shadow: "var(--box-shadow)"
      - padding: "12px"
  custom_fields:
    item1:
      card:
        type: "custom:button-card"
        template:
          - "icon_info"
          - "ulm_translation_engine"
          - "input_number"
        tap_action:
          action: "more-info"
        entity: "[[[ return entity.entity_id ]]]"
        name: "[[[ return variables.ulm_card_input_number_name ]]]"
    item2:
      card:
        type: "custom:button-card"
        template: "list_3_items"
        custom_fields:
          item1:
            card:
              type: "custom:button-card"
              template: "widget_icon"
              tap_action:
                action: "call-service"
                service: |
                  [[[
                    if( entity.entity_id.startsWith("input_number.") )
                      return "input_number.decrement";
                    if( entity.entity_id.startsWith("counter.") )
                      return "counter.decrement";
                    return "";
                  ]]]
                service_data:
                  entity_id: "[[[ return entity.entity_id ]]]"
              icon: "mdi:arrow-down"
          item2:
            # START EDIT: THIS ITEM IS CHANGED TO FIX THE VALUE NOT SHOWING UP
            card:
              type: "custom:button-card"
              entity: "[[[ return entity.entity_id ]]]"
              name: "[[[ return variables.ulm_translation_state ]]]"
              show_icon: false
              show_label: false
              tap_action:
                action: "call-service"
                service: "cover.stop_cover"
                service_data:
                  entity_id: "[[[ return entity.entity_id ]]]"
            # END EDIT
          item3:
            card:
              type: "custom:button-card"
              template: "widget_icon"
              tap_action:
                action: "call-service"
                service: |
                  [[[
                    if( entity.entity_id.startsWith("input_number.") )
                      return "input_number.increment";
                    if( entity.entity_id.startsWith("counter.") )
                      return "counter.increment";
                    return "";
                  ]]]
                service_data:
                  entity_id: "[[[ return entity.entity_id ]]]"
              icon: "mdi:arrow-up"

input_number:
  tap_action:
    action: "more-info"
  show_last_changed: true

widget_text:
  tap_action:
    action: "toggle"
  template:
    - "ulm_translation_engine"
  show_icon: false
  show_label: true
  show_name: false
  label: "[[[ return variables.ulm_translation_state ]]]"
  styles:
    grid:
      - grid-template-areas: "'l'"
    card:
      - box-shadow: "none"
      - padding: "0px"
      - border-radius: "14px"
      - place-self: "center"
      - height: "42px"
    state:
      - color: "rgba(var(--color-theme),0.9)"
  size: "20px"
  color: "var(--google-grey)"
Bastiencc commented 1 month ago

thanks @MrAJB , that's perfect ! Have a nice day