<commit_before>const sendData = require('../helpers/sendData');
const BroadlinkRMAccessory = require('./accessory');

class SwitchRepeatAccessory extends BroadlinkRMAccessory {

  async setSwitchState (hexData) {
    const { host } = this;

    if (this.switchState) {
      this.performSend(host, hexData);
    } else {
      if (this.performSendTimeout) clearTimeout(this.performSendTimeout);

      this.sendCount = 0;
    }
  }

  performSend (host, hexData) {
    const { config, log } = this;
    let { interval, sendCount } = config;

    if (!interval) interval = 1;<commit_msg>Fix for switch-repeat not stopping<commit_after>const sendData = require('../helpers/sendData');
const BroadlinkRMAccessory = require('./accessory');

class SwitchRepeatAccessory extends BroadlinkRMAccessory {

  async setSwitchState (hexData) {
    const { host } = this;

    if (this.switchState) {
      this.performSend(host, hexData);
    } else {
      if (this.performSendTimeout) clearTimeout(this.performSendTimeout);

      this.sendCount = 0;
    }
  }

  performSend (host, hexData) {
    const { config, log } = this;
    let { interval, sendCount } = config;

    this.sendCount = this.sendCount || 0;
    interval = interval || 1;
{'fraction_non_alphanumeric': 0.12012987012987013, 'fraction_numerical': 0.004058441558441558, 'mean_word_length': 3.4512635379061374, 'pattern_counts': {'":': 0, '<': 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': '5187245', 'n_tokens_mistral': 384, 'n_tokens_neox': 369, 'n_words': 87}