diff --git a/package-lock.json b/package-lock.json
index abf6c85..0e25c26 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -42,7 +42,7 @@
"mui-tel-input": "^7.0.0",
"notistack": "^3.0.1",
"openweathermap-ts": "^1.2.10",
- "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#master",
+ "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#staging",
"query-string": "^9.2.1",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
@@ -10953,7 +10953,7 @@
},
"node_modules/protobuf-ts": {
"version": "1.0.0",
- "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#c08965a296f2cd0799472fd8b163186cf6885d4c",
+ "resolved": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#3f647071f211c4552c2acc23a8ecabb6904a4156",
"dependencies": {
"protobufjs": "^6.8.8"
}
diff --git a/package.json b/package.json
index ee0e9b7..fc7a1ac 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,7 @@
"mui-tel-input": "^7.0.0",
"notistack": "^3.0.1",
"openweathermap-ts": "^1.2.10",
- "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#master",
+ "protobuf-ts": "git+https://gitlab+deploy-token-50627:hv8mB4WkyvtjBpJKU1rN@gitlab.com/brandx/protobuf-ts.git#staging",
"query-string": "^9.2.1",
"react": "^18.3.1",
"react-beautiful-dnd": "^13.1.1",
diff --git a/src/device/DeviceWizard.tsx b/src/device/DeviceWizard.tsx
index 32387eb..cf0a061 100644
--- a/src/device/DeviceWizard.tsx
+++ b/src/device/DeviceWizard.tsx
@@ -141,6 +141,28 @@ export default function DeviceWizard(props: Props) {
)}
+ {selectedPort &&
+ selectedPort.addressType === quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY &&
+ device.featureSupported("detectOneWire") &&
+ selectedPort.autoDetectable && (
+
+
+
+ )}
{portComponents.length > 0 && (
Current Components
diff --git a/src/device/autoDetect/DeviceScannedComponents.tsx b/src/device/autoDetect/DeviceScannedComponents.tsx
index 0381281..2be89a9 100644
--- a/src/device/autoDetect/DeviceScannedComponents.tsx
+++ b/src/device/autoDetect/DeviceScannedComponents.tsx
@@ -7,9 +7,11 @@ import { useEffect, useState } from "react";
import ScannedI2C from "./ScannedI2C";
import ComponentForm from "component/ComponentForm";
import { Component, Device } from "models";
-import { DeviceAvailabilityMap, OffsetAvailabilityMap } from "pbHelpers/DeviceAvailability";
+import { DeviceAvailabilityMap, FindAvailablePositions, OffsetAvailabilityMap } from "pbHelpers/DeviceAvailability";
import ResponsiveDialog from "common/ResponsiveDialog";
import { useComponentAPI, useDeviceAPI, useSnackbar } from "hooks";
+import { ConfigurablePin } from "pbHelpers/AddressTypes";
+import ScannedOneWirePort from "./OneWire/ScannedOneWirePort";
interface Props {
scannedComponents: pond.ComponentAddressMap
@@ -31,17 +33,19 @@ export default function DeviceScannedComponents(props: Props){
const compAPI = useComponentAPI();
const deviceAPI = useDeviceAPI()
const [scannedI2C, setScannedI2C] = useState() //the unmodified scan of addresses
- const [validCompAddresses, setValidComponentAddresses] = useState([]) //the filtered array of address data
+ const [scannedOneWire, setScannedOneWire] = useState([])
+ const [validI2CCompAddresses, setValidI2CComponentAddresses] = useState([]) //the filtered array of address data
const [components, setComponents] = useState([])
const [steps, setSteps] = useState([]);
const { error, success } = useSnackbar();
const [currentStep, setCurrentStep] = useState(0)
const [settingsValid, setSettingsValid] = useState(false);
const [openDialog, setOpenDialog] = useState(false);
+ const [clearOpen, setClearOpen] = useState(false);
useEffect(()=>{
- //console.log(scannedComponents)
if (scannedComponents.i2c) setScannedI2C(scannedComponents.i2c)
+ if (scannedComponents.oneWire) setScannedOneWire(scannedComponents.oneWire)
//makes the array empty for testing
// if (scannedComponents.i2c) {
// let clone = cloneDeep(scannedComponents.i2c)
@@ -76,7 +80,7 @@ export default function DeviceScannedComponents(props: Props){
}
})
}
- setValidComponentAddresses(valid)
+ setValidI2CComponentAddresses(valid)
},[scannedI2C])
const stepper = () => {
@@ -200,11 +204,12 @@ export default function DeviceScannedComponents(props: Props){
})
})
}
+ console.log(cloneList)
setComponents(cloneList)
}
- const removeScan = (key: string) => {
- deviceAPI.removeFoundComponents(device.settings.deviceId, key)
+ const removeScan = (key: string, type: pond.ObjectType) => {
+ deviceAPI.removeFoundComponents(device.settings.deviceId, key, type)
.then(resp => {
console.log("Cleared this scan")
}).catch(err => {
@@ -212,20 +217,51 @@ export default function DeviceScannedComponents(props: Props){
})
}
+ const removeAllScans = () => {
+ deviceAPI.removeAllFoundComponents(device.settings.deviceId)
+ .then(resp => {
+ console.log("Cleared all scans")
+ refreshCallback()
+ }).catch(err => {
+ console.log("There was a problem clearing scans")
+ })
+ }
+
+ const clearWarning = () => {
+ return (
+ {setClearOpen(false)}}>
+ Clear All Scans
+ This action will clear all scans for this device.
+
+
+
+
+
+ )
+ }
+
return (
+ {clearWarning()}
+
+ Sensor Scan
+
+
{scannedI2C !== undefined &&
-
+
I2C Sensors
-
+
- {validCompAddresses.length > 0 ? validCompAddresses.map((addr, index) => {
+ {validI2CCompAddresses.length > 0 ? validI2CCompAddresses.map((addr, index) => {
return (
()}/>
)
@@ -240,7 +276,39 @@ export default function DeviceScannedComponents(props: Props){
}
-
+
+ }
+ {scannedOneWire.length > 0 &&
+
+
+
+ Pin Port Sensors
+
+
+ {scannedOneWire.map((scan,i) => {
+ let map = FindAvailablePositions([], device.settings.product).availability.get(quack.AddressType.ADDRESS_TYPE_CONFIGURABLE_PIN_ARRAY)
+ let portAddress = scan.settings?.oneWireData?.port
+ let portLabel = ""
+
+ map?.forEach(entry => {
+ let pin = entry as ConfigurablePin
+ if (pin.address && pin.address === portAddress) {
+ portLabel = pin.label
+ }
+ })
+ return(
+
+
+ Port: {portLabel}
+
+
+
+
+ )
+ })}
+
}
diff --git a/src/device/autoDetect/OneWire/PortComponent.tsx b/src/device/autoDetect/OneWire/PortComponent.tsx
new file mode 100644
index 0000000..b1e26e1
--- /dev/null
+++ b/src/device/autoDetect/OneWire/PortComponent.tsx
@@ -0,0 +1,150 @@
+import { Box, Checkbox, Grid2, MenuItem, TextField, Tooltip, Typography } from "@mui/material"
+import { useMobile } from "hooks"
+import { getFriendlyName, getSubtypes, Subtype } from "pbHelpers/ComponentType"
+import { quack } from "protobuf-ts/quack"
+import React, { useEffect, useState } from "react"
+
+interface Props {
+ compData: quack.OneWireComponentData
+ componentSelect: (selected: boolean, componentData: quack.OneWireComponentData) => void
+}
+
+export default function PortComponent(props: Props){
+ const {compData, componentSelect} = props
+ // const [selectedSubtype, setSelectedSubtype] = useState(0)
+ const [subtypeVal, setSubtypeVal] = useState("no subtype")//note that this is the friendly name and not the key or the value because it needs to be different from the other alias options
+ const [subtypeMap, setSubtypeMap] = useState