Coder Social home page Coder Social logo

boboshko / zarya-assistant Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 612 KB

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

JavaScript 100.00%
nodejs javascript weather meteostation meteo zarya telegram bot telegram-bot

zarya-assistant's Introduction

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.

zarya-assistant's People

Contributors

boboshko avatar dependabot[bot] avatar

Stargazers

 avatar  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.