Anki Vector integration

Has anyone managed to integrate Anki’s Vector robot into Home Assistant yet? The vector sdk has just been released, it would be great to use this to provide notifications or feedback from home assistant.

The problem is: you can not use vector or cozmo without cell phone to connect to them, as far as I know. I have a cozmo.

Vector is connected to the cloud and only needs the app for initial setup. There’s an update being released soon brining Alexa integration too. It would be great if Vector works with IFTTT or home assistant

1 Like

I would like to have this integration as well. This would be absolutely awesome. Having this little helper on the desk and getting help from him around the house.

I’ll have a look at the sdk samples again over Christmas if I get time… sure there must be a way.

1 Like

I got the Alexa Update in the evening and this is a nice start. Now vector works as a little alexa device and listens for alexas hotword and works the same as alexa.
I am reading the sdk right now to make it a two way street and being able to control vector from homeassistant but I fear I won’t have enough time these holidays.

Nice! I’m in the UK we’re not getting the Alexa update until January

watching…

Me watching too now my Anki has arrived today

My Vector will arrive this week. I hope somebody will integrate it to Home Assistant soon. Would be awesome!

Hello! I just got mine a week ago and started working on integration. I am building proxy between web-api and sdk. Then I will learn how to integrate it into home assistant. For now I have my own integrations based on curl.

HTTP API: https://github.com/brushknight/vector-http-api . (Work in progress)

5 Likes

Any updates / progression on this?

1 Like

Some news about?

1 Like

I guess we need to wait a bit:

1 Like

Anybody get any further with this

Hey guys, I’m bumping this thread to let you know that Vector 2.0 is finally out for pre-order, including the Escape Pod (it’s the ability to host Vector’s server on a RPI) !!! :smiley:
I just pre ordered it (Vector 2.0 Advanced AI / Companion Robot | Digital Dream Labs), will let you guys know as soon as I receive it to try to host the Escape Pod on Hassio !

1 Like

Came in here to say just this, escape pod sounds like an amazing extension to Home Assistant! I would love Vector to be the face of my HA!

Anything new?

cyb3rdog has created s Docker image for Escape Pod which we might be able to add as a local add on to HA and work from there…

Hi Vector Owners,
I’ve been working on getting the python SDK to work with Home Assistant.
I’ve created a modified addon for AppDaemon 4 with the SDK installed and certificates, creating a python script I have got it polling Vector every 5 mins.
It will automatically create entities within HA if they don’t exist.
Its quite a hacky way of doing it all but will allow you to create some automations with Vector - this could be improved massively.
I have only started playing with Python, so if you come up with any improvements - Please share with everyone and me :slight_smile:

I have worked out an easier solution for everyone to install the SDK within the official AppDaemon 4 addon which I recommend playing with first instead of creating a local addon (which has some benefits).

I have written some instructions below which will assume that you’re familiar with Vector’s SDK and Home Assistant, particularly SSH / FTP in to your Home Assistant.

  1. Install the official AppDaemon 4 addon

  2. Add the following lines in the configuration page:

init_commands:
  - python3 -m anki_vector.configure
  - 'y'
  - '!secret vector_id'
  - '!secret vector_ip'
  - '!secret vector_serial'
  - '!secret vector_email'
  - '!secret vector_password'
python_packages:
  - cyb3r_vector_sdk
system_packages:
  - py3-pillow
  - py3-numpy
  1. SSH (SFTP) in to /config then open secret.yaml
    Enter your credentials below for the SDK inside secret.yaml
vector_id: Vector-0000 #Vectors Name
vector_ip: 192.168.***.*** #Vectors IP
vector_serial: '00000000' #Vectors Serial#
vector_email: [email protected] #Email address used for Vector
vector_password: P@55w0rd #Password used for Vector
  1. SSH (SFTP) in to /config and open configuration.yaml, copy & paste the below in to the file:
camera:
  - platform: local_file
    name: VectorCam
    file_path: /config/www/vectorcam.jpg
  1. SSH (SFTP) in to /config/www, download the image below Vector Cam Disabled and place in /www directory. Ensure its names as ‘vectorcamdisabled.jpg’.

  2. SSH (SFTP) in to /config/appdaemon/apps - create a file called vector.py

  3. Open vector.py then copy & paste my example below and save:

import appdaemon.plugins.hass.hassapi as hass
import anki_vector
from PIL import Image
import datetime


