3

I cannot find how to send command to my Tasmota DHT11 device via MQTT Broker.

I'm using mqtt.js library in Nodejs.

var mqtt = require('mqtt');
var topic = 'cmnd/tasmota_E30D62/';
var client = mqtt.connect('mqtt://localhost:1883');

client.on('connect', function(){

    //subscription to topic
    client.subscribe(topic, function(){
        client.on('message', function(topic, message, packet){
            console.log('Received ' + message + ' on topic ' + topic);
        });
    });

    //publish a message to topic
    client.publish(topic, '', function(){
        console.log('message is published');
        client.end();
    })
})

I can see that the message is going to my MQTT broker, and then send to the right topic. I can see that in the Tasmota Console.

In the Tasmota Console, if I run 'Status 10', I got the data I'm targeting. When I run my NodeJS script including the same message, I got the log :

MQT: stat/tasmota_E30D62/RESULT = {"Command":"Unknown"}

So what message, should I send to get the data from my Tasmota sensor as an answer in my NodeJS ?

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.