Sharing from Mail.app to Obsidian

Over the last few months I’ve been trying to get more organised and take a proper look back at finding a productivity and note taking system that works for me. I’ve been through many different iterations over the years - sometimes it lasts for a while and other times it doesn’t. At the moment I’m trying to centralise on using Obsidian as the tool for all my notes.

There are many emails that I receive that I want to create notes based off of - this might be planning next steps for a project based on information I have been provided, or for more informational messages what my summary/highlights/takeaways are. The point of truth for the message will remain to be Mail, so as well as the contents I want a link back to the original message.

Unfortunately there is no share sheet or shortcuts functionality for Mail on that we can use to extract out mail message contents, so this is a MacOS only solution as it needs to use AppleScript. Even though this can only be created on MacOS, the Mail links which are embedded in the notes will also work on iOS/iPadOS.

Ultimately what I wanted to create is a new note in an “Inbox” directory in my Obsidian Vault with the title being something like <datetime> - subject line and the note containing something like the following:

> [!quote]
> Subject: Mail subject
> Sender: Mail sender
> Date received: Mail date received
> [Open in Mail.app](Mail deeplink)
> 
> ---
> 
> Mail body

» Continue reading


Publishing a Jekyll Site to GitHub Pages using GitHub actions

Ever since GitHub actions was announced I’ve a had a low priority item on my todo list to move my Jekyll blog build process to this over the native GitHub Pages setup. The key benefit to this has been that it allows you to use more modern versions of Jekyll as well as any custom plugins that you choose - instead of being limited to just the plugins and versions that GitHub supports.

Recently this has been becoming higher priority as I was having issues keeping an updated devcontainer that still worked with this old version of Jekyll without needing to use an image that was not optimised for Apple Silicon. This was probably a solvable issue, but changing the build process was too.

This used to be quite a custom process, requiring writing your own workflow using a number of third party actions. I was very pleased to see that it is now an off the shelf solution - so it took me less than 10 minutes to be switched over and on all the latest versions of Jekyll and plugins. I’ve not added anything new yet, but can already see the Paginate V2 plugin supports generating pages for individual tags & categories, something that I was doing manually with a rake script. At this point I am looking to reduce the amount of custom code in my blog and go a lot more stock - I’m even planning on taking another look at minima now that I’m on a recent version of Jekyll.


Adding HomeKit Devices to HomeAssistant

One of the first smart home devices I purchased was a Meross MSS425F power strip, which has 4 individually controllable sockets and a group of 4 USB ports that are controlled in a single block. At the time I had not yet discovered Home Assistant, and was using the Apple Home application to control my smart home.

This device was the last thing I did not have in Home Assistant and it was leaving my night time automation incomplete - so it was time to finally get it added in. There is a HomeKit Device integration, but I couldn’t see from the pre-requisites how to get this device discovered - although it is pretty easy. The basic steps I took were:

  1. With my iPhone on Wi-Fi network I wanted the device to join, add device to Home through the Meross app
  2. Remove the device from the Apple Home app
  3. Home assistant will now discover it. The Configure button will prompt for the HomeKit code on the bottom of the device

…and that is it. The first two steps were not immediately obvious from the Home Assistant documentation, but are probably required for most WiFi HomeKit devices.


Backing Up Docker Services

This week I had an issue where one of the Raspberry Pis that I use for self-hosting some services stopped working. It started with docker pull commands failing due to unknown paths that looked to be complete gobbledegook, and ended up with the Pi not booting at all. Checking the disk, it was full of filesystem errors that could not be repaired - I’m pretty sure the SSD it was using had previously been retired due to similar problems, so it was time for a replacement.

Taking a new SSD and reprovisioning this Pi was the easy part thanks to the Raspberry Pi Imager and the Ansible playbook I had written when I first setup the server. That handles the core OS configuration and many configuration files, including the Docker compose files that defines the services that I run. What it does not include is data.

This server had backups taken on a very ad-hoc basis, and as is often the case the topic of backups becomes a prority again after a data loss event (even if it was largely recoverable from the failing SSD).

» Continue reading


Using Actionable Notifications in Home Assistant

I’ve seen a bunch of videos on YouTube lately that included actionable notifications in automations, but it’s not something I’d ever used before.

The Home Assistant companion documentation shows plenty of examples of how to include the actions in the notifications, but not much on how to actually respond to the action events. I came across this post that I found was a good starting point for my automation.

My initial use case for this was for a notification in the morning when the kids should be out to school, to prompt me to turn out any lights that they have inevitably left on.

My current automation for this is as follows. This checks if any of three lights are still on at 8am on a weekday, and if so sends a notification to my phone with the option to turn them off.


alias: Notify - Kids lights left on
description: ""
trigger:
  - platform: time
    at: "08:00:00"
condition:
  - condition: and
    conditions:
      - condition: time
        weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
        alias: Is it a weekday?
      - condition: or
        conditions:
          - condition: state
            entity_id: light.childone_room_cloud_light
            state: "on"
          - condition: state
            entity_id: light.childone_room_bulb
            state: "on"
          - condition: state
            entity_id: light.childtwo_bedroom_main_bulb
            state: "on"
        alias: Are any of the boys lights on?
action:
  - alias: Set up variables for the actions
    variables:
      action_no: "{{ 'NO_' ~ context.id }}"
      action_turnoff: "{{ 'TURNOFF_' ~ context.id }}"
  - alias: Notify Mobile
    service: notify.mobile_app_twelve
    data:
      message: Boys lights are still on. Turn off?
      data:
        actions:
          - action: "{{ action_turnoff }}"
            title: Turn off lights
          - action: "{{ action_no }}"
            title: Leave On
  - alias: Wait for a response
    wait_for_trigger:
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: "{{ action_no }}"
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: "{{ action_turnoff }}"
  - alias: Perform the action
    choose:
      - conditions: "{{ wait.trigger.event.data.action == action_no }}"
        sequence: []
      - conditions: "{{ wait.trigger.event.data.action == action_turnoff }}"
        sequence:
          - service: light.turn_off
            data: {}
            target:
              entity_id:
                - light.childone_room_bulb
                - light.childtwo_bedroom_main_bulb
                - light.childone_room_cloud_light
mode: single