README
¶
Litter API

Litter API is an interface to the Litter Robot API.
This is an experimental API. The upstream Litter Robot API is not publicly documented and may cause breaking changes with no notice. Breaking changes will be handled as soon as possible.
Examples
package main
import (
"fmt"
. "github.com/tlkamp/litter-api"
"log"
)
func main() {
lc, err := NewClient(Config{
Email: "your-email@example.com",
Password: "your-password-here",
APIKey: "your-api-key",
})
if err != nil {
log.Fatalln(err)
}
states, err := lc.States()
if err != nil {
log.Fatalln(err)
}
for _, state := range states {
log.Println(fmt.Sprintf("%+v", state))
}
}
Logging
Logrus is the logger used in this project. The log level and format can be altered accordingly.
log.SetLevel(log.DebugLevel)
Unit Status
The unit status is represented by a non-negative integer.
String | Int | Description |
---|---|---|
RDY | 0 | Ready |
CCP | 1 | Clean Cycle in Progress |
CCC | 2 | Clean Cycle Complete |
CSF | 3 | Cat Sensor Fault |
DF1 | 4 | Drawer full - will still cycle |
DF2 | 5 | Drawer full - will still cycle |
CST | 6 | Cat Sensor Timing |
CSI | 7 | Cat Sensor Interrupt |
BR | 8 | Bonnet Removed |
P | 9 | Paused |
OFF | 10 | Off |
SDF | 11 | Drawer full - will not cycle |
DFS | 12 | Drawer full - will not cycle |
Documentation
¶
Index ¶
- type Client
- func (c *Client) Cycle(robotId string)
- func (c *Client) Insights(id string, days, timezoneOffset int) ([]Insight, error)
- func (c *Client) NightLightOff(robotId string)
- func (c *Client) NightLightOn(robotId string)
- func (c *Client) PanelLockOff(robotId string)
- func (c *Client) PanelLockOn(robotId string)
- func (c *Client) PowerOff(robotId string)
- func (c *Client) PowerOn(robotId string)
- func (c *Client) RefreshToken()
- func (c *Client) States() ([]State, error)
- func (c *Client) Wait(robotId string, val string)
- type Config
- type Insight
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client - The Client for interacting with the Litter Robot API.
func (*Client) Insights ¶
Insights - return the Litter Robot Insights over the specified number of days.
func (*Client) NightLightOff ¶
NightLightOff - Turn nightlight off.
func (*Client) NightLightOn ¶
NightLightOn - Turn nightlight on.
func (*Client) PanelLockOff ¶
PanelLockOff - Disable the panel lock.
func (*Client) PanelLockOn ¶
PanelLockOn - Enable the panel lock.
func (*Client) RefreshToken ¶
func (c *Client) RefreshToken()
RefreshToken - Refreshes the access_token granted by the initial client creation.
type Config ¶
type Config struct { ApiUrl string AuthUrl string ClientId string ClientSecret string Email string Password string ApiKey string }
Config - Configuration for the Litter Robot client
type Insight ¶
type Insight struct { AverageCycles float64 `json:"averageCycles"` TotalCycles int `json:"totalCycles"` }
Insight - represents a Litter Robot Insights response.
type State ¶
type State struct { CleanCycleWaitTimeMinutes float64 CyclesAfterDrawerFull float64 CycleCapacity float64 CycleCount float64 CyclesUntilFull float64 DidNotifyOffline bool DFICycleCount float64 DFITriggered bool LitterRobotID string LitterRobotSerial string Name string NightLightActive bool PanelLockActive bool PowerStatus string SleepModeActive bool UnitStatus float64 }
State - the exported state of the Litter Robot.