Make payload for MQTT more readable.
This commit is contained in:
parent
8d8461f471
commit
83c94a9755
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user