Jasper Integration

I’ve seen some interest in using Jasper (an open-source voice assistant similar to the Amazon echo) with HA. With a little work, I was able to get HA and Jasper working together (both ways).

To use this you will need to be using the dev version of Jasper (ie: Jasper 2.0).

To set up Jasper to HA

The following Jasper dev plugin can be used to call on HA’s conversation component. Note that HA’s conversation component is very basic in its current form. It only supports “Turn [device name] on/off”.
https://github.com/Theb-1/jasper-client/tree/jasper-dev-custom/plugins/speechhandler/homeassistant

Add the following to Jasper’s profile.yml:

HomeAssistant:
  Host: [HA hostname or IP]
  Password: [HA API password]

You should now be able to tell Jasper, “Turn the kitchen light on”, and have HA turn on the kitchen light.

To set up HA to Jasper

I have modified the Jasper dev branch to include a Restful API:
https://github.com/jasperproject/jasper-client/pull/439

Add the following to Jasper’s profile.yml:

restapi:
  Host: 0.0.0.0

Add the following to HA’s configuration.yaml:

notify:
  platform: rest
  name: 'Jasper'
  resource: 'http://Jaspers_hostname_or_IP:5000/jasper/say'
  method: 'post_json'
  message_param_name: 'text'

Example Automation

This will have Jasper announce an entry through the garage door if the alarm is currently set to Armed-Home mode (ie: when everyone is home and sleeping)

- alias: Alarm Entry Alert - Garage Door
  trigger:
    platform: state
    entity_id: binary_sensor.garage_door
    state: 'on'
  condition:
    - platform: state
      entity_id: alarm_control_panel.alarm
      state: 'armed_home'
  action:
    service: notify.Jasper
    data:
      message: 'alert, entry detected at garage door'

Hopefully someone else will find this useful. Happy Automating :wrench:

4 Likes

A little more about my Jasper configuration in case anyone’s interested:

Running on: OrangePi PC (HA is running here as well)
Mic: Built in mic on OrangePi
STT Passive Engine: sphinx
STT Active Engine: witai
TTS Engine: ivona
TTS Voice: Brian (under UK)
Passive Keyword: Jarvis

Overall cost was around $21 (including shipping) ordering OrangePi and a cheap hamburger speaker from AliExpress. I used an existing power supply and microSD card.

This setup works better than I originally imagined it would, but don’t expect the experience to be near as nice/polished as the Echo.

I started an integration too.

I have to go back to it and add some useful functionality.

Hi,

Which language are supported ?
my english is poor …
I believe that Jasper is compatible with many langages, but its integration in HA needs some adaptations ?

Jasper is extremely modular, basically you can setup whatever language pack you want on whatever STT engine you like. I prefer MaryTTS, but to each his own.
https://groups.google.com/forum/#!forum/jasper-support-forum

This is the forum I run.

Ok thanks it seems to be very cool !
I’ll try it soon :smile:

Really interesting! Great to use Jasper to speak out (TTS) notifications in the house for various events.

Voice control light/switches is also a nice bonus for family members not having a phone.

Possibly ask Jasper for temperature readings of your temp gauges around the house could be useful.
Jasper - Whats the temperature in the garage?

Hi there!

Does Jasper depends on some kind of a cloud service for command processing?

Thanks

Yeah @matlun that shouldn’t be a problem. I am about to work on making work on a dimmer. I just have to finish setting up groups/scenes/etc first. I already have Jasper doing a lot of things. Its a great framework, and is similar to this one in a few ways. Like they were made to work together.

@vdarkobar you can, but you don’t have to use a cloud service.

Could you provide links to the hardware? I am curious.

Also, to answer your questions guys. @vdarkobar NO jasper does NOT require an on-line presence, it can be completely offline; BUT, to get really good performance for a large variety of words/phrases, it works better with a service like wit.ai (comes preconfigured). I also provide a free TTS server that is pre-configured in our image. (I use MaryTTS currently)

That way at least the tts is private. Currently, there are several STT projects that are being worked on to resolve the performance issues with offline we see now.

BTW: I am not fully advertising, because this is more for community members, and real coders. But I am now selling test/pre-configured jasper kits. I am working to make home-assistant.io work on the same RPI as Jasper if anyone has done so please message me on my site or our slack. Just curious on peoples setups…

Thanks,
Matthew Curry

A little late to the party, I managed to get it up and running.
I did have a small issue with restapi.py and homeassistant.py
both have trouble reading jasper profile.yml
I get the following error
host = self.profile[‘restapi’][‘Host’]
TypeError: string indices must be integers, not str
As a dirty hack I hard coded the address in the py file.

Which are you using? can you share the URL?

Hi,
sorry for the late reply,
below are the code changes I’m referring to.

restapi.py

try:
    host = self.profile['restapi']['Host']
except KeyError:
    #host = '127.0.0.1'
    host = '0.0.0.0' #hard coded 

homeassistant.py

#print self.profile['HomeAssistant'][]
#host = self.profile['HomeAssistant']['Host']
#port = self.profile['HomeAssistant']['Port'] if 'Port' in self.profile['HomeAssistant'] else 8123
#password = self.profile['HomeAssistant']['Password']

#Hard coded params
host = "127.0.0.1"
port = 8123
password = "password"

profile.yml

restapi:
  Host:'0.0.0.0'
HomeAssistant:
  Host:'127.0.0.1'
  Password:'password'