Fix API regression
This commit is contained in:
parent
36c0e28f02
commit
ef2583e537
@ -20,6 +20,8 @@
|
|||||||
"power_bias_watts": 3000.0,
|
"power_bias_watts": 3000.0,
|
||||||
"monophase_volts": 240,
|
"monophase_volts": 240,
|
||||||
"polling_interval": 15,
|
"polling_interval": 15,
|
||||||
|
"current_min": 7,
|
||||||
|
"current_max": 16,
|
||||||
"p": 0.2,
|
"p": 0.2,
|
||||||
"i": 0.1,
|
"i": 0.1,
|
||||||
"d": 0
|
"d": 0
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
use std::ops::Range;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json;
|
use serde_json;
|
||||||
@ -36,6 +38,8 @@ pub struct Regulator {
|
|||||||
pub power_bias_watts: f64,
|
pub power_bias_watts: f64,
|
||||||
pub monophase_volts: f64,
|
pub monophase_volts: f64,
|
||||||
pub polling_interval: u64,
|
pub polling_interval: u64,
|
||||||
|
pub current_min: f64,
|
||||||
|
pub current_max: f64,
|
||||||
pub p: f64,
|
pub p: f64,
|
||||||
pub i: f64,
|
pub i: f64,
|
||||||
pub d: f64,
|
pub d: f64,
|
||||||
|
@ -71,12 +71,12 @@ pub fn start(
|
|||||||
|
|
||||||
if let Some(reg) = config.regulator {
|
if let Some(reg) = config.regulator {
|
||||||
let circuit = ctx
|
let circuit = ctx
|
||||||
.sites_details()?
|
.sites()?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.find(|s| s.site.id == reg.site_id)
|
.find(|s| s.id == reg.site_id)
|
||||||
.ok_or(anyhow!("Invalid site id {}", reg.site_id))?
|
.ok_or(anyhow!("Invalid site id {}", reg.site_id))?
|
||||||
.circuits
|
.details(&mut ctx)?
|
||||||
.into_iter()
|
.circuits.into_iter()
|
||||||
.find(|c| c.id == reg.circuit_id)
|
.find(|c| c.id == reg.circuit_id)
|
||||||
.ok_or(anyhow!("Invalid circuit id {}", reg.circuit_id))?;
|
.ok_or(anyhow!("Invalid circuit id {}", reg.circuit_id))?;
|
||||||
|
|
||||||
|
@ -163,12 +163,12 @@ fn main() -> Result<()> {
|
|||||||
match args.mode {
|
match args.mode {
|
||||||
Mode::Login => login()?,
|
Mode::Login => login()?,
|
||||||
Mode::List => {
|
Mode::List => {
|
||||||
for site in ctx.sites_details()? {
|
for site in ctx.sites()? {
|
||||||
println!(
|
println!(
|
||||||
"Site {} (level {})",
|
"Site {} (level {})",
|
||||||
site.site.id, site.site.level_of_access
|
site.id, site.level_of_access
|
||||||
);
|
);
|
||||||
for circuit in site.circuits {
|
for circuit in site.details(&mut ctx)?.circuits {
|
||||||
println!(" Circuit {} ({}A)", circuit.id, circuit.rated_current);
|
println!(" Circuit {} ({}A)", circuit.id, circuit.rated_current);
|
||||||
for charger in circuit.chargers {
|
for charger in circuit.chargers {
|
||||||
println!("Charger {} (level {}", charger.id, charger.level_of_access);
|
println!("Charger {} (level {}", charger.id, charger.level_of_access);
|
||||||
|
Loading…
Reference in New Issue
Block a user