Hive Client
The Hive Client crate provides a client for interfacing Hive smart home systems.
Usage
[]
= "0.0.1"
Capabilities
- Authenticate with Hive.
- Setup trusted devices in a Hive account.
- Request live Weather information directly from Hive.
- List Quick Actions configured in a Hive account.
- Activate Quick Actions on demand.
- List Devices associated with a Hive account (Hubs, Thermostats, Hubs, etc).
- List Products currently running in a Hive account.
- Change state of Products in a Hive account (Boost heating/hot water, change target temperature, etc).
Examples
More in-depth examples can be found in documentation comments on the Client methods.
Trigger a Quick Action
use ;
let client = new.await;
let trusted_device = Some;
let attempt = client.login.await;
if let Ok = attempt
Set Target Temperature of Heating
use ;
use ;
let client = new.await;
let trusted_device = Some;
let attempt = client.login.await;
if let Ok = attempt
Retrieve Current Weather
use ;
use ;
let client = new.await;
let trusted_device = Some;
let attempt = client.login.await;
if let Ok = attempt
Contributing
There are tons of features which could be added to the crate. If you'd like to contribute, please feel free to open an issue or a pull request.
Examples of features which could be added:
- Better parity between the Hive API and the structs.
- Support for controlling Holiday Mode.
- Support for modifying the schedule of a Hive Device.
- Support for other Hive products (e.g. Hive Lights, Smart Plugs, Motion Sensors, etc).
Testing
Many of the tests require that an AWS Cognito User Pool, configured with SRP authentication and device tracking, be available to act as a mock server.
The setup of a suitable User Pool is fully automated with Terraform (see the infrastructure folder).
Set up
In order to setup the test environment, Terraform needs to be installed and AWS credentials need to be configured locally.
Once this is done, running apply should setup the Terraform backend, and the user pool and app client in the correct state:
# Setup state backend
&& &&
# Setup user pool
&& &&
After the user pool is set up, multiple environment variables need to be set in a .env file.
The .env file can be created by using .env.example as a template:
Running tests
The tests can be run with:
Tear down
The test environment can be torn down at any point with:
&&