added button to send down the onewire scan request

This commit is contained in:
csawatzky 2025-10-30 16:49:00 -06:00
parent 33eb4e6eca
commit c5a3487db0
8 changed files with 89 additions and 11 deletions

View file

@ -23,6 +23,7 @@ export interface IDeviceAPIContext {
) => Promise<AxiosResponse<pond.GetDevicePageDataResponse>>;
getMulti: (ids: number[] | string[], otherTeam?: string) => Promise<AxiosResponse<pond.GetMultiDeviceResponse>>;
detectI2C: (id: number, otherTeam?: string) => Promise<AxiosResponse<pond.DetectI2CResponse>>;
detectOneWire: (id: number, port: number, otherTeam?: string) => Promise<AxiosResponse<pond.DetectOneWireResponse>>
listFoundComponents: (id: number, otherTeam?: string) => Promise<AxiosResponse<pond.ListFoundComponentsResponse>>
getGeoJson: (id: number | string, demo?: boolean, otherTeam?: string) => Promise<any>;
getMultiGeoJson: (ids: number[] | string[], otherTeam?: string) => Promise<any>;
@ -962,6 +963,19 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
})
}
const detectOneWire = (id: number, port: number, otherTeam?: string) => {
let url = "/devices/" + id + "/detectOneWire?port=" + port;
const view = otherTeam ? otherTeam : as
if(view) url = url + "?as=" + view
return new Promise<AxiosResponse<pond.DetectOneWireResponse>>((resolve, reject) => {
put<pond.DetectOneWireResponse>(pondURL(url)).then(resp => {
return resolve(resp)
}).catch(err => {
return reject(err)
})
})
}
const listFoundComponents = (id: number, otherTeam?: string) => {
let url = "/devices/" + id + "/listScannedComponents";
const view = otherTeam ? otherTeam : as
@ -1035,6 +1049,7 @@ export default function DeviceProvider(props: PropsWithChildren<Props>) {
updateComponentPreferences,
listDeviceComponentPreferences,
detectI2C,
detectOneWire,
listFoundComponents,
removeFoundComponents
}}>