Skip to content

Commit

Permalink
Merge pull request #8 from Geek-MD/develop
Browse files Browse the repository at this point in the history
v0.6.1
  • Loading branch information
Geek-MD authored Mar 30, 2022
2 parents ec70dda + 180822f commit 13a0a1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ SmartHomeBot
<p />

## Basic Installation
This bot relies mainly on *[python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot)*, so you have to install this package first with
This bot is designed to work on a ***Raspberry Py*** and relies mainly on *[python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot)*, so you have to install this package first with

```
pip install python-telegram-bot
```

Also you have to install *gpiozero* library used for */system* command.
Also you have to install *gpiozero* and *psutil* library used for */system* command.

```
pip install gpiozero
pip install psutil
```

Now clone this repo with
Expand All @@ -46,6 +47,7 @@ If you want the bot to run at startup, or advanced configuration, check the [Wik
- [X] Add confirmation buttons to execute */reboot* command. [`v0.4.0`](https://github.com/Geek-MD/SmartHomeBot/releases/tag/v0.4.0)
- [X] Critical data like Telegram bot token, allowed users list and admin users list are stored in external separate JSON files. [`v0.5.0`](https://github.com/Geek-MD/SmartHomeBot/releases/tag/v0.5.0)
- [X] Add */system* command so admins can check CPU temperature of server, CPU and RAM load. [`v0.6.0`](https://github.com/Geek-MD/SmartHomeBot/releases/tag/v0.6.0)
- [X] Group information displayed by */system* command into one unique message. [`v0.6.1`](https://github.com/Geek-MD/SmartHomeBot/releases/tag/v0.6.1)
- [ ] Add */listusers* command so any user can check allowed users list.
- [ ] Add */adduser* command so admins can add users to the allowed users list.
- [ ] Add */removeuser* command so admins can remove users from the allowed users list.
Expand Down
14 changes: 6 additions & 8 deletions smarthomebot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# SmartHomeBot v0.6.0
# SmartHomeBot v0.6.1
# A simple Telegram Bot used to automate notifications for a Smart Home.
# The bot starts automatically and runs until you press Ctrl-C on the command line.
#
Expand Down Expand Up @@ -75,13 +75,11 @@ def system_command(update: Update, context: CallbackContext) -> None:
cpu_load_esc = re.escape(str(round(cpu_load, 1)))
ram_load = psutil.virtual_memory()
ram_load_esc = re.escape(str(round(ram_load.percent, 1)))
cpu_temp_msg = '*CPU temperature:* ' + cpu_temp_esc + '°C'
cpu_load_msg = '*CPU load:* ' + cpu_load_esc + '%'
ram_load_msg = '*RAM load:* ' + ram_load_esc + '%'
update.message.reply_markdown_v2(cpu_temp_msg)
update.message.reply_markdown_v2(cpu_load_msg)
update.message.reply_markdown_v2(ram_load_msg)

system_msg = '*CPU temperature:* ' + cpu_temp_esc + '°C\n'
system_msg += '*CPU load:* ' + cpu_load_esc + '%\n'
system_msg += '*RAM load:* ' + ram_load_esc + '%'
update.message.reply_markdown_v2(system_msg)

def not_command(update: Update, context: CallbackContext) -> None:
update.message.reply_text('Sorry, I can\'t understand that.')

Expand Down

0 comments on commit 13a0a1c

Please sign in to comment.