Pierre-Gilles Leymarie
21 décembre 2020
Asynconf, 19h30
Le logiciel de domotique open-source qui respecte votre vie privée.
@pierregillesl
Twitter: @pierregillesl
const mqtt = require('mqtt');
const client = mqtt.connect('mqtt://IP_ADDRESS_OF_THE_BROKER', {
username: 'gladys',
password: 'my-password'
});
const TOPIC_NAME = "gladys/master/device/mqtt:sensor/feature/mqtt:temperature/state"
client.on('connect', () => {
// sending a new temperature of 12°C recorded
client.publish(TOPIC_NAME, 12);
});
Twitter: @pierregillesl