Light automation turn_on depending on weather

@pnbruckner thanks for trying to work that out for me. I’ve got DarkSky configured as a weather platform rather than a sensor and use a custom animated weather card to display the info. So there is only one entity_id: weather.dark_sky and all the info as attributes.

Also, the condition attribute is used as the state for the entity_id

And here is the JSON:

{
  "temperature": 20.5,
  "humidity": 100,
  "ozone": 287.7,
  "pressure": 1010.08,
  "wind_bearing": 207,
  "wind_speed": 9.22,
  "visibility": 10.117,
  "attribution": "Powered by Dark Sky",
  "forecast": [
    {
      "datetime": "2019-10-02T00:00:00",
      "temperature": 28.4,
      "templow": 17.4,
      "precipitation": 0.1,
      "wind_speed": 5.45,
      "wind_bearing": 192,
      "condition": "partlycloudy"
    },
    {
      "datetime": "2019-10-03T00:00:00",
      "temperature": 27.2,
      "templow": 17.9,
      "precipitation": null,
      "wind_speed": 9.17,
      "wind_bearing": 200,
      "condition": "sunny"
    },
    {
      "datetime": "2019-10-04T00:00:00",
      "temperature": 26.3,
      "templow": 15,
      "precipitation": 0.8,
      "wind_speed": 11.81,
      "wind_bearing": 186,
      "condition": "partlycloudy"
    },
    {
      "datetime": "2019-10-05T00:00:00",
      "temperature": 24.8,
      "templow": 15.3,
      "precipitation": 2.6,
      "wind_speed": 9.22,
      "wind_bearing": 277,
      "condition": "rainy"
    },
    {
      "datetime": "2019-10-06T00:00:00",
      "temperature": 24.6,
      "templow": 14.4,
      "precipitation": 0.1,
      "wind_speed": 9.77,
      "wind_bearing": 304,
      "condition": "sunny"
    },
    {
      "datetime": "2019-10-07T00:00:00",
      "temperature": 23.3,
      "templow": 14.1,
      "precipitation": 4.1,
      "wind_speed": 6.58,
      "wind_bearing": 60,
      "condition": "rainy"
    },
    {
      "datetime": "2019-10-08T00:00:00",
      "temperature": 19.5,
      "templow": 14.9,
      "precipitation": 17.4,
      "wind_speed": 9.14,
      "wind_bearing": 95,
      "condition": "rainy"
    },
    {
      "datetime": "2019-10-09T00:00:00",
      "temperature": 19,
      "templow": 15,
      "precipitation": 16.1,
      "wind_speed": 9.07,
      "wind_bearing": 78,
      "condition": "rainy"
    }
  ],
  "friendly_name": "Dark Sky"
}

I just don’t understand how to write templates like that myself