MyNixOS website logo
Description

R Interface to the Philips Hue API.

Control Philips Hue smart lighting. Use this package to connect to a Hue bridge on your local network (remote authentication not yet supported) and control your smart lights through the Philips Hue API. All API V1 endpoints are supported. See API documentation at <https://developers.meethue.com/>.

Open PhilipsHue documentation site

PhilipsHue: an R client for the Philips Hue API

pipeline status coverage report

The Philips Hue API provides fine-grained control over your Hue lighting system, and the PhilipsHue package for R aims to simplify making requests to the API and processing responses. The package provides wrappers for all V1 endpoints using local authentication; remote authentication is not supported.

Installation

Install directly from GitHub with:

devtools::install_github("fascinatingfingers/PhilipsHue")
library(PhilipsHue)

Getting started

To connect to your Hue Bridge, you'll need to discover the Bridge IP address and create a username. See vignette("local_authentication") for more detailed instructions. Once you have these values, you can use auth_local() to save them as environment variables.

auth_local(ip = "999.999.999.999", username = "<Philips Hue username>")

Here are some examples of what you can do once you've set your credentials.

# # Delete and re-add all lights (Warning!)
# purrr::map_lgl(names(get_lights()), delete_light)
# search_for_new_lights()
# get_new_lights()

# Rename a light
rename_light("1", "Table lamp")

# Create a room
group_id <- create_group(
    name = "Living room",
    type = "Room",
    class = "Living room",
    lights = as.character(1:4)
)

# Define a scene
scene_id <- create_scene("Default", as.character(1:4))
purrr::map_lgl(
    as.character(1:4),
    set_scene_lightstate, scene_id = scene_id,
    on = TRUE, bri = 134, ct = 316
)

# Configure a switch to turn on the scene
sensor_id <- 42
create_rule(
    name = "Living room - Default",
    conditions = list(
        condition(sprintf("/sensors/%s/state/buttonevent", sensor_id), "eq", "1002"),
        condition(sprintf("/sensors/%s/state/lastupdated", sensor_id), "dx")
    ),
    actions = list(
        action(sprintf("/groups/%s/action", group_id), "PUT", scene = scene_id)
    )
)
Metadata

Version

1.0.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows