Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SvitloBot: Add min/max value to react on increase/decrease of percentage #22

Merged
merged 7 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions svitlobot-monitor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2024.11.3 - 2024-11-12

- Add min/max value to react on increase/decrease of percentage

## 2024.11.1 - 2024-11-06

- Bump SvitloBot Monitor to 1.5.6
Expand Down
13 changes: 8 additions & 5 deletions svitlobot-monitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
## Confururation settings

```
group: int
token: 9999999999:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA # Telegram bot Token
chat_id: -0000000000000 # Target Chat ID
step_interval: 5:10 10:30 15:60 # Tendency by specifying a value step in percentage and a time interval in minutes
debug: false # Optional: Debug level of logging
group: int # DTEK group ID
token: 9999999999:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA # Telegram Bot Auth token
chat_id: -0000000000000 # Target Telegram Chat ID
step_interval: 5:10 10:30 15:60 # Value step in percentage and time interval in minutes, to detect the tendency. Format is "percentage:time"
min: 30 # Value in percentage, to react on decrease of percentage
max: 80 # Value in percentage, to react on increase of percentage
night_time: 23:8 # Interval in hours, when the script is sending messages in silent mode. Format is "start:stop" in 24h format
debug: false # Optional: Debug level of logging
```

> [!NOTE]
Expand Down
6 changes: 5 additions & 1 deletion svitlobot-monitor/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: SvitloBot Monitor
version: 2024.11.1
version: 2024.11.3
slug: svitlobot-monitor
description: SvitloBot Monitor check the data from SvitloBot API and send the electricity switching on or off tendency indication for the appropriate DTEK group to the appropriate telegram user/chat/group/forum.
url: https://github.com/andrewjswan/blackout-addons/svitlobot-monitor/
Expand Down Expand Up @@ -32,12 +32,16 @@ panel_title: SvitloBot Monitor
options:
group: 1
step_interval: "5:10 10:30 15:60"
min: 30
max: 80
night_time: "23:8"

schema:
group: int
token: password
chat_id: str
step_interval: str
min: int(0,100)
max: int(0,100)
night_time: str
debug: bool?
4 changes: 3 additions & 1 deletion svitlobot-monitor/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ bashio::log.info 'Configuration:'
bashio::log.blue " Group: $(bashio::config 'group')"
bashio::log.blue " Chat ID: $(bashio::config 'chat_id')"
bashio::log.blue " Step interval: $(bashio::config 'step_interval')"
bashio::log.blue " Min: $(bashio::config 'min')"
bashio::log.blue " Max: $(bashio::config 'max')"
bashio::log.blue " Nighttime: $(bashio::config 'night_time')"
if bashio::config.true 'debug'; then
bashio::log.info " Setting debug mode"
Expand All @@ -68,7 +70,7 @@ bashio::log.info

bashio::color.blue
cd /app
node src/index.js --language uk --group $(bashio::config 'group') --refresh-interval 5 --add-timestamp --time-zone "Europe/Kiev" --night_time $(bashio::config 'night_time') --step-interval-pair $(bashio::config 'step_interval') ${options[@]}
node src/index.js --language uk --group $(bashio::config 'group') --refresh-interval 5 --add-timestamp --time-zone "Europe/Kiev" --night_time $(bashio::config 'night_time') --min $(bashio::config 'min') --max $(bashio::config 'max') --step-interval-pair $(bashio::config 'step_interval') ${options[@]}
bashio::color.reset

# ==============================================================================
Expand Down
25 changes: 25 additions & 0 deletions svitlobot-monitor/translations/en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
configuration:
group:
name: Group
description: DTEK group ID
token:
name: Token
description: Telegram Bot Auth token
chat_id:
name: Chat ID
description: Target Telegram Chat ID
step_interval:
name: Step Interval
description: Value step in percentage and time interval in minutes, to detect the tendency. Format is "percentage:time"
min:
name: Min
description: Value in percentage, to react on increase of percentage
max:
name: Max
description: Value in percentage, to react on decrease of percentage
night_time:
name: Night Time
description: Interval in hours, when the script is sending messages in silent mode. Format is "start:stop" in 24h format
debug:
name: Debug
description: Debug level of logging