phrz / lg-washer-dryer-card

Lovelace cards for use with the Home Assistant LG ThinQ Integration
MIT License
260 stars 52 forks source link

Feature request: Display hh:mm only for time remain #22

Closed raymondsfk closed 1 year ago

raymondsfk commented 1 year ago

Hi, thanks for the awesome integration. I had a LG washer F2515RTGV which will output 'hh:mm:ss'. Is there away to remove the display of 'ss' ?

LG

iwhosts commented 1 year ago

Hi, 1 line needs to be replaced in configuration.yaml

original: {{ state_attr('sensor.washer', 'remain_time') }}

replace it with this: {{ as_timestamp(strptime(state_attr('sensor.washer', 'remain_time'), '%H:%M:%S')) | timestamp_custom('%-H:%M') }}

raymondsfk commented 1 year ago

Hi, 1 line needs to be replaced in configuration.yaml

original: {{ state_attr('sensor.washer', 'remain_time') }}

replace it with this: {{ as_timestamp(strptime(state_attr('sensor.washer', 'remain_time'), '%H:%M:%S')) | timestamp_custom('%-H:%M') }}

Thank you so much, it works like magic!

petrklic16 commented 1 year ago

Hi, i have same problem with time :-(

image

My card show time with seconds... I've tried change configuration.yaml but time is still with seconds... Can you help me?

image

image

raymondsfk commented 1 year ago

Hi, attached is my working code, hope it will work for you too,

LG Washer

petrklic16 commented 1 year ago

Still not working :-( I love this LG card, but time covers another icons... configuration.zip This is my configuration.yaml - Now HA show error in log...

image

It's this entity image

petrklic16 commented 1 year ago

This is my config with modified time display without seconds... but still not working configuration.zip

image

But wit hthis config i dont have any error in log.

FS1961 commented 1 year ago

Hi - is there anyway to use "-:--:--" as the time remaining after the system is off? I would appreciate it this could be possible instead of just leaving it with 0 time remaining.

Awesome integration btw - absolutely love it!

phrz commented 1 year ago

@raymondsfk I'm glad you got it working in the end. I apologize for my delay, I've been quite busy and behind on my inbox.

@petrklic16 The reason your configuration does not work is because, according to the configuration.zip in this comment, you tried to access the remaining_time attribute of your sensor.pracka. There is no remaining_time attribute, only remain_time. But the error message in the screenshot shows that you tried to access the remain_time attribute of sensor.washer, and of course you don't have a sensor.washer, so you needed to rename it to sensor.pracka. I'm guessing the error message is from before you restarted Home Assistant, so it was running an old configuration.

My best advice to you is to take the template code {{ like this }} and go to /developer-tools/template in your Home Assistant (if you don't have this, click on your name in the bottom left and turn on Advanced Mode). Tweak it until it works. Then put it in your configuration.yaml and make sure to Restart Home Assistant.

The short answer: make sure you are accessing the remain_time attribute of sensor.pracka, in your case, or else it won't work.

@FS1961: the reason your card is showing zeroes instead of going blank is because your machine is showing a different value than my machine when it's done. The code in this project's configuration that you need to change is {% if is_state('sensor.washer_run_state', '-') %}. This is because when my washer/dryer are done, they show a dash in the run_state entity. You need to check what your device shows when it's not running, and test for that value in these if statements throughout the configuration. Because I don't know what your particular device shows, I won't be able to tell you what to put in there.