Coder Social home page Coder Social logo

mycroft-skill-openhab's Introduction

openHAB skill for Mycroft

This skill adds openHAB support to Mycroft. The skill takes advantage of the openHAB REST API, so it works both with the v1.x and v2.x of openHAB.

Some sample voice commands are:

  • "Hey Mycroft, turn on Diningroom Light"
  • "Hey Mycroft, switch off Kitchen Light"
  • "Hey Mycroft, put on Good Night"
  • "Hey Mycroft, set Diningroom to 50 percent"
  • "Hey Mycroft, dim Kitchen"
  • "Hey Mycroft, brighten Kitchen"
  • "Hey Mycroft, dim Kitchen by 20 percent"
  • "Hey Mycroft, what's Bedroom temperature?"
  • "Hey Mycroft, what's Bedroom humidity?"
  • "Hey Mycroft, adjust Main Thermostat to 21 degrees"
  • "Hey Mycroft, regulate Main Thermostat to 20 degrees"
  • "Hey Mycroft, decrease Main Thermostat by 2 degrees"
  • "Hey Mycroft, increase Main Thermostat by 1 degrees"
  • "Hey Mycroft, what is Main Thermostat regulated to?"
  • "Hey Mycroft, what is Main Thermostat tuned to?"

openHAB Item Configuration

In order to make openHAB Items accessible to Mycroft, they need to be tagged. Device names recognized by Mycroft are matched against openHAB Item Labels.

The above examples would all work with the following set of openHAB Item definitons:

Color DiningroomLight "Diningroom Light" <light> (gKitchen) [ "Lighting" ] {channel="hue:0200:1:bloom1:color"}
Color KitchenLight "Kitchen Light" <light> (gKitchen) [ "Lighting" ] {channel="hue:0200:1:bloom1:color"}
Switch GoodNight "Good Night"	[ "Switchable" ]	

Number MqttID1Temperature "Bedroom Temperature" <temperature> [ "CurrentTemperature" ] {mqtt="<[mosquitto:mysensors/SI/1/1/1/0/0:state:default]"}
Number MqttID1Humidity "Bedroom Humidity" [ "CurrentHumidity" ] {mqtt="<[mosquitto:mysensors/SI/1/0/1/0/1:state:default]"}

Group gThermostat "Main Thermostat" [ "gMainThermostat" ]
Number MainThermostatCurrentTemp "Main Thermostat Current Temperature" (gMainThermostat) [ "CurrentTemperature" ]
Number MainThermostatTargetTemperature "Main Thermostat Target Temperature" (gMainThermostat) [ "TargetTemperature" ]
String MainThermostatHeatingCoolingMode "Main Thermostat Heating/Cooling Mode" (gMainThermostat) [ "homekit:HeatingCoolingMode" ]

If items are modified in openHAB, a refresh in Mycroft is needed by the command:

  • "Hey Mycroft, refresh openhab items"

Versions Change Log

  • 1.0 added support to item tagged as Thermostat, CurrentTemperature, CurrentHumidity
  • 0.9 added dimming command to item tagged as Lighting
  • 0.8 supports only Lighting and Switchable tags, commands ON and OFF

Installation

Clone this repository into your ~/.mycroft/skills directory. Then install the dependencies inside your mycroft virtual environment:

If on picroft just skip the workon part and the directory will be /opt/mycroft/skills

cd ~/.mycroft/skills
git clone https://github.com/mortommy/mycroft-skill-openhab skill-openhab
workon mycroft
cd skill-openhab
pip install -r requirements.txt

Configuration

Add the block below to your mycoft.conf file:

 "openHABSkill": {
        "host": "openHAB server ip",
        "port": "openHAB server port"
      }

Restart mycroft for the changes to take effect.

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.