Struct razberry::RazberryClient
[−]
[src]
pub struct RazberryClient { pub last_update: Option<DateTime<UTC>>, // some fields omitted }
Razberry Z-Wave gateway client. Polls the Razberry HTTP endpoint for updates on devices.
Fields
last_update: Option<DateTime<UTC>>
The last time Z-wave device updates were successfully polled. Timestamp is that of the Razberry endpoint (not the program's CPU time).
Methods
impl RazberryClient
[src]
fn for_hostname(hostname: &str) -> Result<RazberryClient, ParseError>
Construct a client from hostname, using the default port.
fn new(hostname: &str, port: u32) -> Result<RazberryClient, ParseError>
Construct a client from hostname and port.
fn set_session_token(&mut self, credential: Option<String>)
Set the session for the cookie manually.
fn get_session_token(&self) -> Option<String>
Get the session token.
fn set_read_timeout(&mut self, timeout: Option<Duration>)
Set HTTP client read timeout.
fn set_write_timeout(&mut self, timeout: Option<Duration>)
Set HTTP client write timeout.
fn login(&mut self, username: &str, password: &str) -> Result<(), RazberryError>
Peform a login. If the attempt is successful, store the session token.
fn load_devices(&mut self) -> Result<(), RazberryError>
Query the initial data payload for devices (the bare /Data endpoint).
fn poll_updates(&mut self) -> Result<(), RazberryError>
Poll the /Data/{time} endpoint for updates.
fn get_devices(&self) -> Vec<&Device>
Get devices that have been loaded by the client.
fn fetch_gateway_state(&self) -> Result<GatewayState, RazberryError>
Get a full data dump of the state of the Razberry gateway and all of its associated devices.
fn update_gateway_state(
&self,
gateway_state: &mut GatewayState
) -> Result<(), RazberryError>
&self,
gateway_state: &mut GatewayState
) -> Result<(), RazberryError>
Get an updated view of the state of the Razberry gateway. This fetches any state changes since the last fetch or update and patches the delta into the 'GatewayState' object.
fn get_data(&self) -> Result<DataResponse, RazberryError>
XXX: DEPRECATED. Get a full data dump of the state of the Razberry server and all of its associated devices.
fn get_data_after(&self, timestamp: i64) -> Result<DataResponse, RazberryError>
XXX: DEPRECATED. Get a partial data dump of the state changes to the Razberry server and associated devices that occurred after the provided timestamp.
fn get_server_timestamp(&self) -> Result<DataResponse, RazberryError>
XXX: DEPRECATED. Fastest way to look up the server timestamp. Calls the data endpoint with an invalid timestamp.
fn fetch_data(
&self,
timestamp: Option<i64>
) -> Result<DataResponse, RazberryError>
&self,
timestamp: Option<i64>
) -> Result<DataResponse, RazberryError>
XXX: DEPRECATED. Do lookup at the data endpoint.