made the react components to display the card for scanned components
This commit is contained in:
parent
f5bc230fb6
commit
751b39d345
14 changed files with 311 additions and 26 deletions
|
|
@ -555,10 +555,10 @@ const componentType: data = {
|
||||||
key: "COMPONENT_TYPE_CAPACITANCE",
|
key: "COMPONENT_TYPE_CAPACITANCE",
|
||||||
val: 24
|
val: 24
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
key: "COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT",
|
// key: "COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT", //this component type is deprecated?
|
||||||
val: 25
|
// val: 25
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
key: "COMPONENT_TYPE_WEIGHT",
|
key: "COMPONENT_TYPE_WEIGHT",
|
||||||
val: 26
|
val: 26
|
||||||
|
|
|
||||||
|
|
@ -414,7 +414,7 @@ export default function BinComponents(props: Props) {
|
||||||
)}
|
)}
|
||||||
<ListItemText inset={cIcon === undefined}>
|
<ListItemText inset={cIcon === undefined}>
|
||||||
<Grid container direction="row" justifyContent="space-between">
|
<Grid container direction="row" justifyContent="space-between">
|
||||||
<Grid >{comp.name()}</Grid>
|
<Grid >{comp.name() + " " + comp.addressDescription(devMap.get(device)?.settings.product)}</Grid>
|
||||||
<Grid >
|
<Grid >
|
||||||
{components?.get(comp.key()) !== undefined ? (
|
{components?.get(comp.key()) !== undefined ? (
|
||||||
<CheckBoxIcon />
|
<CheckBoxIcon />
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,8 @@ import {
|
||||||
import { GetDeviceProductIcon, GetDeviceProductLabel } from "products/DeviceProduct";
|
import { GetDeviceProductIcon, GetDeviceProductLabel } from "products/DeviceProduct";
|
||||||
import { pond } from "protobuf-ts/pond";
|
import { pond } from "protobuf-ts/pond";
|
||||||
import { quack } from "protobuf-ts/quack";
|
import { quack } from "protobuf-ts/quack";
|
||||||
import { useComponentAPI, useGlobalState, useSnackbar } from "providers";
|
import { useComponentAPI, useDeviceAPI, useGlobalState, useSnackbar } from "providers";
|
||||||
|
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import DeviceSVG, { PortInformation } from "./deviceSVG";
|
import DeviceSVG, { PortInformation } from "./deviceSVG";
|
||||||
import { makeStyles } from "@mui/styles";
|
import { makeStyles } from "@mui/styles";
|
||||||
|
|
@ -83,6 +84,8 @@ export default function DeviceWizard(props: Props) {
|
||||||
);
|
);
|
||||||
const classes = useStyles();
|
const classes = useStyles();
|
||||||
const [selectedPort, setSelectedPort] = useState<PortInformation>();
|
const [selectedPort, setSelectedPort] = useState<PortInformation>();
|
||||||
|
const deviceAPI = useDeviceAPI()
|
||||||
|
const { openSnack } = useSnackbar()
|
||||||
//const [addressType, setAddressType] = useState<quack.AddressType>(quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY);
|
//const [addressType, setAddressType] = useState<quack.AddressType>(quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY);
|
||||||
|
|
||||||
const wizardMenu = () => {
|
const wizardMenu = () => {
|
||||||
|
|
@ -118,6 +121,22 @@ export default function DeviceWizard(props: Props) {
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
{selectedPort && selectedPort.addressType === quack.AddressType.ADDRESS_TYPE_I2C && device.featureSupported("detectI2C") && (
|
||||||
|
<Tooltip title="Used to tell the Device to scan its I2C port for any plugged in sensors">
|
||||||
|
<MenuItem
|
||||||
|
key={"scanI2C"}
|
||||||
|
onClick={() => {
|
||||||
|
deviceAPI.detectI2C(device.id())
|
||||||
|
.then(resp => {
|
||||||
|
openSnack("Device will scan port on next check-in")
|
||||||
|
}).catch(err => {
|
||||||
|
openSnack("Command failed to send to device")
|
||||||
|
})
|
||||||
|
}}>
|
||||||
|
Scan Port
|
||||||
|
</MenuItem>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
{portComponents.length > 0 && (
|
{portComponents.length > 0 && (
|
||||||
<List>
|
<List>
|
||||||
<ListSubheader>Current Components</ListSubheader>
|
<ListSubheader>Current Components</ListSubheader>
|
||||||
|
|
|
||||||
93
src/device/autoDetect/DeviceScannedComponents.tsx
Normal file
93
src/device/autoDetect/DeviceScannedComponents.tsx
Normal file
|
|
@ -0,0 +1,93 @@
|
||||||
|
import { Box, Card, DialogContent, FormControlLabel, Radio, RadioGroup, Step, StepLabel, Stepper } from "@mui/material";
|
||||||
|
import { cloneDeep } from "lodash";
|
||||||
|
import { getSubtypes, Subtype } from "pbHelpers/ComponentType";
|
||||||
|
import { pond, quack } from "protobuf-ts/pond";
|
||||||
|
import React from "react";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import ScannedI2C from "./ScannedI2C";
|
||||||
|
import ComponentForm from "component/ComponentForm";
|
||||||
|
import { Component, Device } from "models";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
scannedComponents: pond.ComponentAddressMap
|
||||||
|
device: Device
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CompStep {
|
||||||
|
label: string;
|
||||||
|
completed?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function DeviceScannedComponents(props: Props){
|
||||||
|
const {scannedComponents, device} = props
|
||||||
|
const [scannedI2C, setScannedI2C] = useState<pond.DetectI2C>()
|
||||||
|
const [components, setComponents] = useState<Component[]>([])
|
||||||
|
const [steps, setSteps] = useState<CompStep[]>([]);
|
||||||
|
const [currentStep, setCurrentStep] = useState(0)
|
||||||
|
const [settingsValid, setSettingsValid] = useState(false);
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
if (scannedComponents.i2c) setScannedI2C(scannedComponents.i2c)
|
||||||
|
},[scannedComponents])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let steps: CompStep[] = []
|
||||||
|
components.forEach(comp => {
|
||||||
|
steps.push({
|
||||||
|
label: comp.name(),
|
||||||
|
completed: false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},[components])
|
||||||
|
|
||||||
|
const stepper = () => {
|
||||||
|
return (
|
||||||
|
<Stepper nonLinear activeStep={currentStep} style={{ width: "100%" }}>
|
||||||
|
{steps.map(compStep => {
|
||||||
|
const labelProps: {
|
||||||
|
optional?: React.ReactNode;
|
||||||
|
} = {};
|
||||||
|
return (
|
||||||
|
<Step key={compStep.label} completed={compStep.completed}>
|
||||||
|
<StepLabel {...labelProps}>{compStep.label}</StepLabel>
|
||||||
|
</Step>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Stepper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const addComponentContent = () => {
|
||||||
|
return (
|
||||||
|
<DialogContent>
|
||||||
|
{stepper()}
|
||||||
|
<ComponentForm
|
||||||
|
component={components[currentStep]}
|
||||||
|
canEdit
|
||||||
|
device={device}
|
||||||
|
componentChanged={(component, isValid) => {
|
||||||
|
components[currentStep].settings = component.settings;
|
||||||
|
setSettingsValid(isValid);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</DialogContent>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Card>
|
||||||
|
{scannedI2C &&
|
||||||
|
<React.Fragment>
|
||||||
|
<Box>I2C Components Found</Box>
|
||||||
|
{scannedI2C?.settings?.foundAddresses.map((addr, index) => {
|
||||||
|
return (
|
||||||
|
<ScannedI2C key={index} decimalAddress={addr} deviceProduct={device.settings.product} updateComponentList={()=>{}} />
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</React.Fragment>
|
||||||
|
}
|
||||||
|
</Card>
|
||||||
|
)
|
||||||
|
}
|
||||||
107
src/device/autoDetect/ScannedI2C.tsx
Normal file
107
src/device/autoDetect/ScannedI2C.tsx
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
import { Box, Button, FormControlLabel, MenuItem, Radio, RadioGroup, TextField } from "@mui/material";
|
||||||
|
import { getAddressTypes, getFriendlyName, getSubtypes, Subtype } from "pbHelpers/ComponentType";
|
||||||
|
import { GetProductAvailability } from "products/DeviceProduct";
|
||||||
|
import { pond } from "protobuf-ts/pond";
|
||||||
|
import { quack } from "protobuf-ts/quack";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
decimalAddress: number
|
||||||
|
deviceProduct: pond.DeviceProduct
|
||||||
|
updateComponentList: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ScannedI2C(props: Props){
|
||||||
|
const {decimalAddress, deviceProduct} = props
|
||||||
|
const [types, setTypes] = useState<quack.ComponentType[]>([])
|
||||||
|
const [subtypeOptions, setSubtypeOptions] = useState<Array<Subtype>>([])
|
||||||
|
const [selectedType, setSelectedType] = useState<quack.ComponentType>(quack.ComponentType.COMPONENT_TYPE_INVALID)
|
||||||
|
const [selectedSubtype, setSelectedSubtype] = useState(0)
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
//convert the address to hex
|
||||||
|
let hexAddress = parseInt(decimalAddress.toString(16))
|
||||||
|
hexAddress = 0x2a //hardcoding for testing
|
||||||
|
let types: quack.ComponentType[] = []
|
||||||
|
//find what component types use that address
|
||||||
|
let productAvailability = GetProductAvailability(deviceProduct)
|
||||||
|
if(productAvailability){
|
||||||
|
let i2cMap = productAvailability.get(quack.AddressType.ADDRESS_TYPE_I2C)
|
||||||
|
if(i2cMap){
|
||||||
|
i2cMap.forEach((val, key) => {
|
||||||
|
let addresses = val as number[] ?? []
|
||||||
|
if(addresses.length > 0 && addresses.includes(hexAddress)){
|
||||||
|
types.push(key)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//this if can be taken out if we dont want to select the first component type by default
|
||||||
|
if(types.length > 0) {
|
||||||
|
setSelectedType(types[0])
|
||||||
|
buildSubtypeOptions(types[0])
|
||||||
|
}
|
||||||
|
setTypes(types)
|
||||||
|
},[decimalAddress, deviceProduct])
|
||||||
|
|
||||||
|
const buildSubtypeOptions = (compType: quack.ComponentType) => {
|
||||||
|
let subtypes = getSubtypes(compType)
|
||||||
|
let validSub: Subtype[] = []
|
||||||
|
//have to exclude subtypes that are not I2C
|
||||||
|
subtypes.forEach((sub,i) => {
|
||||||
|
let addrTypes = getAddressTypes(compType, sub.key)
|
||||||
|
if (addrTypes.includes(quack.AddressType.ADDRESS_TYPE_I2C)){
|
||||||
|
validSub.push(sub)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//set the selected on to be the first in the valid selection
|
||||||
|
if(validSub.length > 0){
|
||||||
|
setSelectedSubtype(validSub[0].key)
|
||||||
|
}
|
||||||
|
setSubtypeOptions(validSub)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box>
|
||||||
|
Sensor 1
|
||||||
|
<RadioGroup
|
||||||
|
value={selectedType}
|
||||||
|
onChange={(_, value) => {
|
||||||
|
console.log(value)
|
||||||
|
let v = parseInt(value)
|
||||||
|
if (!isNaN(v)){
|
||||||
|
buildSubtypeOptions(v)
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
{types.map((type, i) => {
|
||||||
|
return (
|
||||||
|
<FormControlLabel
|
||||||
|
key={i}
|
||||||
|
value={type}
|
||||||
|
control={<Radio />}
|
||||||
|
label={getFriendlyName(type)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</RadioGroup>
|
||||||
|
{subtypeOptions.length > 0 &&
|
||||||
|
<TextField
|
||||||
|
value={selectedSubtype}
|
||||||
|
fullWidth
|
||||||
|
onChange={(event)=>{
|
||||||
|
let val = +event.target.value
|
||||||
|
console.log(event.target.value)
|
||||||
|
setSelectedSubtype(val)
|
||||||
|
}}
|
||||||
|
select>
|
||||||
|
{subtypeOptions.map(s => (
|
||||||
|
<MenuItem value={s.key}>{s.friendlyName}</MenuItem>
|
||||||
|
))}
|
||||||
|
</TextField>
|
||||||
|
}
|
||||||
|
<Button>Add Components</Button>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -3,6 +3,7 @@ import { quack } from "protobuf-ts/pond";
|
||||||
import { or } from "utils/types";
|
import { or } from "utils/types";
|
||||||
import { cloneDeep } from "lodash";
|
import { cloneDeep } from "lodash";
|
||||||
import { getSubtypes } from "pbHelpers/ComponentType";
|
import { getSubtypes } from "pbHelpers/ComponentType";
|
||||||
|
import { getFriendlyAddressTypeName, getHumanReadableAddress } from "pbHelpers/AddressType";
|
||||||
// import { getSubtypes } from "pbHelpers/ComponentType";
|
// import { getSubtypes } from "pbHelpers/ComponentType";
|
||||||
|
|
||||||
export class Component {
|
export class Component {
|
||||||
|
|
@ -105,4 +106,33 @@ export class Component {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public addressDescription = (deviceProduct?: pond.DeviceProduct) => {
|
||||||
|
if (
|
||||||
|
this.settings.addressType === quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY ||
|
||||||
|
(this.settings.addressType >= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET1 &&
|
||||||
|
this.settings.addressType <= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET100)
|
||||||
|
) {
|
||||||
|
let addressDescription = getHumanReadableAddress(
|
||||||
|
this.settings.addressType,
|
||||||
|
this.settings.type,
|
||||||
|
this.settings.address,
|
||||||
|
deviceProduct
|
||||||
|
);
|
||||||
|
if (addressDescription === "") {
|
||||||
|
addressDescription = "Internal";
|
||||||
|
}
|
||||||
|
let port = "Port: " + addressDescription;
|
||||||
|
let cableID = "";
|
||||||
|
if (
|
||||||
|
this.settings.addressType >= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET1 &&
|
||||||
|
this.settings.addressType <= quack.AddressType.ADDRESS_TYPE_PIN_OFFSET100
|
||||||
|
) {
|
||||||
|
cableID = "Cable: " + (this.settings.addressType - 8);
|
||||||
|
}
|
||||||
|
return port + " " + cableID;
|
||||||
|
} else {
|
||||||
|
return getFriendlyAddressTypeName(this.settings.addressType);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,21 @@ const featureVersions: Map<string, FeatureVersionByPlatform> = new Map([
|
||||||
v2CellBlue: "2.0.44",
|
v2CellBlue: "2.0.44",
|
||||||
v2EthBlue: "2.0.44"
|
v2EthBlue: "2.0.44"
|
||||||
}
|
}
|
||||||
|
],[
|
||||||
|
"detectI2C",
|
||||||
|
{
|
||||||
|
photon: "NA",
|
||||||
|
electron: "NA",
|
||||||
|
v2Wifi: "2.1.6",
|
||||||
|
v2Cell: "2.1.6",
|
||||||
|
v2WifiS3: "2.1.6",
|
||||||
|
v2CellS3: "2.1.6",
|
||||||
|
v2CellBlack: "2.1.6",
|
||||||
|
v2CellGreen: "2.1.6",
|
||||||
|
v2WifiBlue: "2.1.6",
|
||||||
|
v2CellBlue: "2.1.6",
|
||||||
|
v2EthBlue: "2.1.6"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
export class Device {
|
export class Device {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Button, Divider, List, ListItem, Typography } from "@mui/material";
|
import { Button, Card, Divider, List, ListItem, Typography } from "@mui/material";
|
||||||
import Grid from '@mui/material/Grid2';
|
import Grid from '@mui/material/Grid2';
|
||||||
import { Component, Device, Interaction, User } from "models";
|
import { Component, Device, Interaction, User } from "models";
|
||||||
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
|
import { getContextKeys, getContextTypes } from "pbHelpers/Context";
|
||||||
|
|
@ -20,6 +20,7 @@ import { isController } from "pbHelpers/ComponentType";
|
||||||
import { or } from "utils";
|
import { or } from "utils";
|
||||||
import ComponentDiagnostics from "component/ComponentDiagnostics";
|
import ComponentDiagnostics from "component/ComponentDiagnostics";
|
||||||
import DeviceWizard from "device/DeviceWizard";
|
import DeviceWizard from "device/DeviceWizard";
|
||||||
|
import DeviceScannedComponents from "device/autoDetect/DeviceScannedComponents";
|
||||||
|
|
||||||
export interface DevicePageData {
|
export interface DevicePageData {
|
||||||
device: Device;
|
device: Device;
|
||||||
|
|
@ -56,6 +57,7 @@ export default function DevicePage() {
|
||||||
|
|
||||||
const [components, setComponents] = useState<Map<string, Component>>(new Map());
|
const [components, setComponents] = useState<Map<string, Component>>(new Map());
|
||||||
const [diagnosticComponents, setDiagnosticComponents] = useState<Component[]>([]);
|
const [diagnosticComponents, setDiagnosticComponents] = useState<Component[]>([]);
|
||||||
|
const [scannedAddresses, setScannedAddresses] = useState<pond.ComponentAddressMap | undefined>(undefined)
|
||||||
// const [components, setComponents] = useState<Component[]>([]);
|
// const [components, setComponents] = useState<Component[]>([]);
|
||||||
|
|
||||||
const [addComponentManualDialogOpen, setAddComponentManualDialogOpen] = useState(false)
|
const [addComponentManualDialogOpen, setAddComponentManualDialogOpen] = useState(false)
|
||||||
|
|
@ -162,8 +164,19 @@ export default function DevicePage() {
|
||||||
.finally(() => setLoading(false));
|
.finally(() => setLoading(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const loadPortScan = () => {
|
||||||
|
deviceAPI.listFoundComponents(device.id())
|
||||||
|
.then(resp => {
|
||||||
|
setScannedAddresses(resp.data.foundComponents ?? undefined)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadDevice()
|
loadDevice()
|
||||||
|
loadPortScan()
|
||||||
}, [deviceID, as])
|
}, [deviceID, as])
|
||||||
|
|
||||||
const toggleNotificationPreference = () => {
|
const toggleNotificationPreference = () => {
|
||||||
|
|
@ -404,7 +417,7 @@ export default function DevicePage() {
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Grid size={{ xs: 6, sm: 6, lg: 4, xl: 3 }} >
|
<Grid size={{ xs: 6, sm: 6, lg: 4, xl: 4 }} >
|
||||||
<DeviceWizard
|
<DeviceWizard
|
||||||
device={device}
|
device={device}
|
||||||
//permissions={permissions}
|
//permissions={permissions}
|
||||||
|
|
@ -412,10 +425,16 @@ export default function DevicePage() {
|
||||||
refreshCallback={loadDevice}
|
refreshCallback={loadDevice}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid size={{ xs: 6, sm: 6, lg: 8, xl: 9 }} >
|
{scannedAddresses &&
|
||||||
<Grid container direction="row" spacing={2}>
|
<Grid size={{ xs: 6, sm: 6, lg: 4, xl: 4 }}>
|
||||||
|
<DeviceScannedComponents scannedComponents={scannedAddresses} device={device}/>
|
||||||
|
</Grid>
|
||||||
|
}
|
||||||
|
{diagnosticComponents.length > 0 &&
|
||||||
|
<Grid size={{ xs: 6, sm: 6, lg: 4, xl: 4 }}>
|
||||||
|
<Grid container direction="row" spacing={2} width={"100%"}>
|
||||||
{diagnosticComponents.map(comp => (
|
{diagnosticComponents.map(comp => (
|
||||||
<Grid size={{ sm: 12, lg: 6, xl: 4 }} key={comp.key()}>
|
<Grid size={12} key={comp.key()}>
|
||||||
<ComponentDiagnostics
|
<ComponentDiagnostics
|
||||||
component={comp}
|
component={comp}
|
||||||
device={device}
|
device={device}
|
||||||
|
|
@ -425,6 +444,7 @@ export default function DevicePage() {
|
||||||
))}
|
))}
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export const I2C: AddressTypeExtension = {
|
||||||
[quack.ComponentType.COMPONENT_TYPE_STEPPER_MOTOR, 0x13],
|
[quack.ComponentType.COMPONENT_TYPE_STEPPER_MOTOR, 0x13],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_PH, 0x3f],
|
[quack.ComponentType.COMPONENT_TYPE_PH, 0x3f],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, 0x3f],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, 0x3f],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, 0x3f],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, 0x3f], //component type deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CAPACITANCE, 0x4f],
|
[quack.ComponentType.COMPONENT_TYPE_CAPACITANCE, 0x4f],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE, 0x4f],
|
[quack.ComponentType.COMPONENT_TYPE_CAPACITOR_CABLE, 0x4f],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, 0x68],
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, 0x68],
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ const DefaultAvailability: DeviceAvailabilityMap = new Map<quack.AddressType, De
|
||||||
[quack.ComponentType.COMPONENT_TYPE_STEPPER_MOTOR, [0x14, 0x15, 0x16, 0x17]],
|
[quack.ComponentType.COMPONENT_TYPE_STEPPER_MOTOR, [0x14, 0x15, 0x16, 0x17]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_PH, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_PH, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40, 0x61]], //TODO temp fix, needs to be fixed to use channels similar to PH
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40, 0x61]], //TODO temp fix, needs to be fixed to use channels similar to PH
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_AIR_QUALITY, [0x58]],
|
[quack.ComponentType.COMPONENT_TYPE_AIR_QUALITY, [0x58]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CAPACITANCE, [0x50]],
|
[quack.ComponentType.COMPONENT_TYPE_CAPACITANCE, [0x50]],
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ export const BindaptPlusAvailability: DeviceAvailabilityMap = new Map<
|
||||||
new Map<quack.ComponentType, number[]>([
|
new Map<quack.ComponentType, number[]>([
|
||||||
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
||||||
|
|
@ -48,7 +48,7 @@ export const BindaptPlusModAvailability: DeviceAvailabilityMap = new Map<
|
||||||
new Map<quack.ComponentType, number[]>([
|
new Map<quack.ComponentType, number[]>([
|
||||||
//[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
//[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
||||||
|
|
@ -78,10 +78,11 @@ export const BindaptPlusProAvailability: DeviceAvailabilityMap = new Map<
|
||||||
new Map<quack.ComponentType, number[]>([
|
new Map<quack.ComponentType, number[]>([
|
||||||
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]],
|
||||||
|
[quack.ComponentType.COMPONENT_TYPE_AIRFLOW, [0x2a]]
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
[quack.AddressType.ADDRESS_TYPE_POWER, [0]],
|
[quack.AddressType.ADDRESS_TYPE_POWER, [0]],
|
||||||
|
|
@ -109,7 +110,7 @@ export const BindaptPlusProModAvailability: DeviceAvailabilityMap = new Map<
|
||||||
new Map<quack.ComponentType, number[]>([
|
new Map<quack.ComponentType, number[]>([
|
||||||
//[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
//[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
||||||
|
|
@ -136,7 +137,7 @@ export const BindaptPlusLiteAvailability: DeviceAvailabilityMap = new Map<
|
||||||
new Map<quack.ComponentType, number[]>([
|
new Map<quack.ComponentType, number[]>([
|
||||||
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
||||||
|
|
@ -192,7 +193,7 @@ export const BindaptUltimateAvailability: DeviceAvailabilityMap = new Map<
|
||||||
new Map<quack.ComponentType, number[]>([
|
new Map<quack.ComponentType, number[]>([
|
||||||
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
||||||
|
|
@ -219,7 +220,7 @@ export const BinMonitorAvailability: DeviceAvailabilityMap = new Map<
|
||||||
new Map<quack.ComponentType, number[]>([
|
new Map<quack.ComponentType, number[]>([
|
||||||
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]]
|
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]]
|
||||||
])
|
])
|
||||||
|
|
@ -248,7 +249,7 @@ export const BindaptV2MonitorAvailability: DeviceAvailabilityMap = new Map<
|
||||||
new Map<quack.ComponentType, number[]>([
|
new Map<quack.ComponentType, number[]>([
|
||||||
//[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
//[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
||||||
|
|
@ -280,7 +281,7 @@ export const BindaptV2AutomateAvailability: DeviceAvailabilityMap = new Map<
|
||||||
new Map<quack.ComponentType, number[]>([
|
new Map<quack.ComponentType, number[]>([
|
||||||
//[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
//[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
[quack.ComponentType.COMPONENT_TYPE_CO2, [0x61]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ const Weather: DeviceProductDescriber = {
|
||||||
new Map<quack.ComponentType, number[]>([
|
new Map<quack.ComponentType, number[]>([
|
||||||
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]]
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]]
|
||||||
])
|
])
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export const NexusSTAvailability: DeviceAvailabilityMap = new Map<
|
||||||
new Map<quack.ComponentType, number[]>([
|
new Map<quack.ComponentType, number[]>([
|
||||||
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
[quack.ComponentType.COMPONENT_TYPE_PRESSURE, [0x18]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
[quack.ComponentType.COMPONENT_TYPE_DHT, [0x40]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]],
|
// [quack.ComponentType.COMPONENT_TYPE_VAPOUR_PRESSURE_DEFICIT, [0x40]], //component type deprecated?
|
||||||
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
[quack.ComponentType.COMPONENT_TYPE_LIDAR, [0x62]],
|
||||||
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
[quack.ComponentType.COMPONENT_TYPE_SEN5X, [0x69]]
|
||||||
])
|
])
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ export interface IDeviceAPIContext {
|
||||||
) => Promise<AxiosResponse<pond.GetDevicePageDataResponse>>;
|
) => Promise<AxiosResponse<pond.GetDevicePageDataResponse>>;
|
||||||
getMulti: (ids: number[] | string[], otherTeam?: string) => Promise<AxiosResponse<pond.GetMultiDeviceResponse>>;
|
getMulti: (ids: number[] | string[], otherTeam?: string) => Promise<AxiosResponse<pond.GetMultiDeviceResponse>>;
|
||||||
detectI2C: (id: number, otherTeam?: string) => Promise<AxiosResponse<pond.DetectI2CResponse>>;
|
detectI2C: (id: number, otherTeam?: string) => Promise<AxiosResponse<pond.DetectI2CResponse>>;
|
||||||
listFoundComponents: (is: number, otherTeam?: string) => Promise<AxiosResponse<pond.ListFoundComponentsResponse>>
|
listFoundComponents: (id: number, otherTeam?: string) => Promise<AxiosResponse<pond.ListFoundComponentsResponse>>
|
||||||
getGeoJson: (id: number | string, demo?: boolean, otherTeam?: string) => Promise<any>;
|
getGeoJson: (id: number | string, demo?: boolean, otherTeam?: string) => Promise<any>;
|
||||||
getMultiGeoJson: (ids: number[] | string[], otherTeam?: string) => Promise<any>;
|
getMultiGeoJson: (ids: number[] | string[], otherTeam?: string) => Promise<any>;
|
||||||
list: (
|
list: (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue