Coder Social home page Coder Social logo

ojoanalogo / issuetron-3000 Goto Github PK

View Code? Open in Web Editor NEW
21.0 1.0 1.0 1.57 MB

๐Ÿšจ Trigger a MQTT alert when someone opens an issue in one of your repositories

License: MIT License

TypeScript 62.11% C++ 35.65% C 2.24%
iot gh-actions actions-iot adafruit-io esp8266

issuetron-3000's Introduction

issuetron-3000 ๐Ÿšจ

๐Ÿšจ Turn on a light signal on the physical world when an issue is opened on one of your repos

This is my entry for the dev.to GitHub Actions hackathon

Index

About this

This is a really simple action intended to connect the real world with IoT devices connected to Adafruit IO Cloud.

It allows repo mantainers to keep alerted about new issues on their repos, made for the heros of the Open-Source ๐Ÿ’™

๐Ÿ”ง I'm using Adafruit IO cloud for the ease of IoT development and device provisioning, since I know most people would like to configure a device the easy way and not have to go through complicated setups like AWS or Azure IoT.

The Action workflow is listening to an "Issue" event and when it's triggered it gets the issue context (like username and issue title) and sends the content over MQTT protocol to an ESP8266 device which I had lying around, it turns on a red lamp which I got from a auto parts store. ๐Ÿšจ

Action is able to send context about the issue, being those details:

issue title
issue author
repo of origin

You can also disable the issue context if you want to save some bytes or you only want to trigger a custom action on your IoT device.

This action leverages repo secrets, since some variables like the device Key and ID are supposed to be secret, you can find more information on the README on how to setup your device.

How to use

Example workflow file:

on:
issues:
  types: [opened]

jobs:
do_iot_thing:
  runs-on: ubuntu-latest
  name: A job to turn on a light when someone opens an issue
  steps:
    - name: Send activation to ESP8266 device
      uses: 'mxarc/[email protected]'
      id: activation
      with:
        time: '15' # how much time we will keep our light on
        blink: true # enable blinking, otherwise just turn on the lamp
        io_user: '${{ secrets.IO_USER }}'
        io_key: '${{ secrets.IO_KEY }}'
        io_feed: 'issuetron'
        send_context: true
    # Use the output from the `hello` step
    - name: Check if we succeeded to turn on the light
      run: echo "The result of the action is ${{ steps.activation.outputs.success }}"

Requirements

  • An Adafruit IO account
  • A GitHub user account
  • ESP8266 device
  • LCD screen
  • I2C Adapter for LCD screen (we need it to save space and pins)
  • LED of any color
  • 220ohm resistor
  • Wires
  • Internet connection
  • ๐ŸŒ A banana (we will eat it, they're delicious!)

Setting up Adafruit IO

  1. Head over to https://io.adafruit.com/ and create an account (Click Get started for free)
  2. Once you create an account, sign in into io.adafruit.com
  3. Create a new feed, name it "issuetron" New feed New feed2
  4. Once you create a new feed, click on "Adafruit IO Key" and save those values (you will need them later!) IO Key IO Key2

Setting up your IoT device

Now it's time to wire up the components, for the red LGB you could use another source of output, like a buzzer but it's up to you to modify the sketch.

Wiring

Follow this sketch to connect your ESP8266 device

The next step is to upload the device code, you can find the code on the esp8266-code folder, I suggest you to use PlataformIO extension to make it easier to upload the code to your board.

You might need to find drivers for your esp8266 board, a quick Google search will get what you need.

Go to the config.h file and replace the next values with your actual device info and WiFi settings:

// WiFi Settings
#define WLAN_SSID "<wifi name>"
#define WLAN_PASS "<wifi password>"

// Adafruit settings
#define AIO_USERNAME "<adafruit io username>"
#define AIO_KEY "<adafruit io key>"

Setting up action

Add this Workflow file to your .github workflows folder

I strongly suggest you to use Repo secrets to store the value of IO_KEY and IO_USER

Trying the action

Once you completed the steps above, just open a new Issue and your device should alert you of a new opened issue :D

License

MIT

issuetron-3000's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

abhinavm24

issuetron-3000's Issues

Not working!!1

pls fix

       const char *repo = doc["repo"];   // "issuetron-3000"
                   ^
Retrieving maximum program size .pio/build/nodemcuv2/firmware.elf
Checking size .pio/build/nodemcuv2/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [===       ]  34.6% (used 28340 bytes from 81920 bytes)
Flash: [===       ]  27.2% (used 283824 bytes from 1044464 bytes)
Configuring upload protocol...
AVAILABLE: espota, esptool
CURRENT: upload_protocol = esptool
Looking for upload port...

Warning! Please install `99-platformio-udev.rules`. 
More details: https://docs.platformio.org/page/faq.html#platformio-udev-rules

Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms it can be a USB flash drive (i.e. /media/<user>/<device name>)
*** [upload] Explicit exit, status 1
============================================================================ [FAILED] Took 1.57 seconds ============================================================================
The terminal process "platformio 'run', '--target', 'upload'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.