<commit_before>import { batteryService } from "./_shared";

const isWindow = (state, device, config) => {
  if (config.window_ids.indexOf(device.object_id) !== -1) {
    return true;
  }

  return state.opened !== undefined && /\bwindow\b/i.test(device.name);
};

const isDoor = (state, device, config) => {
  return state.opened !== undefined && !isWindow(state, device, config);
};

export default ({ Characteristic, Service }) => {
  return {
    type: "sensor_pod",
    group: "sensor_pods",
    services: [
      {
        service: Service.OccupancySensor,
        supported: state => state.occupied !== undefined,
        characteristics: [
          {
            characteristic: Characteristic.OccupancyDetected,
            get: state => state.occupied
          },
          {
            characteristic: Characteristic.StatusTampered,
            supported: state => state.tamper_detected !== undefined,
            get: state => state.tamper_detected
          }
        ]
      },
      {
        service: Service.MotionSensor,
        supported: state => state.motion !== undefined,
        characteristics: [
          {
            characteristic: Characteristic.MotionDetected,
            get: state => state.motion
          },
          {
            characteristic: Characteristic.StatusTampered,
            supported: state => state.tamper_detected !== undefined,
            get: state => state.tamper_detected
          }
        ]
      },
      {
        service: Service.HumiditySensor,
        supported: state => state.humidity !== undefined,
        characteristics: [
          {
            characteristic: Characteristic.CurrentRelativeHumidity,
            get: state => state.humidity
          }
        ]
      },
      {
        service: Service.TemperatureSensor,
        supported: state => state.temperature !== undefined,
        characteristics: [
          {
            characteristic: Characteristic.CurrentTemperature,
            get: state => state.temperature
          }
        ]
      },
      {
        service: Service.TemperatureSensor,
        supported: state => state.temperature !== undefined,
        characteristics: [
          {
            characteristic: Characteristic.CurrentTemperature,
            get: state => state.temperature
          }
        ]
      },
      {
        service: Service.Door,
        supported: isDoor,
        characteristics: [<commit_msg>Removed duplicated service in sensor_pod.js<commit_after>import { batteryService } from "./_shared";

const isWindow = (state, device, config) => {
  if (config.window_ids.indexOf(device.object_id) !== -1) {
    return true;
  }

  return state.opened !== undefined && /\bwindow\b/i.test(device.name);
};

const isDoor = (state, device, config) => {
  return state.opened !== undefined && !isWindow(state, device, config);
};

export default ({ Characteristic, Service }) => {
  return {
    type: "sensor_pod",
    group: "sensor_pods",
    services: [
      {
        service: Service.OccupancySensor,
        supported: state => state.occupied !== undefined,
        characteristics: [
          {
            characteristic: Characteristic.OccupancyDetected,
            get: state => state.occupied
          },
          {
            characteristic: Characteristic.StatusTampered,
            supported: state => state.tamper_detected !== undefined,
            get: state => state.tamper_detected
          }
        ]
      },
      {
        service: Service.MotionSensor,
        supported: state => state.motion !== undefined,
        characteristics: [
          {
            characteristic: Characteristic.MotionDetected,
            get: state => state.motion
          },
          {
            characteristic: Characteristic.StatusTampered,
            supported: state => state.tamper_detected !== undefined,
            get: state => state.tamper_detected
          }
        ]
      },
      {
        service: Service.HumiditySensor,
        supported: state => state.humidity !== undefined,
        characteristics: [
          {
            characteristic: Characteristic.CurrentRelativeHumidity,
            get: state => state.humidity
          }
        ]
      },
      {
        service: Service.TemperatureSensor,
        supported: state => state.temperature !== undefined,
        characteristics: [
          {
            characteristic: Characteristic.CurrentTemperature,
            get: state => state.temperature
          }
        ]
      },
      {
        service: Service.Door,
        supported: isDoor,
        characteristics: [
{'fraction_non_alphanumeric': 0.1090633130962706, 'fraction_numerical': 0.0004336513443191674, 'mean_word_length': 1.881324172392255, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 35, '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': '3188395', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1187, 'n_words': 236}