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<BTreeMap<usize, Light>>
Gets all lights that are connected to the bridge
fn get_light(&self, id: usize) -> Result<Light>
Gets the light with the specific id
fn get_new_lights(&self) -> Result<BTreeMap<usize, Light>>
Gets all the light that were found last time a search for new lights was done
fn search_for_new_lights(&self) -> Result<SuccessVec>
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<SuccessVec>
&self,
id: usize,
command: &LightCommand
) -> Result<SuccessVec>
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<SuccessVec>
Renames the light
fn delete_light(&self, id: usize) -> Result<SuccessVec>
Deletes a light from the bridge
fn get_all_groups(&self) -> Result<BTreeMap<usize, Group>>
Gets all groups of the bridge
fn create_group(
&self,
name: String,
lights: Vec<usize>,
group_type: GroupType,
room_class: Option<RoomClass>
) -> Result<usize>
&self,
name: String,
lights: Vec<usize>,
group_type: GroupType,
room_class: Option<RoomClass>
) -> Result<usize>
Creates a group and returns the ID of the group
fn get_group_attributes(&self, id: usize) -> Result<Group>
Gets extra information about a specific group
fn set_group_attributes(
&self,
id: usize,
attr: &GroupCommand
) -> Result<SuccessVec>
&self,
id: usize,
attr: &GroupCommand
) -> Result<SuccessVec>
Set the name, light and class of a group
fn set_group_state(&self, id: usize, state: &LightCommand) -> Result<SuccessVec>
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<String>>
Deletes the specified group
It's not allowed to delete groups of type LightSource
or Luminaire
.
fn get_configuration(&self) -> Result<Configuration>
Returns detailed information about the configuration of the bridge.
fn modify_configuration(
&self,
command: &ConfigurationModifier
) -> Result<SuccessVec>
&self,
command: &ConfigurationModifier
) -> Result<SuccessVec>
Sets some configuration values.
fn delete_user(&self, username: &str) -> Result<Vec<String>>
Deletes the specified user removing them from the whitelist.
fn get_full_state(&self) -> Result<FullState>
Fetches the entire datastore from the bridge.
This is a resource intensive command for the bridge, and should therefore be used sparingly.
fn recall_scene_in_group(
&self,
group_id: usize,
scene_id: &str
) -> Result<SuccessVec>
&self,
group_id: usize,
scene_id: &str
) -> Result<SuccessVec>
Sets the state of lights in the group to the state in the scene
Note that this will affect that are both in the group and in the scene. Using group 0 will set all the lights in the scene, since group 0 is a special group that contains all lights
fn get_all_scenes(&self) -> Result<BTreeMap<String, Scene>>
Gets all scenes of the bridge
fn create_scene(&self, scene: &SceneCreater) -> Result<String>
Creates a scene on the bridge and returns the ID of the created scene.
fn modify_scene(&self, id: &str, scene: &SceneModifier) -> Result<SuccessVec>
Sets general things in the specified scene
fn set_light_state_in_scene(
&self,
scene_id: &str,
light_id: usize,
state: &LightStateChange
) -> Result<SuccessVec>
&self,
scene_id: &str,
light_id: usize,
state: &LightStateChange
) -> Result<SuccessVec>
Sets the light state of the specified ID that is stored in the scene
fn delete_scene(&self, id: &str) -> Result<Vec<String>>
Deletes the specified scene
fn get_scene_with_states(&self, id: &str) -> Result<Scene>
Gets the scene with the specified ID with its lightstates