Git Product home page Git Product logo

dff_home_assistant_skill's Introduction

dff_Home_Assistant_skill

Description

This skill is made as a demo for a configurable home assistant dialogs between user and his smart home devices. It has multilingual support (english/russian).

Project structure

  • annotators: Has 2 files basic.py and main.py. In basic.py we have functions that fill up our ctx.misc dictionary with useful information (current language, tts status, user intents like agreeing or denying, the current room, etc.). I also added a function to store the translation of last user request in the ctx as well, which speeds up the process, because it needs to translate the request only once. The main.py calls each function in basic.py to create a full context before proceeding to condition checking.
  • helper_functions: translator_tts.py is used to translate user requests and bot response as well as making it possible to use Google text to speach service for audio responses. home_devices_manipulations.py makes it possible to interact (control lights, check for dimmable lamps, control the temperature) with the mock config files for smart home devices stored in home_devices folder. requesting.py gets us weather information using Open Weather API. simple_Q_A.py adds a functionality of a basic q&a feature. test_prepare.py has all the dialogues that are used for testing function, but it prepares them by adding weather forecast using fstrings and sends compiled tuple to run_test.py
  • scenario: main.py has plot creation with different dialog flows and rules, as well as actor class creation. condition.py has everything to check for conditions and has functions returning boolean values that are imported as loc_cnd in main.py. response.py returns home assistant response as a string as well as calling for translation and tts inside each response function, in some response functions we also make calls to helper functions in order to control home devices, get weather report. label.py has 1 custom label which helps us to reach the node that was the last one before encountering the error, thus resuming the progress from where we left off.

Basic instructions

  1. In order to start the bot, launch interactive mode in the terminal.
  2. Commands are sent by typing in request from the keyboard.
  3. To turn off TTS type in "Disable TTS", "Turn off tts", "Выключить ттс"; you can turn it back on with similar commands.
  4. To stop the conversation at any point of time type "stop" in either language.
  5. To change the language type in required language when you are at the starting node, for example: at the start of conversation, when you see "waiting for commands...".
  6. You can thank the bot or say bye, after the command is executed, the bot will respond and return to the starting node clearing the context in the process.

Examples of commands:

I want to ask you a questions.

Launches a brief q&a about basic commands for home assistant. You can ask: "How do I change the language?", "What can you do?" or "How to disable TTS?".

Hey, what is the weather?

Tells you a weather report for a configured location (your house) and asks if you want to get a more detailed forecast as well.

Turn on the light in the kitchen.

Dim the lights.

Asks the room that the user wants to dim the light in (mock files only have dimmable light in the bedroom) if the wrong room is provided it keeps asking till it gets the correct one. After that asks for a brightness level.

I am going away.

Checks for a weather report, if it is raining/snowing it warns the user about it. Additional question is asked by the assistant if anyone else is still at home. If the response is negative, the assistant proceeds to ask if user wants to check the lights and turns it off automatically upon receiving positive confirmation.

Cool down the hallway.

Checks the current temperature in the room using sensors in config file, and sets climate devices in this room to (current temperature - 5 degrees) so it can cool down. Works similarly for "heat up" functionality as well.

Set the temperature to 25 degrees in the living room.

I am coming home.

Checks for a weather report, if there were precipitations offers the user to heat up the hallway before the arrival, so the clothes/boots/umbrella will dry much faster upon arrival.

Quickstart

Python version used: 3.9.10

Install requirements

pip install -r requirements.txt

Run interactive mode

If you are using terminal there is a possibility to have an error "UnicodeDecodeError: 'utf8' codec can't decode byte...". It is caused by extra backspace before command type, so be careful about that.

python run_interactive.py

Run tests

python run_test.py

Resources

  • Execution time: 0.22 sec on average based on test dialogues
  • Starting time: 4.56 sec
  • RAM: 100 MB

dff_home_assistant_skill's People

Contributors

iandroid1812 avatar kudep avatar

Forkers

kkr202mlds

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.