GithubHelp home page GithubHelp logo

rpi_ws2812_telegram's Introduction

rpi_ws2812_telegram

THIS THING JUST PINGS HOSTS

Just making up near-real-world usecases for my RPi0W as former SRE engineer to train my Python skills

Sometimes i need to ping several hosts for debuggind purposes for couple hours, so it's more handy to look at LEDs and immediatly see what's up with hosts than to add them to monitoring or keep several terminal windows open

Example setup

Requiements

Hardware

Software

  • Python >=3.7.3
  • rpi_ws281x library (python3 -m pip install rpi_ws281x)
  • telebot library (python3 -m pip install telebot)

Installation

  1. In Telegram go to BotFather and create a new bot (https://core.telegram.org/bots/tutorial)

  2. Install python3 and git to you SBC:

sudo apt update && sudo apt install git python3 -y

  1. Clone this git repo to your device and go to project's dir:

git clone https://github.com/SozinovD/rpi_ws2812_telegram; cd rpi_ws2812_telegram

  1. Install requirements:

python3 -m pip install -r requirements.txt

  1. Change api_key in tg.ini file, so file looks like this:
[TELEGRAM]
api_key = AAABBBCCC:DDDEEEFFFFFFF
admin_id = <ADMIN_USER_ID>
  1. Make script "run_all.sh" executable and run it:

chmod +x run_all.sh; ./run_all.sh

  1. Send message to your bot, it will reply that you are not permitted to use it and will return your user_id. Add your user_id to tg.ini file, so it looks like this:
[TELEGRAM]
api_key = AAABBBCCC:DDDEEEFFFFFFF
admin_id = 123123123123
  1. Now you can add and delete hosts from monitoring, also you can change brightness of all LEDs and color of UP and DOWN host states by sending these commands to bot (always add '/' in front of command):
add_host - add host to monitoring
del_host - del host from monitoring by LED
show_hosts - show all hosts in config
chng_bright - change LED brightness
chng_up_color - change color for UP hosts
chng_down_color - change color for DOWN hosts
show_conf - show full current config
list_files - list files in ~/files subdir
rm_file - remove file from subdir
send_file - send file back to chat

rpi_ws2812_telegram's People

Contributors

sozinovd avatar

Watchers

 avatar

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.