rship-govee 0.1.1

rship executor for controlling Govee smart home devices
Documentation
use anyhow::Result;
use std::env;

mod actions;
mod client;
mod service;

use service::GoveeService;

#[tokio::main]
async fn main() -> Result<()> {
    // Load environment variables
    dotenv::dotenv().ok();

    // Initialize logger
    env_logger::init();

    // Get configuration from environment
    let api_key = env::var("GOVEE_API_KEY").expect("GOVEE_API_KEY must be set");

    let rship_address = env::var("RSHIP_ADDRESS").expect("RSHIP_ADDRESS must be set");
    let rship_port: u16 = env::var("RSHIP_PORT")
        .expect("RSHIP_PORT must be set")
        .parse()
        .expect("Failed to parse RSHIP_PORT");

    log::info!("Starting rship-govee service");
    log::info!("Rship: {}:{}", rship_address, rship_port);

    // Create and start the service
    let service = GoveeService::new(api_key, rship_address, rship_port).await?;
    service.start().await?;

    Ok(())
}