class VectorWorld(hass.Hass):
  def initialize(self):
      self.listen_event(self.vector_event, "VECTOR_EVENT")
      self.listen_event(self.vector_camera, "VECTOR_CAMERA")
      runtime = datetime.datetime.now()
      addseconds = (round((runtime.minute*60 + runtime.second)/300)+1)*300
      runtime = runtime.replace(minute=0, second=0, microsecond=0) + datetime.timedelta(seconds=addseconds)
      self.run_every(self.vector_status,runtime,300) #300 = 5mins
 
  def vector_event(self, event_name, data, kwargs):
      self.log("Vector say Hello World...")
      with anki_vector.Robot("00000000") as robot: #Your Vector Serial Number
          robot.behavior.say_text("Hello World from Home Assistant")
          robot.conn.release_control()
 
  def vector_status(self, kwargs):
      self.log("Vector Status...")
      with anki_vector.Robot("00000000",behavior_control_level=None) as robot: #Your Vector Serial Number
          battery_state = robot.get_battery_state()
          version_state = robot.get_version_state()
          charger = battery_state.is_on_charger_platform
          self.set_state("sensor.VectorOS", state = "{0}".format(version_state.os_version), attributes = {"friendly_name": "Vector Software"}) 
          self.set_state("sensor.VectorCharger", state = "{0}".format(battery_state.is_charging), attributes = {"device_class": "plug","friendly_name": "Vector Charging"}) 
          self.set_state("sensor.VectoronCharger", state = "{0}".format(charger), attributes = {"device_class": "plug","friendly_name": "Vector On Charger"}) 
          self.set_state("sensor.Vectorchargertime", state = "{0}".format(battery_state.suggested_charger_sec), attributes = {"friendly_name": "Vector Charging Time"}) 
          self.set_state("sensor.VectorVoltage", state = "{:0.2f}".format(battery_state.battery_volts), attributes = {"state_class": "measurement","unit_of_measurement": "V","friendly_name": "Vector Voltage"})
          self.set_state("sensor.VectorBattery", state = "{0}".format(battery_state.battery_level), attributes = {"friendly_name": "Vector Battery Level"})
          self.log("Vectors battery is currently {:0.2f} volts".format(battery_state.battery_volts))
          if charger == 1 and self.get_state("input_boolean.vector_charger")=="off":
              self.log("Vector drive off charger...")
              robot.conn.request_control()
              robot.behavior.drive_off_charger()
              robot.conn.release_control()
              self.set_state("sensor.VectoronCharger", state = "False", attributes = {"device_class": "plug","friendly_name": "Vector On Charger"}) 
          elif charger == 0 and self.get_state("input_boolean.vector_charger")=="on":
              self.log("Vector drive on charger...")
              robot.conn.request_control()
              robot.behavior.drive_on_charger()
              robot.conn.release_control()
              self.set_state("sensor.VectoronCharger", state = "True", attributes = {"device_class": "plug","friendly_name": "Vector On Charger"}) 
          else:
              self.log("Vector ignore")
          if self.get_state("input_boolean.vectorcam")=="on":
              self.log("Camera enabled...")
              robot.conn.request_control()
              robot.camera.init_camera_feed()
              image = robot.camera.latest_image.raw_image
              rgb_im = image.convert("RGB") 
              rgb_im.save("/config/www/vectorcam.jpg") 
              robot.conn.release_control()
#              robot.close_camera_feed()
          else:
              self.log("Camera disabled...")
              rgb_im = Image.open("/config/www/vectorcamdisabled.jpg")
              rgb_im.save("/config/www/vectorcam.jpg")
#          robot.disconnect()
       
  def vector_camera(self, event_name, data, kwargs):
      self.log("Vectorcamera...")
      with anki_vector.Robot("00000000",behavior_control_level=None) as robot: #Your Vector Serial Number
          robot.camera.init_camera_feed()
          image = robot.camera.latest_image.raw_image
          rgb_im = image.convert("RGB") 
          rgb_im.save("/config/www/vectorcam.jpg") 
  1. In the same directory (/config/appdaemon/apps) open apps.yaml then copy & paste the below and save:
---
vector_test:
  module: vector
  class: VectorWorld
  1. Create two input booleans (toggle switches) in Home Assistant via Helpers.
    One called ‘VectorCam’ and one called ‘Vector Charger’.

  2. Start AppDaemon and monitor logs for any errors.

Ensure Vector is on and connected to your network.

The entities that will automatically create once the SDK successfully deploy and connect to Vector are:
sensor.vectorcharger Vector Charging
sensor.vectoroncharger Vector On Charger
sensor.vectorbattery Vector Battery Level
sensor.vectorchargertime Vector Charging Time
sensor.vectorvoltage Vector Voltage
sensor.vectoros Vector Software
input_boolean.vectorcam VectorCam
input_boolean.vector_charger Vector Charger

Hopefully I haven’t missed anything but I will update if I notice anything missing!

vectorcamdisabled|640x360



.

2 Likes