Struct hust::bridge::Bridge [−][src]
An object to communicate with a bridge.
The struct attributes contain the static properties of the bridge.
The methods can be used for communication like commands.
Fields
url_base: String
The base URL of the bridge, which all /api/
resources are below of.
device: BridgeDevice
The device properties of this bridge.
Implementations
impl Bridge
[src]
pub fn from_description_url(url: String) -> Result<Bridge>
[src]
Creates a Bridge object from a description URL like returned in SSDP discovery.
pub fn user_readable_identifier(&self) -> &str
[src]
The unique but user-friendly name of the bridge.
pub fn register_user(&self) -> Result<String>
[src]
Registers a user and return its name.
Save it to communicate further with the bridge, e.g. to switch lights.
Note that the button of the bridge has to be pressed.
pub fn modify_light<T: Serialize>(
&self,
user: &str,
light: &str,
key: &str,
value: T
) -> Result<()>
[src]
&self,
user: &str,
light: &str,
key: &str,
value: T
) -> Result<()>
Set an attribute of a light.
user
is the user you had to register with register_user
.
light
is the identifier of the light. All identifiers can
be obtained by listing the HashMap keys of get_all_lights
.
key
can be any attribute of crate::lights::LightState
.
pub fn get_all_lights(&self, user: &str) -> Result<HashMap<String, Light>>
[src]
List all lights connected to this bridge
The listed lights are bundled with their state. You have to specify a user in order to be authenticated.
pub fn switch_light(&self, user: &str, light: &str, on: bool) -> Result<()>
[src]
Switch light on / off.
user
is the user you had to register with register_user
.
light
is the identifier of the light. All identifiers can
be obtained by listing the HashMap keys of get_all_lights
.
To switch the light off, specify on
as false
.
Trait Implementations
impl Debug for Bridge
[src]
impl<'de> Deserialize<'de> for Bridge
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Bridge
[src]
Auto Trait Implementations
impl RefUnwindSafe for Bridge
impl Send for Bridge
impl Sync for Bridge
impl Unpin for Bridge
impl UnwindSafe for Bridge
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,