Rust bindings for the Philips Hue API.
Licensed under the MIT License.
Rust bindings for the Philips Hue API
License: MIT License
Rust bindings for the Philips Hue API.
Licensed under the MIT License.
Currently the only way to create a Action
is by setting all the attributes manually. For example:
use huelib::resource::{Action, ActionRequestType};
let mut map = std::collections::HashMap::new();
map.insert("on", true);
let action = Action {
address: "/api/<username>/lights/<id>/state",
request_type: ActionRequestType::Put,
body: map,
};
This can be simplified with functions for modifying, creating and deleting which automatically generate the attributes.
For example, the modify
function would need the username, an identifier, a resource type, and a modifier:
use huelib::resource::{light, Action, Modifier, ResourceType};
let action = Action::modify(
"<username>",
"<id>",
ResourceType::Light,
light::StateModifier::new().on(true),
);
Some attributes in the sensor::State
struct are missing due to incomplete documentation in the Sensors API.
There exists a lot of crates out there for interacting with the Phillips Hue API, and I was wondering if you could give a comparison of this crate in relation to those?
In particular, I'm interested in your opinion on hueclient
and philipshue
.
Thanks!
Hue bridges have an endpoint at <bridge_ip>/description.xml
that allows retrieving meta data about the bridge.
It would be nice if that meta data was accessible through this library. Especially the UDN/UUID field might be useful to check whether a bridge has changed its IP address.
Instead of only being able to change the color of a light with color space coordinates it should also be possible to use RGB or HEX values.
This could be done by introducing a new Color
enum with the variants SpaceCoordinates
, Rgb
, and Hex
. The color_space_coordinates
functions of Modifiers could then be replaced by a color
function with the Color
enum as parameter.
The Rust Guidelines recommend that common traits should be implemented where applicable. This crate currently implements all those traits except for Hash
. The Hash
trait can be implemented easily by using #[derive(Hash)]
.
Hello,
I encountered an error when attempting to create a new resource link, it was rejecting the attribute "class_id" as unknown, and started working once I renamed this field to "classid" instead.
Add tests for serializing Modifiers/Creators and generating colors.
Some variants in the light::SoftwareUpdateState
enum are missing due to incomplete documentation in the Lights API. This can prevent deserialization of Light
and return a ParseJson
error.
Add support for connecting to the bridge via the Remote API.
Hi,
How can I turn a scene on / off ?
I tried
use huelib::resource::scene::LightStateModifier;
use huelib::{bridge, Bridge};
fn main() {
let bridge_ip = bridge::discover().unwrap().pop().unwrap();
let user = bridge::User {
name: String::from("username"),
clientkey: None,
};
let bridge = Bridge::new(bridge_ip, &user.name);
let m: LightStateModifier = huelib::resource::Modifier::new();
m.on(true);
bridge.set_scene("scene_id", m);
}
But bridge::set_scene
does not accept a LightStateModifier
:
error[E0308]: mismatched types
--> src/main.rs:16:32
|
16 | bridge.set_scene("scene_id", m);
| ^ expected `&huelib::resource::scene::Modifier`, found struct `huelib::resource::scene::LightStateModifier`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.