From 288e20f462786599dc5be50d325d1ef1eded00fc Mon Sep 17 00:00:00 2001 From: Stephen Ludgate Date: Fri, 5 Apr 2024 00:09:08 +0100 Subject: [PATCH] Corrections to time formats for new get_forecasts array variables. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c48944f..cbfb37a 100644 --- a/README.md +++ b/README.md @@ -43,15 +43,15 @@ A small 1.54" mini version, which shows the current weather, and the following h ### Time format Time format for the hourly conditions can be formatted using the python function `timestamp_custom()` for, e.g. 12h time - 2 PM, or e.g. 24h time - 14: -`{{ as_timestamp(weather_home_hourly.forecast[0].datetime) | timestamp_custom('%I %p') }}` = 02 PM -`{{ as_timestamp(weather_home_hourly.forecast[0].datetime) | timestamp_custom('%I') | int }} {{ as_timestamp(weather_home_hourly.forecast[0].datetime) | timestamp_custom('%p') }}` = 2 PM -`{{ as_timestamp(weather_home_hourly.forecast[0].datetime) | timestamp_custom('%H') }}` = 14 +`{{ as_timestamp(weather_home_hourly['weather.home']['forecast'][0].datetime) | timestamp_custom('%I %p') }}` = 02 PM +`{{ as_timestamp(weather_home_hourly['weather.home']['forecast'][0].datetime) | timestamp_custom('%I') | int }} {{ as_timestamp(weather_home_hourly.['weather.home']['forecast'][0].datetime) | timestamp_custom('%p') }}` = 2 PM +`{{ as_timestamp(weather_home_hourly['weather.home']['forecast'][0].datetime) | timestamp_custom('%H') }}` = 14 If you go with a 24h hour display (e.g. 14) - amend your automation yaml file `wm_time_0`, `wm_time_1`, `wm_time_2` and `wm_time_3` from `{{ state_attr('sensor.weatherman_data_tag','wm_time_0') | string | upper }}` to `{{ '%0.2d' | format(state_attr('sensor.weatherman_data_tag','wm_time_0') | int) | string | upper }}` or you will get erorrs as it tries to format a string as a deciaml ('%0.2d'). ### Day names To change the display of the day names to your prefered language, replace these occurences in the configuration with your own: -`{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(state_attr('weather.home', 'forecast')[0].datetime) | timestamp_custom('%w') | int]) }}` +`{{ "%s" % (["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][as_timestamp(weather_home_hourly['weather.home']['forecast'][0].datetime) | timestamp_custom('%w') | int]) }}` ### Precipitation accuracy I have removed the rounding for precipitation values (usually in mm). This will add a lot more 0.0, 0.1, 1.2 numbers on your screen. To tidy it up and just have round numbers, just add `| round` filter to any precipitation value in ha-configuration, e.g: