From 185078961483ec6896b75f480898426bdd35c9fa Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Wed, 29 Nov 2023 18:08:45 +0100 Subject: [PATCH] Convert to workspace project --- Cargo.toml | 14 +++++--------- hms2mqtt/Cargo.toml | 18 ++++++++++++++++++ build.rs => hms2mqtt/build.rs | 0 {src => hms2mqtt/src}/home_assistant.rs | 0 {src => hms2mqtt/src}/home_assistant_config.rs | 0 {src => hms2mqtt/src}/inverter.rs | 0 {src => hms2mqtt/src}/lib.rs | 2 +- {src => hms2mqtt/src}/metric_collector.rs | 0 {src => hms2mqtt/src}/mqtt_config.rs | 0 {src => hms2mqtt/src}/mqtt_wrapper.rs | 0 {src => hms2mqtt/src}/protos/RealData.proto | 0 {src => hms2mqtt/src}/protos/mod.rs | 0 {src => hms2mqtt/src}/simple_mqtt.rs | 0 src/main.rs | 10 +++++----- src/rumqttc_wrapper.rs | 7 +++---- 15 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 hms2mqtt/Cargo.toml rename build.rs => hms2mqtt/build.rs (100%) rename {src => hms2mqtt/src}/home_assistant.rs (100%) rename {src => hms2mqtt/src}/home_assistant_config.rs (100%) rename {src => hms2mqtt/src}/inverter.rs (100%) rename {src => hms2mqtt/src}/lib.rs (100%) rename {src => hms2mqtt/src}/metric_collector.rs (100%) rename {src => hms2mqtt/src}/mqtt_config.rs (100%) rename {src => hms2mqtt/src}/mqtt_wrapper.rs (100%) rename {src => hms2mqtt/src}/protos/RealData.proto (100%) rename {src => hms2mqtt/src}/protos/mod.rs (100%) rename {src => hms2mqtt/src}/simple_mqtt.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 28527e59..5ec17164 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,19 +3,15 @@ name = "hms-mqtt-publish" version = "0.2.0" edition = "2021" +[workspace] + [dependencies] +anyhow = "1.0.75" chrono = "0.4.31" -crc16 = "0.4.0" env_logger = "0.10.1" +hms2mqtt = { path = "hms2mqtt" } log = "0.4.20" -protobuf = "3.3.0" rumqttc = "0.23.0" serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -hostname = "0.3.1" -toml = "0.8.8" serde_derive = "1.0.193" -anyhow = "1.0.75" - -[build-dependencies] -protobuf-codegen = "3.3.0" +toml = "0.8.8" diff --git a/hms2mqtt/Cargo.toml b/hms2mqtt/Cargo.toml new file mode 100644 index 00000000..cc163531 --- /dev/null +++ b/hms2mqtt/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "hms2mqtt" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +anyhow = "1.0.75" +crc16 = "0.4.0" +log = "0.4.20" +protobuf = "3.3.0" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +serde_derive = "1.0.193" + +[build-dependencies] +protobuf-codegen = "3.3.0" diff --git a/build.rs b/hms2mqtt/build.rs similarity index 100% rename from build.rs rename to hms2mqtt/build.rs diff --git a/src/home_assistant.rs b/hms2mqtt/src/home_assistant.rs similarity index 100% rename from src/home_assistant.rs rename to hms2mqtt/src/home_assistant.rs diff --git a/src/home_assistant_config.rs b/hms2mqtt/src/home_assistant_config.rs similarity index 100% rename from src/home_assistant_config.rs rename to hms2mqtt/src/home_assistant_config.rs diff --git a/src/inverter.rs b/hms2mqtt/src/inverter.rs similarity index 100% rename from src/inverter.rs rename to hms2mqtt/src/inverter.rs diff --git a/src/lib.rs b/hms2mqtt/src/lib.rs similarity index 100% rename from src/lib.rs rename to hms2mqtt/src/lib.rs index c2170e2b..80194282 100644 --- a/src/lib.rs +++ b/hms2mqtt/src/lib.rs @@ -1,5 +1,5 @@ -pub mod home_assistant; pub mod home_assistant_config; +pub mod home_assistant; pub mod inverter; pub mod metric_collector; pub mod mqtt_config; diff --git a/src/metric_collector.rs b/hms2mqtt/src/metric_collector.rs similarity index 100% rename from src/metric_collector.rs rename to hms2mqtt/src/metric_collector.rs diff --git a/src/mqtt_config.rs b/hms2mqtt/src/mqtt_config.rs similarity index 100% rename from src/mqtt_config.rs rename to hms2mqtt/src/mqtt_config.rs diff --git a/src/mqtt_wrapper.rs b/hms2mqtt/src/mqtt_wrapper.rs similarity index 100% rename from src/mqtt_wrapper.rs rename to hms2mqtt/src/mqtt_wrapper.rs diff --git a/src/protos/RealData.proto b/hms2mqtt/src/protos/RealData.proto similarity index 100% rename from src/protos/RealData.proto rename to hms2mqtt/src/protos/RealData.proto diff --git a/src/protos/mod.rs b/hms2mqtt/src/protos/mod.rs similarity index 100% rename from src/protos/mod.rs rename to hms2mqtt/src/protos/mod.rs diff --git a/src/simple_mqtt.rs b/hms2mqtt/src/simple_mqtt.rs similarity index 100% rename from src/simple_mqtt.rs rename to hms2mqtt/src/simple_mqtt.rs diff --git a/src/main.rs b/src/main.rs index 7f34c58f..41718462 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,11 +4,11 @@ mod logging; mod rumqttc_wrapper; -use hms_mqtt_publish::home_assistant::HomeAssistant; -use hms_mqtt_publish::inverter::Inverter; -use hms_mqtt_publish::metric_collector::MetricCollector; -use hms_mqtt_publish::mqtt_config; -use hms_mqtt_publish::simple_mqtt::SimpleMqtt; +use hms2mqtt::home_assistant::HomeAssistant; +use hms2mqtt::inverter::Inverter; +use hms2mqtt::metric_collector::MetricCollector; +use hms2mqtt::mqtt_config; +use hms2mqtt::simple_mqtt::SimpleMqtt; use mqtt_config::MqttConfig; use rumqttc_wrapper::RumqttcWrapper; use serde_derive::Deserialize; diff --git a/src/rumqttc_wrapper.rs b/src/rumqttc_wrapper.rs index 4a95ec34..dfb02bfb 100644 --- a/src/rumqttc_wrapper.rs +++ b/src/rumqttc_wrapper.rs @@ -1,11 +1,10 @@ -use anyhow::Ok; -use hms_mqtt_publish::{ +use std::{thread, time::Duration}; + +use hms2mqtt::{ mqtt_config::MqttConfig, mqtt_wrapper::{self}, }; use rumqttc::{Client, MqttOptions}; -use std::thread; -use std::time::Duration; pub struct RumqttcWrapper { client: Client,