9 Commits

Author SHA1 Message Date
b43b27a17e Merge pull request 'Update Rust crate reqwest to 0.12.25' (#385) from renovate/reqwest-0.x into master
All checks were successful
continuous-integration/drone/push Build is passing
2025-12-12 00:37:06 +00:00
9a7cabe4a7 Update Rust crate reqwest to 0.12.25
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2025-12-10 00:36:45 +00:00
0d1baac2b7 Merge branch 'master' of ssh://gitea.communiquons.org:52001/pierre/SolarEnergy
All checks were successful
continuous-integration/drone/push Build is passing
2025-12-09 18:22:50 +01:00
eae781a613 Fix bad default value 2025-12-09 19:22:25 +01:00
ff47f86792 Can check if relay is online or not 2025-12-09 14:54:01 +01:00
8398bb17ed Fix dependencies conflict
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2025-12-09 14:00:02 +01:00
cfcb7a0ebb Merge branch 'master' of ssh://gitea.communiquons.org:52001/pierre/SolarEnergy
Some checks failed
continuous-integration/drone/push Build is failing
2025-12-09 13:55:10 +01:00
465477e862 Merge pull request 'Update dependency @typescript-eslint/eslint-plugin to ^8.49.0' (#384) from renovate/typescript-eslint-eslint-plugin-8.x into master
Some checks failed
continuous-integration/drone/push Build is failing
2025-12-09 00:36:12 +00:00
6075085b0b Update dependency @typescript-eslint/eslint-plugin to ^8.49.0
Some checks failed
renovate/artifacts Artifact file update failure
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
2025-12-09 00:36:02 +00:00
6 changed files with 435 additions and 386 deletions

View File

@@ -2615,9 +2615,9 @@ checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
[[package]]
name = "reqwest"
version = "0.12.24"
version = "0.12.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f"
checksum = "b6eff9328d40131d43bd911d42d79eb6a47312002a4daefc9e37f17e74a7701a"
dependencies = [
"base64 0.22.1",
"bytes",
@@ -3335,9 +3335,9 @@ dependencies = [
[[package]]
name = "tower-http"
version = "0.6.7"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cf146f99d442e8e68e585f5d798ccd3cad9a7835b917e09728880a862706456"
checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
dependencies = [
"bitflags",
"bytes",

View File

@@ -19,7 +19,7 @@ asn1 = "0.23.0"
actix-web = { version = "4.12.1", features = ["openssl"] }
futures = "0.3.31"
serde = { version = "1.0.228", features = ["derive"] }
reqwest = { version = "0.12.24", features = ["json"] }
reqwest = { version = "0.12.25", features = ["json"] }
serde_json = "1.0.145"
rand = "0.10.0-rc.5"
actix = "0.13.5"

View File

@@ -389,7 +389,7 @@ impl Handler<SynchronizeDevice> for EnergyActor {
pub struct ResDevState {
pub id: DeviceId,
last_ping: u64,
online: bool,
pub online: bool,
}
/// Get the state of devices

View File

@@ -64,6 +64,8 @@ pub async fn legacy_state(
pub struct FullRelayState {
/// Indicates if the relay (or its parent device) is enabled or not
enabled: bool,
/// Indicate if the device is online or not
online: bool,
/// Indicates if relay is on or off
is_on: bool,
/// Relay name
@@ -77,7 +79,7 @@ pub struct FullRelayState {
/// Required uptime during a day (in seconds)
daily_requirement: Option<usize>,
/// Forced relay state
relay_forced_state: RelayForcedState,
forced_state: RelayForcedState,
}
#[derive(serde::Serialize)]
@@ -96,6 +98,8 @@ pub async fn relays_full_state(energy_actor: WebEnergyActor) -> HttpResult {
let cached_consumption = energy_actor.send(energy_actor::GetCurrConsumption).await?;
let relays_consumption = energy_actor.send(energy_actor::RelaysConsumption).await?;
let curr_consumption = consumption::get_curr_consumption().await.ok();
let devices = energy_actor.send(energy_actor::GetDeviceLists).await?;
let devices_state = energy_actor.send(energy_actor::GetDevicesState).await?;
let mut relays = energy_actor.send(energy_actor::GetRelaysList).await?;
relays.sort_by_key(|r| -(r.priority as i64));
let relays_state = energy_actor.send(energy_actor::GetAllRelaysState).await?;
@@ -107,16 +111,26 @@ pub async fn relays_full_state(energy_actor: WebEnergyActor) -> HttpResult {
relays: relays
.into_iter()
.map(|r| {
let state = relays_state.iter().find(|s| s.id == r.id);
let device = devices
.iter()
.find(|d| d.relays.iter().any(|sr| sr.id == r.id))
.expect("All relay shall have an associated device!");
let device_state = devices_state.iter().find(|s| s.id == device.id);
let relay_state = relays_state.iter().find(|s| s.id == r.id);
let total_uptime = relay_state_history::relay_total_runtime_adjusted(&r);
FullRelayState {
enabled: r.enabled,
is_on: state.map(|s| s.on).unwrap_or(false),
enabled: r.enabled && device.enabled,
online: device_state.map(|d| d.online).unwrap_or(false),
is_on: relay_state.map(|s| s.on).unwrap_or(false),
name: r.name,
priority: r.priority,
r#for: state.map(|s| s.r#for).unwrap_or(0),
total_uptime: 0,
r#for: relay_state.map(|s| s.r#for).unwrap_or(0),
total_uptime,
daily_requirement: r.daily_runtime.map(|r| r.min_runtime),
relay_forced_state: state.map(|s| s.forced_state.clone()).unwrap_or_default(),
forced_state: relay_state
.map(|s| s.forced_state.clone())
.unwrap_or_default(),
}
})
.collect(),

File diff suppressed because it is too large Load Diff

View File

@@ -31,15 +31,15 @@
"@types/react": "^19.2.7",
"@types/react-dom": "^19.2.3",
"@types/semver": "^7.7.1",
"@typescript-eslint/eslint-plugin": "^8.48.1",
"@typescript-eslint/parser": "^8.48.1",
"@typescript-eslint/eslint-plugin": "^8.49.0",
"@typescript-eslint/parser": "^8.49.0",
"@vitejs/plugin-react": "^5.1.2",
"eslint": "^9.39.1",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.4.24",
"globals": "^16.5.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.48.1",
"typescript-eslint": "^8.49.0",
"vite": "^7.2.7"
}
}