Skip to content

fwiedmann/icof

Repository files navigation

icof

in case of fire

love

Due to the ongoing global pandemic I started to work mostly from home. Beside my job as a software engineer I am also a volunteer firefighter in my local community. This means that I'm on call for emergencies 24/7, also during my daily work as a SE. When I am in the office and get a call, I can speak to my colleagues in seconds that I have to go (Or they just see me running to my car). In booth cases they are informed that I am afk and can probably re-schedule or take over meetings for me. When working from home I want to send an absence notification to my colleagues. Chatting my 2-4 colleagues can be time-consuming. Well, I am an engineer. I can automate this in combination with a big red button. I like big red buttons.

gocrazy installation

First you need to plug-in the Pi SD card into your PC. If you have already installed an OS like raspbian on this SD card, I recommend flashing it. With the fdisk utility you can delete all existing partitions.

Now you can follow the go-krazy installation guide: https://github.com/gokrazy/gokrazy#installation

You can update your gokrazy installation via the web endpoint:

gokr-packer -update yes -hostname 192.168.178.49 -serial_console=disabled ./cmd/icof-cmd

Configuration

To run icof on gokrazy you have to create a startup configuration and place it in the following directory on the permanent data partition of your gocrazy installation: /perm/icof/start-config.json.

Configuration:

{
  "email_config": {
    "host": "",
    "port": 0,
    "username": "",
    "password": "",
    "from_email_address": ""
  }
}

In order to configure your e-mail alert receiver you have to send the following to the dynamic e-mail config endpoint

Example data:

[
  {
    "name": "Family",
    "alert_subject": "ALERT",
    "resolve_subject": "✅ Resolve",
    "alert_template_message": "Hi {{ .Name }},\n ... ",
    "resolve_template_message": "Hi {{ .Name }},\n ... ",
    "addresses": [
      {
        "email": "[email protected]",
        "name": "Felix",
        "surname": "Wiedmann"
      }
    ]
  }
]

Create or Update the current config:

curl -X PUT <IP of your gocrazy host>:8080/email-config -d @config.json

Get current config:

curl -X GET <IP of your gocrazy host>:8080/email-config

Circuit

The circuit uses a pull down resistor. This will pull down the input signal at the GPIO pin to LOW if the switch is pressed and the power circuit is interrupted.

  • Emergency switch is wired in NC (normally closed).
  • A 10kΩ resistor is used
  • 3,3V power pin is enough

circuit

Shopping List