Skip to content

Zarya Assistant — Telegram is the bot, based on the well known library Telegraf

Notifications You must be signed in to change notification settings

boboshko/zarya-assistant

Repository files navigation

Version Community Chat

Zarya Assistant

Zarya Assistant — Telegram is the bot, based on the well known library Telegraf. It's designed to work with Zarya API and is the final user interface of the ecosystem.

💫 Chasing a dream.

Contents

Functions

User

  • Air temperature display (Fahrenheit or Celsius).
  • Athmosphere pressure display (inches of mercury or milimmetres of mercury).
  • Time zone auto detection using location.
  • Local time support.
  • Time formats support (12 hour or 24 hour).
  • Two languages support (English and Russian).

Technical

  • Display document ID in DB.
  • Display the data delivering speed from the meteostation to the DB.
  • Authorized access to the functionality (see 'Set up').

Demo

https://vimeo.com/527007856

Fast launch

Installation

Copy repository to your server:

git clone https://github.com/boboshko/zarya-assistant.git

Go to the folder with repository:

cd zarya-assistant

Install necessary packages:

npm install

Set up

Add necessary constants as environment variables. For instance:

export zaryaToken="2023094023:KLJF34djfkl3j498SDKDJSLK2asdk2945"
export zaryaWebhook="https://example.com/your/secret/paths/"
export zaryaWebhookPath="/your/secret/paths/"
export zaryaWebhookUse=true
export zaryaApiRequest="https://api.example.com/zarya/read/"
export zaryaApiAuthorization="Basic TG9naW46UGFzc3dvcmQ="
export zaryaAllowedUsers="[213949, 343909320]"

You also may set constants in the file app/config.js. For instance:

module.exports = {
  zaryaToken: process.env.zaryaToken || '2023094023:KLJF34djfkl3j498SDKDJSLK2asdk2945',
  zaryaWebhook: process.env.zaryaWebhook || 'https://example.com/your/secret/paths/',
  zaryaWebhookPath: process.env.zaryaWebhookPath || '/your/secret/paths/',
  zaryaWebhookUse: process.env.zaryaWebhookUse || true,
  zaryaApiRequest: process.env.zaryaApiRequest || 'https://api.example.com/zarya/read/',
  zaryaApiAuthorization: process.env.zaryaApiAuthorization || 'Basic TG9naW46UGFzc3dvcmQ=',
  zaryaAllowedUsers: process.env.zaryaAllowedUsers || '[213949, 343909320]',
};

This table defines the functions:

Function Description
zaryaToken Secret token of your Telegram bot gives BotFather.
zaryaWebhook Launch in production mode
zaryaWebhookPath Launch in developer mode
zaryaWebhookUse Bot launch mode. true — Webhook (preffered). fasle — Long Poling (no setting needed zaryaWebhook и zaryaWebhookPath).
zaryaApiRequest Secret URL to request Zarya API. See documentation.
zaryaApiAuthorization Authorisation login and password for Zarya API in base64 encoding.
zaryaAllowedUsers ID array of Telegram users, who need access to Zarya Assistant. One may get their ID with the bot Get My ID.

Launch

When in folder repository, run:

npm run start

Commands

Command Description
pm2 start ecosystem.config.js Launch in production mode with pm2
npm run start Launch in production mode
npm run start:dev Launch in production mode
npm run lint Check code style
npm run lint:fix Check code style and fix automatically

Values

Bot supports the following values.

Format Data source
Time 12–hour Timestamp
24-hour Timestamp
Degrees Fahrenheit Celsius (with the formula)
Celsius Celsius
Pressure in Hg mm Hg (with the formula)
mm Hg mm Hg

Zarya ecosystem

Zarya is the open source ecosystem to collect, store, aggregate and display environment data at home. Besides Zarya Assistant, project includes:

  • Zarya Meteostation — mateostation based on Iskra JS (Russian only). Represents the data originator. Collects and sends data to Zarya API.

  • Zarya API — the API, allows to collect and send aggregated data, received from Zarya Meteostation.

    Instead of Zarya Meteostation, any other meteostation mwith the same sensors may be used. For instance, based on Arduino. In that case, it's needed to create the firmware for your platform yourself.

Acknowledgements

I want to express my thanks to the people who helped Zarya Assistant come into life:

Support

You may support Zarya in two ways.

First is donation – any amount will speed new releases.

  • Bitcoin: bc1qp2ltjtr2rcd9u5n95umfu2ykltv2x0rta94ywd
  • Ethereum: 0xde75e4596e71855C3552Ec2a307d137FC0A7A99d
  • Dogecoin: DQZK88tpFQG8g7yGt9KMDcyKXtRSVbkGih

Second way is to participate in the development. Simply join the chat Telegram-chat and say you wanna help. The answer will come shortly.