import React from 'react' import {ConfiguredDevicesCollection, PlantTypesCollection} from "../../client/main"; import {useTracker} from 'meteor/react-meteor-data'; import { Table } from "react-bootstrap"; import Settings from "./Settings"; export default function Home() { // Return all documents of the configuredDevices collection. const configuredDevices = useTracker(() => { return ConfiguredDevicesCollection.find().fetch(); }); // Return the soil type of the given plant type. function getSoil(type) { const plantType = PlantTypesCollection.findOne({plantType: type}); return plantType.dirtType } // Return the permanent wilting point of the given plant type. function getPermWilPoint(type) { const plantType = PlantTypesCollection.findOne({plantType: type}); return plantType.data.soilMoisture.pwp } // Return the field capacity of the given plant type. function getFieldCap(type) { const plantType = PlantTypesCollection.findOne({plantType: type}); return plantType.data.soilMoisture.fc } // Return the minimal temperature of the given plant type. function getMinTemp(type) { const plantType = PlantTypesCollection.findOne({plantType: type}); return plantType.data.temperature.minTemp } // Return the maximal temperature of the given plant type. function getMaxTemp(type) { const plantType = PlantTypesCollection.findOne({plantType: type}); return plantType.data.temperature.maxTemp } // Return the minimal lux value of the given plant type. function getMinLux(type) { const plantType = PlantTypesCollection.findOne({plantType: type}); return plantType.data.light.minLux } return ( <> {configuredDevices.map((device, index) => { return })}
# Device Nickname Device ID Plant Type Soil Type Mode Permanent Wilting Point Field Capacity Min Temperature Max Temperature Min Brightness
{index} {device.alias} {device.deviceId} {device.type} {getSoil(device.type)} {device.mode} {getPermWilPoint(device.type) + " %"} {getFieldCap(device.type) + " %"} {getMinTemp(device.type) + " °C"} {getMaxTemp(device.type) + " °C"} {getMinLux(device.type) + " lux"}


If your device is not visible in the table above, configure it here below.





) }