<commit_before>var SensorTag = require('sensortag');
var mqtt = require('mqtt');

var client  = mqtt.connect('mqtt://');
var deviceID = [
    {"uuid":"b0b448c04303", "ovassid":"12015112820", "secret":"************"},
    {"uuid":"b0b448bc4d00", "ovassid":"12015112818", "secret":"************"},
    {"uuid":"b0b448c04305", "ovassid":"12015112865", "secret":"************"},
    {"uuid":"b0b448c08c02", "ovassid":"12015112892", "secret":"************"},
    {"uuid":"b0b448bcd003", "ovassid":"12015112885", "secret":"************"},
];

client.on('connect', function(){
    for (i in deviceID){
        client.subscribe('devices/' + deviceID[i].ovassid + '/down');
    }
});

client.on('message', function(topic, message){
    console.log(message.toString());
});

function publish(device, data){
    console.log(device);
    console.log(data);
}

function onDiscover(device) {
    console.log('Discovered device with UUID: ' + device['uuid']);

    device.connect(function(){
        connected = true;
        console.log('Connected To Sensor Tag');
        device.discoverServicesAndCharacteristics(function(callback){
            initAirSensors();
            initAccelAndGyro();
        });
    });

    device.on('disconnect', function(onDisconnect) {
        connected = false;
        client.end();
        console.log('Device disconnected.');
    });

    function initAccelAndGyro() {
        device.enableAccelerometer();<commit_msg>Added publishing at device dictionary<commit_after>var SensorTag = require('sensortag');
var mqtt = require('mqtt');

var client  = mqtt.connect('mqtt://');
var deviceID = [
    {"uuid":"b0b448c04303", "ovassid":"12015112820", "secret":"************"},
    {"uuid":"b0b448bc4d00", "ovassid":"12015112818", "secret":"************"},
    {"uuid":"b0b448c04305", "ovassid":"12015112865", "secret":"************"},
    {"uuid":"b0b448c08c02", "ovassid":"12015112892", "secret":"************"},
    {"uuid":"b0b448bcd003", "ovassid":"12015112885", "secret":"************"},
];

client.on('connect', function(){
    for (i in deviceID){
        client.subscribe('devices/' + deviceID[i].ovassid + '/down');
    }
});

client.on('message', function(topic, message){
    console.log(message.toString());
});

function publish(device, data){
    console.log(device.uuid);
    console.log(data);
    for (i in deviceID){
        if (deviceID[i].uuid = device.uuid){
            client.publish('devices/' + deviceID[i].ovassid + '/down', data);
        }
    }
}

function onDiscover(device) {
    console.log('Discovered device with UUID: ' + device['uuid']);

    device.connect(function(){
        connected = true;
        console.log('Connected To Sensor Tag');
        device.discoverServicesAndCharacteristics(function(callback){
            initAirSensors();
            initAccelAndGyro();
        });
    });

    device.on('disconnect', function(onDisconnect) {
        connected = false;
        client.end();
        console.log('Device disconnected.');
    });

    function initAccelAndGyro() {
        device.enableAccelerometer();
{'fraction_non_alphanumeric': 0.22215004871711594, 'fraction_numerical': 0.06170834686586554, 'mean_word_length': 3.888888888888889, 'pattern_counts': {'":': 30, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4053054', 'n_tokens_mistral': 1080, 'n_tokens_neox': 973, 'n_words': 156}