<commit_before>var input = require('./input');

var node = new (require('./../node'))();
node.start('home.sensors', 'occupancy', function () {
  node.addProperty('people_home',  'number', 0);
  node.addProperty('people_awake', 'number', 0);

  var people = [
    {name: 'Daniel', laptops: ['28:CF:E9:5A:26:41'], phones: ['F8:A9:D0:0E:E1:31']},
    {name: 'Raynes', laptops: [                   ], phones: ['04:F7:E4:14:C6:A4']}
  ];
  var lHome = 0, lAwake = 0;

  var refresh = function () {
    input.getStations(function (stations) {
      var home = 0, awake = 0;

      var macs = stations.map(function (station) {
        return station[0];
      });

      people.forEach(function (person) {
        var state = 0;

        person.phones.forEach(function (mac) {
          if (macs.indexOf(mac) != -1) state = 1;
        });
        person.laptops.forEach(function (mac) {
          if (macs.indexOf(mac) != -1) state = 2;
        });

        if (state > 0) home++;
        if (state > 1) awake++;
      });

      if (home != lHome)
        node.setProperty('people_home',  home);
      if (awake != lAwake)
        node.setProperty('people_awake', awake);

      lHome = home;
      lAwake = awake;
    });
  };

  setInterval(refresh, 2500);
  refresh();
});
<commit_msg>Add a laptop for Raynes<commit_after>var input = require('./input');

var node = new (require('./../node'))();
node.start('home.sensors', 'occupancy', function () {
  node.addProperty('people_home',  'number', 0);
  node.addProperty('people_awake', 'number', 0);

  var people = [
    {name: 'Daniel', laptops: ['28:CF:E9:5A:26:41'], phones: ['F8:A9:D0:0E:E1:31']},
    {name: 'Raynes', laptops: ['28:CF:E9:1E:6B:8D'], phones: ['04:F7:E4:14:C6:A4']}
  ];
  var lHome = 0, lAwake = 0;

  var refresh = function () {
    input.getStations(function (stations) {
      var home = 0, awake = 0;

      var macs = stations.map(function (station) {
        return station[0];
      });

      people.forEach(function (person) {
        var state = 0;

        person.phones.forEach(function (mac) {
          if (macs.indexOf(mac) != -1) state = 1;
        });
        person.laptops.forEach(function (mac) {
          if (macs.indexOf(mac) != -1) state = 2;
        });

        if (state > 0) home++;
        if (state > 1) awake++;
      });

      if (home != lHome)
        node.setProperty('people_home',  home);
      if (awake != lAwake)
        node.setProperty('people_awake', awake);

      lHome = home;
      lAwake = awake;
    });
  };

  setInterval(refresh, 2500);
  refresh();
});

{'fraction_non_alphanumeric': 0.18919968919968919, 'fraction_numerical': 0.03418803418803419, 'mean_word_length': 2.489159891598916, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2596517', 'n_tokens_mistral': 964, 'n_tokens_neox': 893, 'n_words': 193}