This commit is contained in:
Mateusz Gruszczyński
2026-09-16 16:56:13 +02:00
parent 143ff0d272
commit 1862fed87f
27 changed files with 1368 additions and 178 deletions
+9 -1
View File
@@ -1,7 +1,11 @@
use crate::models::HomeAssistantSettings;
use anyhow::{anyhow, bail, Context, Result};
use serde_json::Value;
use std::{env, time::Duration};
use std::{
env,
net::{IpAddr, Ipv4Addr},
time::Duration,
};
use url::Url;
const SUPERVISOR_AUTH_ENV: &str = "GREE_CONTROLLER_HA_AUTH";
@@ -22,6 +26,10 @@ pub fn supervisor_token_detected() -> bool {
.unwrap_or(false)
}
pub fn is_supervisor_ingress_peer(peer: IpAddr) -> bool {
supervisor_token_detected() && peer == IpAddr::V4(Ipv4Addr::new(172, 30, 32, 2))
}
pub fn uses_supervisor_auth(settings: &HomeAssistantSettings) -> bool {
supervisor_detected() && !settings.manual_auth_override
}