Struct philipshue::bridge::Bridge
[−]
[src]
pub struct Bridge { /* fields omitted */ }
The bridge connection
Methods
impl Bridge
[src]
fn new<S: Into<String>, U: Into<String>>(ip: S, username: U) -> Self
Creates a Bridge
on the given IP with the given username
fn get_ip(&self) -> &str
Gets the IP of bridge
fn get_username(&self) -> &str
Gets the username this Bridge
uses
fn get_all_lights(&self) -> Result<Map<usize, Light>, HueError>
Gets all lights that are connected to the bridge
fn get_light(&self, id: usize) -> Result<Light, HueError>
Gets the light with the specific id
fn get_new_lights(&self) -> Result<Map<usize, Light>, HueError>
Gets all the light that were found last time a search for new lights was done
fn search_for_new_lights(&self) -> Result<Vec<HueResponse<Value>>, HueError>
Makes the bridge search for new lights (and switches).
The found lights can be retrieved with get_new_lights()
fn set_light_state(&self,
id: usize,
command: &LightCommand)
-> Result<Vec<HueResponse<Value>>, HueError>
id: usize,
command: &LightCommand)
-> Result<Vec<HueResponse<Value>>, HueError>
Sets the state of a light by sending a LightCommand
to the bridge for this light
fn rename_light(&self,
id: usize,
name: String)
-> Result<Vec<HueResponse<Value>>, HueError>
id: usize,
name: String)
-> Result<Vec<HueResponse<Value>>, HueError>
Renames the light
fn delete_light(&self, id: usize) -> Result<Vec<HueResponse<Value>>, HueError>
Deletes a light from the bridge
fn get_all_groups(&self) -> Result<Map<usize, Group>, HueError>
Gets all groups of the bridge
fn create_group(&self,
name: String,
lights: Vec<usize>,
group_type: GroupType,
room_class: Option<RoomClass>)
-> Result<usize, HueError>
name: String,
lights: Vec<usize>,
group_type: GroupType,
room_class: Option<RoomClass>)
-> Result<usize, HueError>
Creates a group and returns the ID of the group
fn get_group_attributes(&self, id: usize) -> Result<Group, HueError>
Gets extra information about a specific group
fn set_group_attributes(&self,
id: usize,
attr: &GroupCommand)
-> Result<Vec<HueResponse<Value>>, HueError>
id: usize,
attr: &GroupCommand)
-> Result<Vec<HueResponse<Value>>, HueError>
Set the name, light and class of a group
fn set_group_state(&self,
id: usize,
state: &LightCommand)
-> Result<Vec<HueResponse<Value>>, HueError>
id: usize,
state: &LightCommand)
-> Result<Vec<HueResponse<Value>>, HueError>
Sets the state of all lights in the group.
ID 0 is a sepcial group containing all lights known to the bridge
fn delete_group(&self, id: usize) -> Result<Vec<HueResponse<Value>>, HueError>
Deletes the specified group
It's not allowed to delete groups of type LightSource
or Luminaire
.