saarioka / raspberry-slack

A set of python modules to control a Raspberry Pi via Slack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Raspberry Slack logo

A set of python modules to control a Raspberry Pi via Slack

An easy to use Python script to run a bot from an RPI. It allows you to send direct messages to a bot running on an RPI (or indeed any Linux system), using the Real Time Messaging API to parse incoming text. There are three plugins that the script uses to parse user messages using regex:

  • plugin_status: responds to 'status' with a readout of temperature, CPU % and running time; responds to 'IP' with IP address;
  • plugin_motion: use on an RPI running Motion - responds to 'snapshot' with a picture from the webcam.
  • plugin_sys: reponds to 'reboot' or 'shut down' and either reboots or shuts down

I plan to add more! please send suggestions...

Script only works on Python 2.7 due to the underlying slackclient library

To use:

  1. Create a bot within Slack and invite it into the #general channel

Instructions for creating a bot can be found here

  1. Clone this repository onto your Pi:
$ git clone https://github.com/philipok-1/raspberry-slack
  1. Fill in the slack_config.conf file with appropriate API keys, usernames and webhook urls (if using). if you are using Motion you need to add local webcam IP address and the image capture location

  2. Run the Raspberry-Slack.py script from your pi (probably with sudo)

  3. Send your bot a DM on the relevant slack channel - i.e @rpi "send me a snapshot". The bot will also recognise messages sent to @everyone so you can get mutiple PIs to report in

With acknowledgments to:

The Slack python client for the main library

youknowone for code on autoping and catching socket errors

Never Fear for a Stack suggestion on plugin architecture

About

A set of python modules to control a Raspberry Pi via Slack

License:MIT License


Languages

Language:Python 100.0%