Anybody want to test this for me?

Short version:

I’m testing a couple of ideas and was wondering if anybody else would like to test them for me or use them themselves…

(1) I’m using weather data to predict whether it’s dark outside and whether the lights need to come on in the house to try and make it more accurate than just using sunrise.

(2) I’m using weather data to predict whether I need to get moving a bit earlier in the morning because my journey may be delayed due to snow, frost or heavy rain.

It’s been really accurate for me so far, but I have no idea how it will work for different locations, different tastes etc, and I’d love to see how it works for others.

I’ve chucked together a quick package you can use to test it for me and give me feedback. Just basically copy the file as a ‘package’ in to your config and it will place a card on your default view with the two sensors and a notification time. It’s all explained in the comments at the top of the file, give it a go and let me know!

link removed

(Note - I know it’s a pain that I’ve used 6 automations instead of templating 2, it just made it quicker for me to spin through the log book and see which alert I got on which day for testing purposes!)

Longer version:

I’ve had an idea for a while (that I keep putting on the back burner) of a more ‘advanced’ cookbook where we could put some pre-written packages with instructions on how to adapt them to your configuration. @Bob_NL 's Chromecast radio is a great example, along with some of the alarm clocks people have come up with, and people could add nifty tricks to them.

For example -

  • Your alarm clock could use the dark sensor to decide whether or not to switch the lights on when the alarm time is reached.
  • Your alarm clock could check 15 minutes before the alarm time if the bad weather sensor is anything other than ‘clear’, and trigger the alarm early so you can scrape the car, or whatever.

And then there’s other things like ‘Mockupancy’ routines and google music players. There’s some pretty sophisticated stuff out there on people’s Githubs that I’ve used or adapted in my configuration (or intend to in the near future), which we could neatly package together so that people don’t have to search much once they get past the ‘basic’ cookbook stuff. Sometimes going through somebody’s repo working out which sensor triggers which automation, which triggers which script, which has what effect can mean trawling through 7 or 8 files and still not having a clue, but people could group it together in a single package file with a few instructions and some people could have a really slick system running in no time.

So, basically, this thread is to test whether people find the sensors useful, and also a bit of a social experiment on how easy it is for people to grab a pre-configured package with some (hopefully) simple instructions and get it up and running.

Let me know your thoughts!


Just set it up and got a template error:

2017-12-10 17:32:21 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.template]: expected a dictionary for dictionary value @ data['sensors']['friendly_name']. Got 'Bad weather'
expected a dictionary for dictionary value @ data['sensors']['test_bad_weather']. Got None
expected a dictionary for dictionary value @ data['sensors']['value_template']. Got '{% if (states.sensor.dark_sky_precip.state == "snow") %}snow {% elif ((states.sensor.dark_sky_daily_low_temperature.state | int < 4) and (states.sensor.dark_sky_dew_point.state | int < 6) and (states.sensor.dark_sky_wind_speed.state | int < 12) and (states.sensor.dark_sky_cloud_coverage.state | int < 20) and (states.sensor.dark_sky_humidity.state | int > 50)) %} frost {% elif (states.sensor.dark_sky_precip_intensity | int > 7) %} heavy_rain {% else %} clear {% endif %}\n'. (See ?, line ?). Please check the docs at


Copy and paste didn’t format that one properly, just merging the corrected version now, give it 5 minutes and try again :blush:

Cheers :+1:

Think i’m also missing the dew point sensor.

Yeah, obviously you’ll need the correct monitored conditions, mine is this (obvs you don’t need all of them for this package):

- platform: darksky
  api_key: !secret darksky_api_key
  units: auto
    minutes: 60
    - summary
    - precip_type
    - precip_intensity
    - precip_probability
    - temperature
    - apparent_temperature
    - dew_point
    - wind_speed
    - wind_bearing
    - cloud_cover
    - humidity
    - pressure
    - visibility
    - ozone
    - minutely_summary
    - hourly_summary
    - daily_summary
    - temperature_max
    - temperature_min
    - apparent_temperature_max
    - apparent_temperature_min
    - precip_intensity_max

Should be error free now :smile:

Yes, good now, I just added the sensor, and formated the template.

According to:
You will receive notifications as follows:

  • everytime the light sensor thinks it is dark outside, and therefore
    would switch the lights on if used as the trigger.
  • everytime the light sensor thinks it is light outside, and therefore
    would switch the lights off if used as the trigger.
  • at the time you set reporting ‘snow’, ‘frost’, ‘heavy_rain’ or ‘clear’

I should get a notification if:
dark outside = true?
light outside = true?
condition = snow, rain, frost or clear?

Yeah, it will notify you every time it would have put the lights on or off if it was used as the trigger for a lighting automation.

Then at whatever time you specify you’ll get a notifcation saying ‘clear’, ‘snow’, ‘frost’ or ‘heavy_rain’.

(Heavy rain is based on the Met office definition, so like potential for localised flooding not just a bit of a drizzle).

Okay, seems to be working, got notification for set time.

Not using as triggers at the moment.

Yeah, wait and see how accurate it is for you first :smile:

Thank you very much for the packages. Easy to understand and install. Very useful.

1 Like

Interesting. I’ll give this a shot when I get home. I really like the idea of a package cookbook type thing.

1 Like

Thanks guys, let me know how you get on!

Installed fine… everything appears to be working. Card says “clear” and it is lightly raining outside, so definitely not heavy rain.

1 Like

Yeah, the idea is basically if it’s something that might delay your journey to work, so if it’s ‘just’ rain it will still show clear, but if it’s bucketing it down and there’s a chance of localised flooding it will warn you with heavy_rain.

Like the frost warning might not pick up a random thinly spread icy windscreen, but will (or has so far!) warn you if it’s going to need a good scrape and the roads might be a bit slippy.

Obviously it can be fine-tuned to people’s taste, but it seems pretty accurate for my needs.

Let me know how it goes :slight_smile:

Finally got my first Weather Warning… works a treat!

Hello. I need some help for the sensor.weather_bad_weather, as I live in Asia there is no snow here.
And what the int in the value_template mean? I would like the weather to inform me about rain

    friendly_name: 'Bad weather'
    value_template: >
      {% if (states.sensor.dark_sky_precip.state == "snow") %}snow  <== rain
      {% elif ((states.sensor.dark_sky_daily_low_temperature.state | int < 4) and (states.sensor.dark_sky_dew_point.state | int < 6) and (states.sensor.dark_sky_wind_speed.state | int < 12) and (states.sensor.dark_sky_cloud_coverage.state | int < 20) and (states.sensor.dark_sky_humidity.state | int > 50)) %} frost  <== hot
      {% elif (states.sensor.dark_sky_precip_intensity | int > 7) %} heavy_rain
      {% else %} clear
      {% endif %}


How heavy rain do you want it to warn you on?

The ‘int’ just converts the reading from the darksky sensor in to a number so we can see if it is higher or lower than 7. If you don’t need the snow bit, and the heavy_rain setting is too high, try something like…

    friendly_name: 'Bad weather'
    value_template: >
      {% if ((states.sensor.dark_sky_daily_low_temperature.state | int < 4) and (states.sensor.dark_sky_dew_point.state | int < 6) and (states.sensor.dark_sky_wind_speed.state | int < 12) and (states.sensor.dark_sky_cloud_coverage.state | int < 20) and (states.sensor.dark_sky_humidity.state | int > 50)) %} frost  <== hot
      {% elif (states.sensor.dark_sky_precip_intensity | int > 3) %} heavy_rain
      {% else %} clear
      {% endif %}
1 Like

Thank you very much. I will try to change.