Skip to content

home-things/rpi-tg-bot

Repository files navigation

tg-rpi-smart-home-bot Build Status

🚧 [Alpha] tg+rpi smart-home bot that controls: light, sound, volume, homemates presense, voice (tts+asr)

homemates presense homemates presense voice over voice over
music & volume music & volume light light
screen shot 2017-07-19 at 13 26 46
homekit alfred macos alfred
photo img_0283 img_1060
img_0289 img_0290 img_0292

Hardware

  • Any raspbery pi (I use Raspberry Pi Model B Rev 2 and Pi Rev 3)
  • Light driver (I use very own one based on Reley(solid-state/thyristor omron-g3mb-202p))
  • Sound system (I use external rpi sound card HIFIBERRY DAC+ and usual amp+speakers system Edifier R980T)

Software

Architecture

🚧 work in progress

hosts

  • primary-rpi aka rpi2main — bot, control-center, music source, sound system#1, jobs
  • secondary-rpi aka rpi3 aka rpi-media — torrents, large storage, LCD-display with fullhd, sound system#2

Getting started

installation

npm add -g forever
# ... rpi-bin
# ... tg-rpi-smart-home-bot
# npm i
# ... crontab -e
BOT_TOKEN=$(node -p "require('./config').signals.sources.telegram.token") forever start /home/pi/services/tg-rpi/

Documentation

launch

# forever process with logs
npm run start

scripts

npm run restart
npm run watch-logs

Roadmap

draft todos

architecture and refuctoring

  • tests
    • add some tests
    • setup CI
    • fix CI
    • increase test coverage
  • более тесная интеграция с бота homekit
    • volume control
    • two-side mapping (sync everything instantly, pubsub)
  • split into modules
  • create Installer
    • think about Docker
    • draft
  • write or use some Platform
    • with plugins, signals, commands, jobs, machines, sensors, configs, state-management, etc.
    • state and signals (actions)
      • universal rest/tg/in-app/app-api/sensor signal (action/event) adaptor
      • programming finite state maschine transitions via tg
      • think about redux
    • platform example: http://hobbyquaker.github.io/ccu.io
  • configs: separate; specify
    • ?? separate: (config) <-- ({command}.config)
    • ?? specify: command(config) <-- command(config.commands.list.command))

to code

  • ifttt integrations
    • home presense
    • не включ будильник/музыкальный подкаст если меня нет
  • ! mini-bank e.g. use transity under the hood
  • wip delivery club automation
  • router integration (remote restart, lan dns mngmnt)
  • no-interactive actions debug_chat log
  • run on any machine abstraction layer (rpi2, rpi3)
  • #rock-sci NLP (natural lang processing) improve text command flexibility
    • word2vec, levinshtain for 1) command matching, 2) music search
    • api.ai for intent mining
    • RandomForest (that better than CatBoosk) for ML classification
    • xgboost for simple general purpose ML
    • wip music genres pleer.net
    • repeat, undo, ask detaild commands
    • learnings new commands synonyms (— do magic — ... — I say to you, bot! — wow, do you mean 'switch magic on'?)
  • ! reminders
  • transcribing voice messages, interpret commands
    • get tg audio -> asr voice.ogg 'audio/ogg;codecs=opus'
  • automatic problem diagnosis
    • #rock-sci CBR case-based reasoning aka copy-pasete development aka stackoverflow/google development
  • VAD+mics
    • think about amazon alexa with its skills integration
  • I18N
  • fix HomeKit external data updating https://github.com/KhaosT/HAP-NodeJS/issues/497
  • light control, scrpts
  • volume control, scrpts
    • automatic smooth volume changing
    • local volume (e.g. alarm smooth increasing)
  • sound control: play by url, pause/resume/stop, scrpts
  • voice over
  • basic weather
  • weather
    • (with icons and smart recommendations)
  • AAA aka Authorization
    • telegram nicknames whitelist
    • granular ACL
    • auth command (add name, role, ifttt, mac/ip/hostname)
  • /commands for usual cases
  • basic presense control
  • handle photos, voice-records, music, torrent-files and links
    • torrents: wait for downloading started
    • video: check rpi3 alive. abort failed by timeout videos.
    • dont answer done innediately to torrent status command
  • fun
    • jokes
      • jokes random schedule
    • сделать так, чтобы на похвалу бот отвечал в стиле "хозяин любит нас ^-^"
  • Data sequences streams, data series db
    • viewer: Initial State Platform
  • scheduled / delayed tg messages via tg message-commands

todo: add hardware

  • light toggle button
  • tablet screen
  • window blinds control (servo-drive)
  • separate sound control
  • voice control microphones
  • presense sensors
  • external light intensity (LUX) sensors
  • advanced LEDs
    • dimmed fine mixed triple stripes 2700K, 4200K, 6400K
    • ceiling panels
    • Philips HUE lamps (itsnt my choise)
    • Xiaomi smart lamps

Alternative solutions

  • pros
    • life-style selling promo description
    • community, much plugins
    • simple installation
    • NFC scenarios
    • sensors integration. list
    • ML, voice-activation, telegram something. read more
    • good ux/ui
  • cons
    • frontend gui centric
    • not a telegram first sitizen
    • SQL
    • everything is js?
    • no homekit, airplay intergation?

home-assistant (python3)

  • cons
    • python