Turin is a great city and I’m enjoying it.
The only problem is that I use public transport for almost anything.
Finding out that there’s an unexpected public transports strike is always a pain.

I had to solve this problem.

Since I’m working on my Smart Home project, I decided to include “strike data” into it so when I wake-up in the morning and I look at my Wall Mounted Controller I’ll get to know the status of the service, I’ll never get a nasty surprise.

The Route

Public transportation in Turin is mainly managed by GTT (Gruppo Torinese Trasporti) and they’ve a nice page where they publish line changes, news and strikes.
They also offer an RSS feed of this page here.

Now we need to decide how to get the data to our Home Assistant instance.
I decided to take the IFTTT way.

If you don’t know IFTTT, well, IFTTT is a easy and free web-service you can use to create chains of conditional statements called applets.

Today we’ll use two IFTTT services:

The first one will read the RSS feed, the second one will post the data to our Home Assistant instance.

Setup

You should be registered to IFTTT to continue

  1. Open ifttt.com and login to your account;
  2. Click on your account name on the top right and choose “New Applet”;
  3. Click on the “this” button;

Imgur

  1. Click the “RSS Feed” tile;
  2. Click the “New feed item matches” tile;
  3. Set the keyword to the one used by your public transit company (in my case I use: “sciopero”);
  4. Set the Feed URL to the one your company publishes the info on;
  5. Click on “Create trigger”;
  6. Click on the “that” link;
  7. Click on the “Webhooks” tile;
  8. Click on the “Make a web request” tile;
  9. Set the URL to your Home Assistant API endpoint:
    http://<YOUR HOMEASSISTANT IP>:8123/api/states/sensor.<YOUR SENSOR NAME>?api_password=<YOUR HOMEASSISTANT PASSWORD>
    
  10. Set the method to “POST”;
  11. Set the Content Type to “application/json”;
  12. Set the body to:
    {
      "state": "{{EntryTitle}}",
      "attributes": {
        "friendly_name": "<YOUR SENSOR FRIENDLY NAME>",
        "icon": "mdi:bus"
      }
    }
    
  13. Click the “Create action” button;
  14. You’re ready to go!

The next time your public transportation company posts a strike notice you’ll get the info in your Home Assistant instance.



As you can see IFTTT blends perfectly with Home Assistant.

These two platforms can bring us endless possibilities.

You can check my Home Assistant configuration files here.


Let me know what you think of this project and this article using the comments below or by hitting me up on Twitter.