/
README.Rmd
69 lines (51 loc) · 1.67 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: Interface to the LIFX API
author: Carl Boettiger
output:
md_document:
variant: markdown_github
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
[![Travis-CI Build Status](https://travis-ci.org/cboettig/lifxr.svg?branch=master)](https://travis-ci.org/cboettig/lifxr)
# LIFX
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
## Quickstart
Install the package:
```r
devtools::install_github("cboettig/lifxr")
```
Get your Personal Authentication Token from the LIFX cloud: [https://cloud.lifx.com/settings](https://cloud.lifx.com/settings).
Add this token into R using `options()` in your `.Rprofile` or current session:
```r
options(LIFX_PAT = "<TOKEN>")
```
You can now load the library and control your lights:
```r
library("lifxr")
lights()
on()
off()
```
## Function overview
All endpoints in `v1beta1` of [api.lifx.com](https://api.lifx.com) are implemented, along with a few helper functions.
- `on()` Turn a light or group of lights on
- `off()` Turn a light group off
- `breathe()` run the breathe effect on a light group (with desired settings)
- `color()` change the color of a light or group
- `label()` add a label to a light
- `lights()` List all lights and their status
- `pulse()` run the pulse effect
- `scene()` switch to a certain preset scene
- `toggle()` toggle lights on or off
<!-- API not working?
- `parse_color()` Return the HSBK for a color string
-->
- `current_color()` return the current color of a light group (in a format appropriate for use with `color`/`breathe`/`pulse`)
- `ping()` the API to confirm it responds.
See package documentation for details.