<commit_before>/* TODO: Move to components- or lib-directory */
import io from 'socket.io-client';
import Event from '../events/event';
import Promise from 'bluebird';

const config = {
  host: 'zircon',
  port: 4001
};

const socket = io.connect(`http://${config.host}:${config.port}`);

socket
  .on('connect', () => console.log(`Connected to smart-home-backend on <${config.host}:${config.port}>`))
  .on('connect_error', () => console.log(`ERROR connecting to smart-home-backend on <${config.host}:${config.port}>`))
  .on('connect_timeout', () => console.log(`TIMEOUT connecting to smart-home-backend on <${config.host}:${config.port}>!`));

function setupEventlistener(eventAction) {
  socket.on('knx-event', (event) => {
    const e = new Event(event);
    eventAction(e);
  });
}

function fetchInitialState() {
  const promise = new Promise((resolve) => {
    socket.on('initialstate', (state) => resolve(state));
  });

  socket.emit('initialstate', {request: true});
  return promise;
}

function writeGroupAddr(addr) {
  const promise = new Promise((resolve) => {
    socket.emit('writeToBus', addr, resolve(addr));
  });
  return promise;
}

function fetchFermenterState() {
  const promise = new Promise((resolve) => {
    socket.on('fermenterstate', (state) => resolve(state));
  });

  socket.emit('fermenterstate', {request: true});
  return promise;
}

function fetchFermenterHistory() {
  const promise = new Promise((resolve) => {
    socket.on('fermenterhistory', (state) => resolve(state));
  });

  socket.emit('fermenterhistory', {request: true});
  return promise;
}

export default function connector() {
  return {
    setupEventlistener: setupEventlistener,
    fetchInitialState: fetchInitialState,
    writeGroupAddr: writeGroupAddr,
    fetchFermenterState: fetchFermenterState,
    fetchFermenterHistory: fetchFermenterHistory,
  };
}<commit_msg>Refactor to get rid of linter-warnings.<commit_after>/* TODO: Move to components- or lib-directory */
import io from 'socket.io-client';
import Event from '../events/event';
import Promise from 'bluebird';

const config = {
  host: 'zircon',
  port: 4001
};

const socket = io.connect(`http://${config.host}:${config.port}`);

socket
  .on('connect', () => console.log(`Connected to smart-home-backend on <${config.host}:${config.port}>`))
  .on('connect_error', () => console.log(`ERROR connecting to smart-home-backend on <${config.host}:${config.port}>`))
  .on('connect_timeout', () => console.log(`TIMEOUT connecting to smart-home-backend on <${config.host}:${config.port}>!`));

function setupEventlistener(eventAction) {
  socket.on('knx-event', (event) => {
    const e = new Event(event);
    eventAction(e);
  });
}

function fetchInitialState() {
  const promise = new Promise((resolve) => {
    socket.on('initialstate', (state) => resolve(state));
  });

  socket.emit('initialstate', { request: true });
  return promise;
}

function writeGroupAddr(addr) {
  const promise = new Promise((resolve) => {
    socket.emit('writeToBus', addr, resolve(addr));
  });
  return promise;
}

function fetchFermenterState() {
  const promise = new Promise((resolve) => {
    socket.on('fermenterstate', (state) => resolve(state));
  });

  socket.emit('fermenterstate', { request: true });
  return promise;
}

function fetchFermenterHistory() {
  const promise = new Promise((resolve) => {
    socket.on('fermenterhistory', (state) => resolve(state));
  });

  socket.emit('fermenterhistory', { request: true });
  return promise;
}

export default function connector() {
  return {
    setupEventlistener,
    fetchInitialState,
    writeGroupAddr,
    fetchFermenterState,
    fetchFermenterHistory,
  };
}
{'fraction_non_alphanumeric': 0.17267552182163187, 'fraction_numerical': 0.002168609379235565, 'mean_word_length': 4.703245749613601, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 31, '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': '2734470', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1133, 'n_words': 252}