Merge branch 'master' into 3d_bin
This commit is contained in:
commit
f72aeb802f
8 changed files with 50 additions and 40 deletions
|
|
@ -1159,7 +1159,7 @@ export default function BinVisualizer(props: Props) {
|
|||
<BindaptIcon />
|
||||
</Avatar>
|
||||
<Box textAlign="center" width={"85%"}>
|
||||
<Link href="https://www.bindapt.com/bins/">View Smart Bin Devices</Link>
|
||||
<Typography>No Plenums found</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ export default function DeviceScannedComponents(props: Props){
|
|||
let valid: quack.AddressData[] = []
|
||||
//filter the address data
|
||||
let addr = scannedI2C?.settings?.foundAddresses
|
||||
console.log(addr)
|
||||
if(addr){
|
||||
addr.forEach(addrData => {
|
||||
if(!i2cBlacklistAddresses.includes(addrData.address)){
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ interface Props {
|
|||
ambient?: Component
|
||||
start: Moment;
|
||||
end: Moment;
|
||||
multiGraphZoom?: (domain: number[] | string[]) => void;
|
||||
}
|
||||
|
||||
export default function GateDeltaTempGraph(props: Props){
|
||||
|
|
@ -28,7 +29,8 @@ export default function GateDeltaTempGraph(props: Props){
|
|||
ambient,
|
||||
deviceID,
|
||||
start,
|
||||
end
|
||||
end,
|
||||
multiGraphZoom
|
||||
} = props
|
||||
const [data, setData] = useState<SSAreaDataPoint[]>([])
|
||||
const [{user}] = useGlobalState()
|
||||
|
|
@ -110,7 +112,6 @@ export default function GateDeltaTempGraph(props: Props){
|
|||
end.toISOString(),
|
||||
500
|
||||
).then(resp => {
|
||||
console.log(resp)
|
||||
if(resp.data.measurements){
|
||||
let tempCompMeasurements = resp.data.measurements.map(um => UnitMeasurement.any(um, user));
|
||||
//if there is an ambient component, then treat the temp component like a single sensor and not a chain, and use the ambient measurements as the inlet
|
||||
|
|
@ -211,13 +212,14 @@ export default function GateDeltaTempGraph(props: Props){
|
|||
/>
|
||||
<SingleSetAreaChart
|
||||
data={data}
|
||||
minY={-40} //-40C is the same as -40F
|
||||
maxY={(user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? 104 : 40)}
|
||||
minY={(user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? -40 : -20)}
|
||||
maxY={(user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? 40 : 20)}
|
||||
tooltipLabel="Delta Temp"
|
||||
tooltipUnit={user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? " °F" : " °C"}
|
||||
yAxisLabel={"Delta T" + (user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? " °F" : " °C")}
|
||||
colourAboveZero={{colour: warmingColour, label: "Heating"}}
|
||||
colourBelowZero={{colour: coolingColour, label: "Cooling"}}/>
|
||||
colourBelowZero={{colour: coolingColour, label: "Cooling"}}
|
||||
multiGraphZoom={multiGraphZoom}/>
|
||||
</Card>
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import { Gate } from "models/Gate";
|
|||
import moment, { Moment } from "moment";
|
||||
import { pond } from "protobuf-ts/pond";
|
||||
import { useGateAPI, useGlobalState } from "providers";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
|
||||
interface Props {
|
||||
gate: Gate;
|
||||
|
|
@ -25,7 +25,6 @@ interface Props {
|
|||
ambient?: string;
|
||||
newXDomain?: number[] | string[];
|
||||
pressureComponent?: string;
|
||||
// setPCAState: (state: boolean) => void;
|
||||
multiGraphZoom?: (domain: number[] | string[]) => void;
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +54,6 @@ export default function GateFlowGraph(props: Props) {
|
|||
device,
|
||||
ambient,
|
||||
pressureComponent,
|
||||
// setPCAState,
|
||||
start,
|
||||
end,
|
||||
newXDomain,
|
||||
|
|
@ -74,12 +72,13 @@ export default function GateFlowGraph(props: Props) {
|
|||
const eventThreshold = 5; //the threshold that if crossed from one measurement to the next during a flow event will end the current flow event and start a new one
|
||||
//const idleFlow = 3.5; //the mass air flow that must be crossed in order to start a flow event, anything below this will not start an event but must go below this to end an event
|
||||
const [idleFlow, setIdleFlow] = useState(3.5)
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
const loadData = useCallback(()=>{
|
||||
if (loadingChartData) return;
|
||||
if (ambient && pressureComponent) {
|
||||
let gateIdle = idleFlow
|
||||
if(gate.settings.idleFlow){
|
||||
setIdleFlow(gate.settings.idleFlow)
|
||||
gateIdle = gate.settings.idleFlow
|
||||
}
|
||||
|
||||
|
|
@ -131,22 +130,17 @@ export default function GateFlowGraph(props: Props) {
|
|||
}
|
||||
});
|
||||
setRuntime(moment.duration(runtime));
|
||||
// let state = false;
|
||||
// if (
|
||||
// data.length > 1 &&
|
||||
// data[data.length - 1].value > gate.lowerFlow() &&
|
||||
// data[data.length - 1].value < gate.upperFlow()
|
||||
// ) {
|
||||
// state = true;
|
||||
// }
|
||||
// setPCAState(state);
|
||||
}
|
||||
setFlowData(data);
|
||||
setLoadingChartData(false);
|
||||
setRecent(recent);
|
||||
});
|
||||
}
|
||||
}, [gateAPI, gate, ambient, pressureComponent, start, end, device, as]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
},[gateAPI, gate, ambient, pressureComponent, start, end, device, as])
|
||||
|
||||
useEffect(() => {
|
||||
loadData()
|
||||
}, [loadData]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
const loadFlowEvents = () => {
|
||||
if (ambient && pressureComponent) {
|
||||
|
|
|
|||
|
|
@ -101,16 +101,22 @@ export default function GateGraphs(props: Props) {
|
|||
});
|
||||
}, [gate, endDate, gateAPI, startDate, as]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
const updateDateRange = (newStartDate: any, newEndDate: any) => {
|
||||
let range = GetDefaultDateRange();
|
||||
range.start = newStartDate;
|
||||
range.end = newEndDate;
|
||||
const updateDateRange = (newStartDate: moment.Moment, newEndDate: moment.Moment) => {
|
||||
setStartDate(newStartDate);
|
||||
setEndDate(newEndDate);
|
||||
};
|
||||
|
||||
const zoomGraphs = (domain: string[] | number[]) => {
|
||||
setZoomed(true)
|
||||
if((domain[0] && !isNaN(parseInt(domain[0] as string))) && (domain[1] && !isNaN(parseInt(domain[1] as string)))){
|
||||
updateDateRange(moment(domain[0]),moment(domain[1]))
|
||||
}
|
||||
}
|
||||
|
||||
const zoomOut = () => {
|
||||
setXDomain(["dataMin", "dataMax"]);
|
||||
let d = GetDefaultDateRange()
|
||||
setStartDate(d.start)
|
||||
setEndDate(d.end)
|
||||
setZoomed(false);
|
||||
};
|
||||
|
||||
|
|
@ -175,8 +181,7 @@ export default function GateGraphs(props: Props) {
|
|||
tooltip
|
||||
newXDomain={xDomain}
|
||||
multiGraphZoom={domain => {
|
||||
setXDomain(domain);
|
||||
setZoomed(true);
|
||||
zoomGraphs(domain)
|
||||
}}
|
||||
multiGraphZoomOut
|
||||
/>
|
||||
|
|
@ -239,8 +244,7 @@ export default function GateGraphs(props: Props) {
|
|||
tooltip
|
||||
newXDomain={xDomain}
|
||||
multiGraphZoom={domain => {
|
||||
setXDomain(domain);
|
||||
setZoomed(true);
|
||||
zoomGraphs(domain)
|
||||
}}
|
||||
multiGraphZoomOut
|
||||
/>
|
||||
|
|
@ -250,7 +254,6 @@ export default function GateGraphs(props: Props) {
|
|||
|
||||
const graphHeader = (comp: Component) => {
|
||||
const componentIcon = GetComponentIcon(comp.settings.type, comp.settings.subtype, themeType);
|
||||
console.log(comp)
|
||||
let measurement = cloneDeep(comp.status.measurement)
|
||||
let umArray = measurement.map(um => UnitMeasurement.create(um, user))
|
||||
return (
|
||||
|
|
@ -356,17 +359,22 @@ export default function GateGraphs(props: Props) {
|
|||
gate={gate}
|
||||
ambient={ambient}
|
||||
pressureComponent={pressure}
|
||||
// setPCAState={(state: boolean) => {
|
||||
// setPCAState(state);
|
||||
// }}
|
||||
multiGraphZoom={domain => {
|
||||
setXDomain(domain);
|
||||
setZoomed(true);
|
||||
zoomGraphs(domain)
|
||||
}}
|
||||
/>
|
||||
{/* add a new chart here for the delta temp over time */}
|
||||
{tempComp &&
|
||||
<GateDeltaTempGraph deviceID={device} start={startDate} end={endDate} tempComponent={tempComp} ambient={ambientComp}/>
|
||||
<GateDeltaTempGraph
|
||||
deviceID={device}
|
||||
start={startDate}
|
||||
end={endDate}
|
||||
tempComponent={tempComp}
|
||||
ambient={ambientComp}
|
||||
multiGraphZoom={domain => {
|
||||
zoomGraphs(domain)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
</Box>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -272,7 +272,12 @@ export default function GateList(props: Props) {
|
|||
// cellStyle: {width: 100000},
|
||||
// sortKey: "state",
|
||||
render: gate => {
|
||||
const deviceStateHelper = getDeviceStateHelper(gate.status.pcaDeviceState);
|
||||
let deviceStateHelper = getDeviceStateHelper(pond.DeviceState.DEVICE_STATE_UNKNOWN);
|
||||
if(moment().isAfter(moment(gate.status.deviceStateExpires).add(1, 'hour'))){
|
||||
deviceStateHelper = getDeviceStateHelper(pond.DeviceState.DEVICE_STATE_MISSING)
|
||||
}else{
|
||||
deviceStateHelper = getDeviceStateHelper(gate.status.pcaDeviceState)
|
||||
}
|
||||
return (
|
||||
<Box className={classes.cellContainer}>
|
||||
<Tooltip title={deviceStateHelper.description}>{deviceStateHelper.icon}</Tooltip>
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ export default function NewObjectInteraction(props: Props){
|
|||
|
||||
const conditionGroup = (condition: pond.InteractionCondition, index: number) => {
|
||||
let measurementType = condition.measurementType;
|
||||
let describer = describeMeasurement(measurementType, newAlertComponentType);
|
||||
let describer = describeMeasurement(measurementType, newAlertComponentType, undefined, undefined, user);
|
||||
let isBoolean = condition.measurementType === Measurement.boolean;
|
||||
return (
|
||||
<React.Fragment key={index}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue