{"size": 959, "ext": "js", "max_stars_repo_path": "MMM-hue-dimmer-switch.js", "max_stars_repo_name": "garygrossgarten/MMM-hue-dimmer-switch", "max_stars_repo_stars_event_min_datetime": "2020-02-13T19:36:25.000Z", "max_stars_repo_stars_event_max_datetime": "2020-02-13T19:36:25.000Z", "max_issues_repo_path": "MMM-hue-dimmer-switch.js", "max_issues_repo_name": "garygrossgarten/MMM-hue-dimmer-switch", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "MMM-hue-dimmer-switch.js", "max_forks_repo_name": "garygrossgarten/MMM-hue-dimmer-switch", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.0606060606, "max_line_length": 73, "alphanum_fraction": 0.598540146}
Module.register("MMM-hue-dimmer-switch", {
  // Override dom generator.
  getDom: function() {
    const element = document.createElement("hue-dimmer-switch");
    element.ip = this.config.ip;
    element.username = this.config.username;
    element.sensor = this.config.sensor;
    element.raspberry = this.config.raspberry;
    
    element.addEventListener("dimmerclick", (val) => {
      const event = val.detail[1].buttonevent % 1000;
        switch (event) {
        case 1:
          this.sendNotification('REMOTE_ACTION', {action: 'MONITORON'});
          break;
        case 2:
          this.sendNotification("PAGE_INCREMENT");
          break;
        case 3:
          this.sendNotification("PAGE_DECREMENT");
          break;
        case 4:
          this.sendNotification('REMOTE_ACTION', {action: 'MONITOROFF'});
          break;
      }
    });
    return element;
  },
  getScripts: function() {
    return ["hue-dimmer-switch.js"];
  }
});
