Tagged "automation"

HomeAssistant Yellow Review

For Christmas as a gift to myself I bought a HomeAssistant Yellow. If you’re not familiar with HomeAssistant - it’s a one-stop-shop to control all your smart lights, plugs, sensors and anything else in your smart home. HomeAssistant is the software part and as it’s open source you can freely install it on any computer you have. In fact many people install HomeAssistant on a Raspberry Pi.

HomeAssistant Yellow is their own custom hardware with a built in chip for Zigbee (and now Threads) protocol, along with Bluetooth, WiFi and audio out. It takes a Raspberry Pi compute module 4 as its “brains”. This technically means it should - emphasis on should be upgradeable if a Raspberry Pi compute module 5 that is compatible with CM4 socket is produced.

Convert Bank Transactions XLS to CSV in Python

I’ve written previously on importing transactions to hledger/ledger from KBC bank in JavaScript and PTSB bank in Python. I took different approaches to each:

  • For KBC, you needed to log in and run Javascript which scrape the transaction table and download it formatted as CSV
  • For PTSB, the script automatted logging in, get the transaction table and save locally as CSV

Both approaches are valid - but suffer from the same issues: any change the bank makes to it website needs to be updated in the code. The KBC/JavaScript approach was a bit more robust in that it would just search for rows on a website and download as CSV.

Scraping Transaction Data from KBC Bank

In a previous post, I mentioned importing transactions using ledger/hledger and plain text accounting. As my former bank PTSB recently raised their fees, I decided to move to KBC. I was excited to see, as part of the open payments directive, they have a nice developer portal. I reached out to KBC’s dev team, but alas they are only accepting registered companies, who meet stringent criteria. They told me they hope to open it up soon to end users, I live in hope!

Scraping Data from your Bank in Python

As part of my previous posts, I talked about ledger and plain text accounting. The only part missing is that you need a method to import transactions from your bank. For this I have been doing this by hand, bi-weekly. I would have to do the following:

  1. Log in to online banking
  2. Go to the transactions page
  3. Select the date range for transactions I needed (double check last date of transaction in ledger at this point)
  4. Download the Microsoft Excel format file that wasn’t in the proper format
  5. Convert this Excel file into a CSV file that matched my import format (watch the dates, is it YYYY-MM-DD or DD/MM/YYYY?)
  6. Finally import the CSV file into ledger
  7. Check the balance matches between my online banking and ledger

Sounds like a lot of work right?

Slack Bots for Work

In a previous post, I mentioned how I get notified of the restaurant menu via a Ruby script. Recently I’ve moved to a totally different product area and the main communication channel we use is Slack. Naturally enough, I ported the Ruby code I wrote, and it now posts the menu every day to our Slack channel.

This also got me thinking of what other information would be handy to have. I scouted around for ideas and came up with an obvious one: reminder of the bus times to and from the office. So here’s my bus times notification slack bot:

Automatic Newsletter Cleanup in Gmail

If you haven’t tried Google Apps Script, I found a really nifty use for it: smart filtering for email. Wait, shouldn’t I just use Gmails’ built-in filters? As it turns out you can’t - my filter needs to act on email that matched that filter in the past. So in other words: a filter can only act on email it actually “filters”, which kinda makes sense! I’m a big fan of automation (and email is ripe for automation), as you can see from my post on meetings in Outlook.

Fill hours worked in SAP Netweaver Automatically

Continuing the theme of automation, one of the most repetitive tasks if you work for a big company is timesheets. So I set out to rectify this by scripting it!

Start with you configuration, I named mine hours.ini:

[DEFAULT]
url = FILL_ME_IN
username = FILL_ME_IN
password = FILL_ME_IN

then we need the magic of Selenium to do the heavy lifting, so we install it:

$ pip3 install selenium

I called this script, unsurprisingly hours.py:

Automated 'Push' Restaurant menu

I love trying to automate the world, it just feels like magic some of the time! I also really enjoy information coming to me, instead of having to seek it. As we are still only in 2016, we have no world killing Artificial Intelligence (yet). So we have to start small, ease the first world problems! So I decided to make my workplaces’ restaurant menu come to me!

I decided to write it in Ruby and use push notifications, rather than email or SMS. It uses a web automation framework called Selenium, which is available in many languages, including Javascript, Python, Java and obviously Ruby!