diff --git a/imports/ui/Settings.jsx b/imports/ui/Settings.jsx index 756e96f..f052f9b 100644 --- a/imports/ui/Settings.jsx +++ b/imports/ui/Settings.jsx @@ -52,13 +52,13 @@ export default function Settings() { const handleTest = (e) => { var payload = ""; - if (selectedType === "Vegetables") {payload = JSON.stringify(payloadVegi);} - if (selectedType === "Cacti") {payload = JSON.stringify(payloadCacti);} - if (selectedType === "Flowers") {payload = JSON.stringify(payloadFlower);} + if (selectedType === "Vegetables") {payload = JSON.stringify(payloadVegi.data.soilMoisture);} + if (selectedType === "Cacti") {payload = JSON.stringify(payloadCacti.data.soilMoisture);} + if (selectedType === "Flowers") {payload = JSON.stringify(payloadFlower.data.soilMoisture);} if ((payload === "") || (selectedEspName === undefined) || (selectedType === undefined)) {alert("No device or type selected!");} else { Meteor.call('mqttPublish', { - topic: 'smartgarden/commands/' + selectedEspName, + topic: 'smartgarden/commands/' + selectedEspName + '/soil', payload: payload }, (err, res) => { if (err) {