vacbot

package module
v0.0.0-...-d83ba23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2019 License: MIT Imports: 18 Imported by: 1

README

go-vacbot

A golang library for communicating with Ecovacs Deebot robot vacuums.

Inspired by sucks from William Pietri.

Quick Start

First create a config file similar to vacbot.example.json.

package main

import (
	"flag"
	"time"

	vacbot "github.com/skburgart/go-vacbot"
)

func main() {
	vacbotConfigFile := flag.String("vacbotconfig", "vacbot.json", "json file containing vacbot configuration")
	flag.Parse()

	v := vacbot.NewFromConfigFile(*vacbotConfigFile)
	v.SpinLeft()
	time.Sleep(2 * time.Second)
	v.StopMoving()

	v.SpinRight()
	time.Sleep(2 * time.Second)
	v.StopMoving()

	v.Forward()
	time.Sleep(2 * time.Second)
	v.StopMoving()

	v.CleanAuto()
	time.Sleep(5 * time.Second)
	v.CleanStop()
}

Documentation

Index

Constants

View Source
const (
	COMMAND_MOVE_FORWARD = `<ctl td="Move"><move action="forward" /></ctl>`
	COMMAND_SPIN_LEFT    = `<ctl td="Move"><move action="SpinLeft" /></ctl>`
	COMMAND_SPIN_RIGHT   = `<ctl td="Move"><move action="SpinRight" /></ctl>`
	COMMAND_TURN_AROUND  = `<ctl td="Move"><move action="TurnAround" /></ctl>`
	COMMAND_STOP_MOVING  = `<ctl td="Move"><move action="stop" /></ctl>`

	COMMAND_CLEAN_AUTO        = `<ctl td="Clean"><clean type="auto" speed="standard" /></ctl>`
	COMMAND_CLEAN_AUTO_STRONG = `<ctl td="Clean"><clean type="auto" speed="strong" /></ctl>`

	COMMAND_CLEAN_BORDER        = `<ctl td="Clean"><clean type="border" speed="standard" /></ctl>`
	COMMAND_CLEAN_BORDER_STRONG = `<ctl td="Clean"><clean type="border" speed="strong" /></ctl>`

	COMMAND_CLEAN_SPOT        = `<ctl td="Clean"><clean type="spot" speed="standard" /></ctl>`
	COMMAND_CLEAN_SPOT_STRONG = `<ctl td="Clean"><clean type="spot" speed="strong" /></ctl>`

	COMMAND_CLEAN_SINGLEROOM        = `<ctl td="Clean"><clean type="singleroom" speed="standard" /></ctl>`
	COMMAND_CLEAN_SINGLEROOM_STRONG = `<ctl td="Clean"><clean type="singleroom" speed="strong" /></ctl>`

	COMMAND_CLEAN_STOP = `<ctl td="Clean"><clean type="stop" speed="standard" /></ctl>`

	COMMAND_CHARGE = `<ctl td="Charge"><charge type="go"/></ctl>`

	COMMAND_GET_BATTERY_INFO = `<ctl td="GetBatteryInfo" />`
	COMMAND_GET_CLEAN_STATE  = `<ctl td="GetCleanState" />`
)
View Source
const (
	CLIENT_KEY         = "eJUWrzRv34qFSaYk"
	SECRET             = "Cyu5jcR4zyK6QEPn1hdIGXB5QIDAQABMA0GC"
	ECOVACS_PUBLIC_KEY = `` /* 272-byte string literal not displayed */

)
View Source
const (
	MAIN_URL = "https://eco-%s-api.ecovacs.com/v1/private/%s/%s/%s/%s/%s/%s/%s"
	USER_URL = "https://users-%s.ecouser.net:8000/user.do"
)
View Source
const (
	XMPP_URL = "msg-%s.ecouser.net:5223"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(c Config) *Client

func NewFromConfigFile

func NewFromConfigFile(configFile string) *Client

func (*Client) Charge

func (c *Client) Charge()

func (*Client) CleanAuto

func (c *Client) CleanAuto()

func (*Client) CleanAutoStrong

func (c *Client) CleanAutoStrong()

func (*Client) CleanBorder

func (c *Client) CleanBorder()

func (*Client) CleanBorderStrong

func (c *Client) CleanBorderStrong()

func (*Client) CleanSingleroom

func (c *Client) CleanSingleroom()

func (*Client) CleanSingleroomStrong

func (c *Client) CleanSingleroomStrong()

func (*Client) CleanSpot

func (c *Client) CleanSpot()

func (*Client) CleanSpotStrong

func (c *Client) CleanSpotStrong()

func (*Client) CleanStop

func (c *Client) CleanStop()

func (*Client) FetchBatteryLevel

func (c *Client) FetchBatteryLevel()

func (*Client) FetchCleanState

func (c *Client) FetchCleanState()

func (*Client) Forward

func (c *Client) Forward()

func (*Client) RecvHandler

func (c *Client) RecvHandler(handlerFunc func(interface{}, error))

func (*Client) SpinLeft

func (c *Client) SpinLeft()

func (*Client) SpinRight

func (c *Client) SpinRight()

func (*Client) StopMoving

func (c *Client) StopMoving()

func (*Client) TurnAround

func (c *Client) TurnAround()

type Config

type Config struct {
	Email        string `json:"email"`
	PasswordHash string `json:"password_hash"`
	DeviceId     string `json:"device_id"`
	Resource     string `json:"resource"`
	Country      string `json:"country"`
	Continent    string `json:"continent"`
	Lang         string `json:"lang"`
	AppCode      string `json:"app_code"`
	AppVersion   string `json:"app_version"`
	Channel      string `json:"channel"`
	DeviceType   string `json:"device_type"`
	Timezone     string `json:"timezone"`
	Realm        string `json:"realm"`
}

func LoadConfiguration

func LoadConfiguration(file string) Config

type VacbotXMPP

type VacbotXMPP struct {
	// contains filtered or unexported fields
}

func NewVacbotXMPP

func NewVacbotXMPP(userId, userAccessToken, deviceJID string) *VacbotXMPP

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL