From 4e6d174fe1fce831ff03893542defd92747a5ae6 Mon Sep 17 00:00:00 2001 From: dapuzz <45406499+dapuzz@users.noreply.github.com> Date: Tue, 7 Apr 2020 10:37:52 +0200 Subject: [PATCH] Update item_activity_history_line.yaml undefined zone total time --- .../includes_garden/item_activity_history_line.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lovelace/includes_garden/item_activity_history_line.yaml b/lovelace/includes_garden/item_activity_history_line.yaml index 21266fe..bac5a31 100644 --- a/lovelace/includes_garden/item_activity_history_line.yaml +++ b/lovelace/includes_garden/item_activity_history_line.yaml @@ -45,15 +45,17 @@ custom_fields: [[[ var zone = '{{ zone }}'; var time = states['sensor.irrigation_' + zone + '_total_time_yesterday'].attributes.value; - time = time.replace("h", "hrs "); - time = time.replace("m", " min"); - return time; + if(time){ + time = time.replace("h", "hrs "); + time = time.replace("m", " min"); + return time; } ]]] total_today: > [[[ var zone = '{{ zone }}'; var time = states['sensor.irrigation_' + zone + '_total_time_today'].attributes.value; + if(time){ time = time.replace("h", "hrs "); time = time.replace("m", " min"); - return time; + return time; } ]]]