Automate Your Morning: Building a Weather-Based Clothing Recommendation in Huginn

Introduction

In the previous post we set up Huginn in Docker, giving you your own self-hosted automation platform. Now it’s time to do something fun with it! In this guide, we’ll walk through creating a Huginn Scenario that checks the daily weather forecast and tells you what to wear when heading outside.  Scenarios are containers of agents, and have properties that we will make use of in future posts.

This scenario will:

  • Use a weather API to get your local forecast

  • Analyze temperature and conditions

  • Recommend clothing (e.g., "wear a jacket" or "shorts are fine today")

  • Send you the advice by email or another notification agent

Let’s get started!


Step 1: Create a New Scenario

In Huginn, a Scenario is a collection of agents that work together. After logging into your Huginn dashboard:

  1. Click Scenarios on the top nav bar

  2. Click New Scenario

  3. Choose an appropriate icon, such as the cloud
  4. Name it something like Weather Outfit Advisor

  5. (Optional) Add a description

Leave it empty for now—we'll add agents in the next steps.


Step 2: Set Up the Weather Agent

You’ll need an API that provides weather forecasts. OpenWeatherMap is a good free option:

  1. Go to openweathermap.org/api and sign up

  2. Choose the Current Weather or One Call API and get your API key

Now create a new Website Agent (yes, it's called website, even if we are connecting to an API):

  1. From inside the scenario, Click New Agent

  2. Choose Website Agent

  3. Name it Daily Weather Fetcher

  4. Set the url parameter to:

    "https://api.openweathermap.org/data/2.5/weather?lat=47.96&lon=-122.50&units=imperial&appid={% credential open_weathermap %}"
  5. Set the type to "json"

  6. Set the extract to:

    {
      "weaather": {
          "path": ".",
        }
    }
    
  7. Set the schedule to every_1h or every_day_at_7am

  8. Set Keep Events to 1 day

  9. Save it, and it will be added to your Weather Outfit Advisor scenario


Step 3: Process the Weather Data

Now let’s add a TriggerAgent to interpret the forecast and decide what to wear.

  1. Create a new agent, choose TriggerAgent

  2. Name it Clothing Recommender

  3. In the options, use something like:

{
  "expected_receive_period_in_days": "1",
  "keep_event": "true",
  "rules": [
    {
      "type": "field>=value",
      "value": "20",
      "path": "main.temp",
      "message": "It's warm today ({{main.temp}} °C). T-shirt and shorts should be fine."
    },
    {
      "type": "field<value",
      "value": "10",
      "path": "main.temp",
      "message": "It's chilly ({{main.temp}} °C). Consider a jacket and long pants."
    },
    {
      "type": "field<value",
      "value": "0",
      "path": "main.temp",
      "message": "Freezing today ({{main.temp}} °C)! Bundle up!"
    }
  ]
}
  1. Save and connect it to the output of your weather fetcher

  2. Add this agent to your scenario


Step 4: Send Yourself a Notification

Finally, create a EmailAgent or a SlackAgent, depending on your preference.

For EmailAgent:

  1. Create a new agent, choose EmailAgent

  2. Name it Outfit Email Notifier

  3. Example options:

{
  "expected_receive_period_in_days": "1",
  "subject": "Today's Weather Advice",
  "body": "{{message}}",
  "recipients": ["your@email.com"]
}
  1. Connect it to the Clothing Recommender agent

  2. Add it to the scenario


Step 5: Test and Tweak

  • Use Dry Run or Manual Event to test the weather agent

  • Watch the data flow in real-time between agents

  • Adjust the thresholds to suit your local climate or preferences


Conclusion

Congrats! You've just built a Huginn Scenario that checks the forecast and gives smart clothing suggestions. This is just the tip of the iceberg—try extending it with umbrella alerts for rain, sunscreen reminders on sunny days, or location-based triggers.

Stay tuned for more Huginn scenarios to make your day a little more automated and a lot more awesome!

Comments

Popular posts from this blog

Growth Industry next decade

Change for the sake of change