Learn R Programming

lifx (version 0.2.0)

lx_list_lights: list available lights

Description

list available lights

Usage

lx_list_lights(selector = "all", token = lx_get_token())

Arguments

selector

'LIFX' api "selector" such as "all", "id:12345", or "location:kitchen". Can be created with lx_selector or written manually (see https://api.developer.lifx.com/docs/selectors

token

API token (see ?lx_save_token). If left empty, the token is retrieved from the environmental variable if available. (see lx_save_token)

Value

a list with each item representing one light. Each item itself is a list with all relevant information about the light and it's state

Details

each item in the returned list contains (depending on the type of lamp), the following named items:

  • Reachability: connected, last_seen, seconds_since_seen

  • Light identifiers / selectors: id, uuid, label, group, location

  • Status: power, color, brightness, effect

  • Hardware information: product

Examples

Run this code
# NOT RUN {
lx_list_lights()

lights <- lx_list_lights(
  lx_selector(location = "kitchen")
)

first_kitchen_light <- lights[[1]]

first_kitchen_light$power
first_kitchen_light$color$hue
first_kitchen_light$color$saturation

first_kitchen_light$group

# }

Run the code above in your browser using DataLab