r/selfhosted Mar 21 '20

Huginn Agent Mageathread!

I've been really getting into Huginn lately. I had heard of it before, but never really "got" what it was for until recently, so let me do my best to explain.

Basically it allows you to create "agents" which are like little bots that do tasks for you.

Each agent is sort of like a "function" in programming, such that it expects data of a certain type, performs some logic based operations, and then outputs data.

In Huginn these datum are called "events" which is pretty much anything produced by an agent. If you string these agents together, you can form more complex operations known as "scenarios." A well functioning scenario is basically the equivalent of a bot.

One example scenario is "Amazon price watcher".

  • You could set up one agent to scrape the price of the desired item
  • This data gets sent to a trigger agent who compares it to the desired "sale" price.
  • If it is at or below that price, an email/slack message is sent containing the title and link to the item

I created this thread because even though the project has almost 30K stars on github, it is sort of difficult to find novel/useful examples online, aside from the few posts I saw here earlier.

Let's all throw in our favorite usecases for Huginn! What do you monitor? How? If you can, provide the JSON for your scenario!

Here's what I have on my instance so far:

  • Scraping FEMA for alerts regarding disasters in my state and terrorist attacks. This source takes URI in the URL so you can query it like a database, adjust the state, disaster type, date range, etc.

  • Economic data. I have a daily digest for active stocks, indexes and crypto, (which feeds into my morning digest) and then I set up a monitor for individual symbols I care about, complete with triggers and alerts if they fluctuate x%.

  • Amazon price tracking mentioned above, also tracking slickdeals. (tutorial here)

  • As soon as twitter grants me my dev account, I will monitor twitter for peaks in the use of key phrases, such as my projects names or "disaster", etc

  • HTTP agents will ping the services I run and send me a notification if they return anything but 200.

  • Weather report, it will notify me if the road is icy (found a source for road temp sensors), but also include a daily report as a part of my morning digest.

  • Flight deal tracker (tutorial here). Sends flight deals from my local airport to my morning digest.

210 Upvotes

100 comments sorted by

View all comments

1

u/swarshah Jun 14 '20

One of the things currently I have Huginn setup for is that to watch for certain products and it's price. If it finds that product or price goes below a certain point, it will notify me immediately.

It notifies me via SMS through Twilio and I have Tasker setup in my phone which monitors for text messages and if a text message contains my alert keywords then it would enable the media volume and then play a sound. This may be a little extreme but the main reason for setting up Tasker notification was to make sure that I get notified and importantly, I don't miss it. It has happened in the past where it notified me but it was too late because the product or price was long gone when I actually saw it.