vche/appdaemon_weatherentity

Dark Sky rendering failure

Closed this issue · 3 comments

Hi! Thanks for the widget, really useful.
But I found that it fails to render if forecast.precipitation is null:

image

The fix is simple, something like this:

if (self.parameters.forecast_precip_unit == "%") { precip = forecast.precipitation_probability.toFixed(0); }
else { precip = forecast.precipitation ? forecast.precipitation.toFixed(1) : 0; }

Also is it possible to add some configuration for date formatting? As I can see it uses US style (M/D), but I'd like something like 'DD MMM'.

vche commented

Hey, sorry i somehow totally missed this issue. I appreciate your input, I will spend some time as soon as i can to fix this !

vche commented

Fixed the issue with null precipitations and added a custom format configuration as follow.
DD and MM are replaced witht the date and time. Defaults to the US model

weather:
  title: Now
  widget_type: weatherentity
  entity: weather.openweathermap
  show_forecast: 4
  forecast_daily: 1
  forecast_date_format: "DD/MM"

With non padded or non padded dates can be specified, e.g. D/MM, DD MM, D,M are all valid examples

vche commented

and my apologies for being so slow it kinda slipped my mind