From 6c2476a9848ea1bf79d28de53875e28666625290 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sat, 25 May 2024 09:18:11 +0200 Subject: [PATCH 01/56] Update index.js --- index.js | 150 +++++++++++++++++++++++++++---------------------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/index.js b/index.js index 5434604..9352e5e 100755 --- a/index.js +++ b/index.js @@ -25,7 +25,7 @@ const express = require('express'); const debug = {}; debug.DEBUG = 100; debug.INFO = 200; -debug.WARN = 300; +debug.WARNING = 300; debug.ERROR = 400; debug.NO = 1000; let hasError = false; @@ -385,7 +385,7 @@ JeedomPlatform.prototype.JeedomDevices2HomeKitAccessories = function(devices) { const endLog = '--== Homebridge est démarré et a intégré '+countA+' accessoire'+ (countA>1 ? 's' : '') +' ! ==--'; this.log(endLog); if(countA >= 150) {this.log('error','!!! ATTENTION !!! Vous avez '+countA+' accessoires + Jeedom et HomeKit en supporte 150 max au total !!');} - else if(countA >= 140) {this.log('warn','!! Avertissement, vous avez '+countA+' accessoires + Jeedom et HomeKit en supporte 150 max au total !!');} + else if(countA >= 140) {this.log('warning','!! Avertissement, vous avez '+countA+' accessoires + Jeedom et HomeKit en supporte 150 max au total !!');} this.log('debug','==START POLLING=='); this.startPollingUpdate(); @@ -450,13 +450,13 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.infos.brightness=cmd2.brightness; } }); - if (Serv.actions.on && !Serv.actions.off) {this.log('warn','Pas de type générique "Action/Lumière OFF"');} - if (!Serv.actions.on && Serv.actions.off) {this.log('warn','Pas de type générique "Action/Lumière ON"');} - if (!Serv.actions.on && !Serv.actions.off) {this.log('warn','Pas de type générique "Action/Lumière ON" et "Action/Lumière OFF"');} - if (Serv.infos.color && !Serv.actions.setcolor) {this.log('warn','Pas de type générique "Action/Lumière Couleur"');} - if (!Serv.infos.color && Serv.actions.setcolor) {this.log('warn','Pas de type générique "Info/Lumière Couleur"');} - if (Serv.infos.color_temp && !Serv.actions.setcolor_temp) {this.log('warn','Pas de type générique "Action/Lumière Température Couleur"');} - if (!Serv.infos.color_temp && Serv.actions.setcolor_temp) {this.log('warn','Pas de type générique "Info/Lumière Température Couleur"');} + if (Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique "Action/Lumière OFF"');} + if (!Serv.actions.on && Serv.actions.off) {this.log('warning','Pas de type générique "Action/Lumière ON"');} + if (!Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique "Action/Lumière ON" et "Action/Lumière OFF"');} + if (Serv.infos.color && !Serv.actions.setcolor) {this.log('warning','Pas de type générique "Action/Lumière Couleur"');} + if (!Serv.infos.color && Serv.actions.setcolor) {this.log('warning','Pas de type générique "Info/Lumière Couleur"');} + if (Serv.infos.color_temp && !Serv.actions.setcolor_temp) {this.log('warning','Pas de type générique "Action/Lumière Température Couleur"');} + if (!Serv.infos.color_temp && Serv.actions.setcolor_temp) {this.log('warning','Pas de type générique "Info/Lumière Température Couleur"');} if(Serv.actions.slider) { if(Serv.actions.slider.configuration && Serv.actions.slider.configuration.maxValue && parseInt(Serv.actions.slider.configuration.maxValue)) { @@ -538,7 +538,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Lumière Etat"'); + this.log('warning','Pas de type générique "Info/Lumière Etat"'); } else { HBservice = null; } @@ -596,14 +596,14 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.infos.VerTiltState = cmd2.VerTiltState; } }); - if(Serv.actions.up && !Serv.actions.down) {this.log('warn','Pas de type générique "Action/Volet Bouton Descendre"');} - if(!Serv.actions.up && Serv.actions.down) {this.log('warn','Pas de type générique "Action/Volet Bouton Monter"');} - if(!Serv.actions.up && !Serv.actions.down) {this.log('warn','Pas de type générique "Action/Volet Bouton Descendre" et "Action/Volet Bouton Monter"');} - if(!Serv.actions.up && !Serv.actions.down && !Serv.actions.slider) {this.log('warn','Pas de type générique "Action/Volet Bouton Slider" et "Action/Volet Bouton Monter" et "Action/Volet Bouton Descendre"');} - if(Serv.actions.HorTiltSlider && !Serv.infos.HorTiltState) {this.log('warn','Pas de type générique "Info/Volet Etat Inclinaison Horizontale" malgré l\'action "Action/Volet Slider Inclinaison Horizontale"');} - if(Serv.actions.VerTiltSlider && !Serv.infos.VerTiltState) {this.log('warn','Pas de type générique "Info/Volet Etat Inclinaison Verticale" malgré l\'action "Action/Volet Slider Inclinaison Verticale"');} - if(!Serv.actions.HorTiltSlider && Serv.infos.HorTiltState) {this.log('warn','Pas de type générique "Action/Volet Slider Inclinaison Horizontale" malgré l\'état "Info/Volet Etat Inclinaison Horizontale"');} - if(!Serv.actions.VerTiltSlider && Serv.infos.VerTiltState) {this.log('warn','Pas de type générique "Action/Volet Slider Inclinaison Verticale" malgré l\'état "Info/Volet Etat Inclinaison Verticale"');} + if(Serv.actions.up && !Serv.actions.down) {this.log('warning','Pas de type générique "Action/Volet Bouton Descendre"');} + if(!Serv.actions.up && Serv.actions.down) {this.log('warning','Pas de type générique "Action/Volet Bouton Monter"');} + if(!Serv.actions.up && !Serv.actions.down) {this.log('warning','Pas de type générique "Action/Volet Bouton Descendre" et "Action/Volet Bouton Monter"');} + if(!Serv.actions.up && !Serv.actions.down && !Serv.actions.slider) {this.log('warning','Pas de type générique "Action/Volet Bouton Slider" et "Action/Volet Bouton Monter" et "Action/Volet Bouton Descendre"');} + if(Serv.actions.HorTiltSlider && !Serv.infos.HorTiltState) {this.log('warning','Pas de type générique "Info/Volet Etat Inclinaison Horizontale" malgré l\'action "Action/Volet Slider Inclinaison Horizontale"');} + if(Serv.actions.VerTiltSlider && !Serv.infos.VerTiltState) {this.log('warning','Pas de type générique "Info/Volet Etat Inclinaison Verticale" malgré l\'action "Action/Volet Slider Inclinaison Verticale"');} + if(!Serv.actions.HorTiltSlider && Serv.infos.HorTiltState) {this.log('warning','Pas de type générique "Action/Volet Slider Inclinaison Horizontale" malgré l\'état "Info/Volet Etat Inclinaison Horizontale"');} + if(!Serv.actions.VerTiltSlider && Serv.infos.VerTiltState) {this.log('warning','Pas de type générique "Action/Volet Slider Inclinaison Verticale" malgré l\'état "Info/Volet Etat Inclinaison Verticale"');} Serv.minValue=0; if(Serv.infos.state.subType == 'binary') { Serv.maxValue=1; @@ -674,7 +674,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Volet Etat" ou "Info/Volet Etat Fermeture" on regarde s\'il y a uniquement les boutons...'); + this.log('warning','Pas de type générique "Info/Volet Etat" ou "Info/Volet Etat Fermeture" on regarde s\'il y a uniquement les boutons...'); eqLogic.services.flap.forEach((cmd) => { if (cmd.up) { const SwitchName=cmd.up.name; @@ -757,7 +757,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { } }); if(!HBservice) { - this.log('warn','Pas de type générique "Action/Volet Bouton Monter" ou "Action/Volet Bouton Descendre" ou "Action/Volet Bouton Stop"'); + this.log('warning','Pas de type générique "Action/Volet Bouton Monter" ou "Action/Volet Bouton Descendre" ou "Action/Volet Bouton Stop"'); } else { HBservice = null; } @@ -789,10 +789,10 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { }); Serv.maxValue = 100; // if not set in Jeedom it's 100 Serv.minValue = 0; // if not set in Jeedom it's 0 - if(Serv.actions.up && !Serv.actions.down) {this.log('warn','Pas de type générique "Action/Fenêtre Motorisée Descendre"');} - if(!Serv.actions.up && Serv.actions.down) {this.log('warn','Pas de type générique "Action/Fenêtre Motorisée Monter"');} - if(!Serv.actions.up && !Serv.actions.down) {this.log('warn','Pas de type générique "Action/Fenêtre Motorisée Descendre" et "Action/Fenêtre Motorisée Monter"');} - if(!Serv.actions.up && !Serv.actions.down && !Serv.actions.slider) {this.log('warn','Pas de type générique "Action/Fenêtre Motorisée Slider" et "Action/Fenêtre Motorisée Monter" et "Action/Fenêtre Motorisée Descendre"');} + if(Serv.actions.up && !Serv.actions.down) {this.log('warning','Pas de type générique "Action/Fenêtre Motorisée Descendre"');} + if(!Serv.actions.up && Serv.actions.down) {this.log('warning','Pas de type générique "Action/Fenêtre Motorisée Monter"');} + if(!Serv.actions.up && !Serv.actions.down) {this.log('warning','Pas de type générique "Action/Fenêtre Motorisée Descendre" et "Action/Fenêtre Motorisée Monter"');} + if(!Serv.actions.up && !Serv.actions.down && !Serv.actions.slider) {this.log('warning','Pas de type générique "Action/Fenêtre Motorisée Slider" et "Action/Fenêtre Motorisée Monter" et "Action/Fenêtre Motorisée Descendre"');} if(Serv.actions.slider) { if(Serv.actions.slider.configuration && Serv.actions.slider.configuration.maxValue && parseInt(Serv.actions.slider.configuration.maxValue)) { Serv.maxValue = parseInt(Serv.actions.slider.configuration.maxValue); @@ -812,7 +812,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Fenêtre Motorisée Etat"'); + this.log('warning','Pas de type générique "Info/Fenêtre Motorisée Etat"'); } else { HBservice = null; } @@ -838,8 +838,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.infos.inuse = cmd2.inuse; } }); - if(!Serv.actions.on) {this.log('warn','Pas de type générique "Action/Prise Bouton On"');} - if(!Serv.actions.off) {this.log('warn','Pas de type générique "Action/Prise Bouton Off"');} + if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Prise Bouton On"');} + if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Prise Bouton Off"');} // Test for AdminOnlyAccess, state need to have OwnerOnly attribute to True ou 1 if(Serv.infos.state.OwnerOnly) {Serv.getCharacteristic(Characteristic.On).setProps({adminOnlyAccess: [Access.WRITE]});} // add Active, Tampered and Defect Characteristics if needed @@ -852,7 +852,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Prise Etat"'); + this.log('warning','Pas de type générique "Info/Prise Etat"'); } else { HBservice = null; } @@ -878,8 +878,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.actions.off = cmd2.off; } }); - if(!Serv.actions.on) {this.log('warn','Pas de type générique "Action/Robinet Bouton On"');} - if(!Serv.actions.off) {this.log('warn','Pas de type générique "Action/Robinet Bouton Off"');} + if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Robinet Bouton On"');} + if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Robinet Bouton Off"');} // add Active, Tampered and Defect Characteristics if needed HBservice=this.createStatusCharact(HBservice,eqServicesCopy); @@ -891,7 +891,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Robinet Etat"'); + this.log('warning','Pas de type générique "Info/Robinet Etat"'); } else { HBservice = null; } @@ -917,8 +917,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.actions.off = cmd2.off; } }); - if(!Serv.actions.on) {this.log('warn','Pas de type générique "Action/Irrigation Bouton On"');} - if(!Serv.actions.off) {this.log('warn','Pas de type générique "Action/Irrigation Bouton Off"');} + if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Irrigation Bouton On"');} + if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Irrigation Bouton Off"');} // add Active, Tampered and Defect Characteristics if needed HBservice=this.createStatusCharact(HBservice,eqServicesCopy); @@ -930,7 +930,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Irrigation Etat"'); + this.log('warning','Pas de type générique "Info/Irrigation Etat"'); } else { HBservice = null; } @@ -960,8 +960,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.infos.remainingDuration = cmd2.remainingDuration; } }); - if(!Serv.actions.on) {this.log('warn','Pas de type générique "Action/Valve générique Bouton On"');} - if(!Serv.actions.off) {this.log('warn','Pas de type générique "Action/Valve générique Bouton Off"');} + if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Valve générique Bouton On"');} + if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Valve générique Bouton Off"');} if(Serv.actions.setDuration) { HBservice.characteristics.push(Characteristic.SetDuration); @@ -982,7 +982,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Valve générique Etat"'); + this.log('warning','Pas de type générique "Info/Valve générique Etat"'); } else { HBservice = null; } @@ -1011,9 +1011,9 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.actions.slider=cmd2.slider; } }); - if (Serv.actions.on && !Serv.actions.off) {this.log('warn','Pas de type générique "Action/Ventilateur OFF"');} - if (!Serv.actions.on && Serv.actions.off) {this.log('warn','Pas de type générique "Action/Ventilateur ON"');} - if (!Serv.actions.on && !Serv.actions.off) {this.log('warn','Pas de type générique "Action/Ventilateur ON" et "Action/Ventilateur OFF"');} + if (Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique "Action/Ventilateur OFF"');} + if (!Serv.actions.on && Serv.actions.off) {this.log('warning','Pas de type générique "Action/Ventilateur ON"');} + if (!Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique "Action/Ventilateur ON" et "Action/Ventilateur OFF"');} if(Serv.actions.slider) { if(Serv.actions.slider.configuration && Serv.actions.slider.configuration.maxValue && parseInt(Serv.actions.slider.configuration.maxValue)) { @@ -1041,7 +1041,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Ventilateur Etat"'); + this.log('warning','Pas de type générique "Info/Ventilateur Etat"'); } else { HBservice = null; } @@ -1091,8 +1091,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { } } }); - if(!Serv.actions.on) {this.log('warn','Pas de type générique "Action/Interrupteur Bouton On"');} - if(!Serv.actions.off) {this.log('warn','Pas de type générique "Action/Interrupteur Bouton Off"');} + if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Interrupteur Bouton On"');} + if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Interrupteur Bouton Off"');} // add Active, Tampered and Defect Characteristics if needed HBservice=this.createStatusCharact(HBservice,eqServicesCopy); @@ -1114,7 +1114,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Interrupteur Etat"'); + this.log('warning','Pas de type générique "Info/Interrupteur Etat"'); } else { HBservice = null; } @@ -1147,7 +1147,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','La Commande Action associée doit être du type "Autre"'); + this.log('warning','La Commande Action associée doit être du type "Autre"'); } else { HBservice = null; } @@ -1364,35 +1364,35 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { if(eqLogic.customizedValues.EXCELLENT && eqLogic.customizedValues.EXCELLENT != "NOT") { Serv.levelNum[Characteristic.AirQuality.EXCELLENT] = parseInt(eqLogic.customizedValues.EXCELLENT); } else { - this.log('warn',"Pas de config de la valeur 'Excellent', on la défini sur 50"); + this.log('warning',"Pas de config de la valeur 'Excellent', on la défini sur 50"); Serv.levelNum[Characteristic.AirQuality.EXCELLENT]=50; } if(eqLogic.customizedValues.GOOD && eqLogic.customizedValues.GOOD != "NOT") { Serv.levelNum[Characteristic.AirQuality.GOOD] = parseInt(eqLogic.customizedValues.GOOD); } else { - this.log('warn',"Pas de config de la valeur 'Bon', on la défini sur 100"); + this.log('warning',"Pas de config de la valeur 'Bon', on la défini sur 100"); Serv.levelNum[Characteristic.AirQuality.GOOD]=100; } if(eqLogic.customizedValues.FAIR && eqLogic.customizedValues.FAIR != "NOT") { Serv.levelNum[Characteristic.AirQuality.FAIR] = parseInt(eqLogic.customizedValues.FAIR); } else { - this.log('warn',"Pas de config de la valeur 'Moyen', on la défini sur 150"); + this.log('warning',"Pas de config de la valeur 'Moyen', on la défini sur 150"); Serv.levelNum[Characteristic.AirQuality.FAIR]=150; } if(eqLogic.customizedValues.INFERIOR && eqLogic.customizedValues.INFERIOR != "NOT") { Serv.levelNum[Characteristic.AirQuality.INFERIOR] = parseInt(eqLogic.customizedValues.INFERIOR); } else { - this.log('warn',"Pas de config de la valeur 'Inférieur', on la défini sur 200"); + this.log('warning',"Pas de config de la valeur 'Inférieur', on la défini sur 200"); Serv.levelNum[Characteristic.AirQuality.INFERIOR]=200; } if(eqLogic.customizedValues.POOR && eqLogic.customizedValues.POOR != "NOT") { Serv.levelNum[Characteristic.AirQuality.POOR] = parseInt(eqLogic.customizedValues.POOR); } else { - this.log('warn',"Pas de config de la valeur 'Faible', on la défini sur 1000"); + this.log('warning',"Pas de config de la valeur 'Faible', on la défini sur 1000"); Serv.levelNum[Characteristic.AirQuality.POOR]=1000; } } else if(this.myPlugin == "homebridge") { - this.log('warn',"Pas de config numérique des valeurs que qualité d'air"); + this.log('warning',"Pas de config numérique des valeurs que qualité d'air"); } @@ -1686,10 +1686,10 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.infos.mute=cmd2.mute; } }); - if(!Serv.actions.set_volume) {this.log('warn','Pas de type générique "Action/Haut-Parleur Volume"');} - if(!Serv.actions.mute_toggle && !Serv.actions.mute_on && Serv.actions.mute_off) {this.log('warn','Pas de type générique "Action/Haut-Parleur Mute"');} - if(!Serv.actions.mute_toggle && Serv.actions.mute_on && !Serv.actions.mute_off) {this.log('warn','Pas de type générique "Action/Haut-Parleur UnMute"');} - if(!Serv.actions.mute_toggle && !Serv.actions.mute_on && !Serv.actions.mute_off) {this.log('warn','Pas de type générique "Action/Haut-Parleur Toggle Mute" / "Action/Haut-Parleur Mute" / "Action/Haut-Parleur UnMute"');} + if(!Serv.actions.set_volume) {this.log('warning','Pas de type générique "Action/Haut-Parleur Volume"');} + if(!Serv.actions.mute_toggle && !Serv.actions.mute_on && Serv.actions.mute_off) {this.log('warning','Pas de type générique "Action/Haut-Parleur Mute"');} + if(!Serv.actions.mute_toggle && Serv.actions.mute_on && !Serv.actions.mute_off) {this.log('warning','Pas de type générique "Action/Haut-Parleur UnMute"');} + if(!Serv.actions.mute_toggle && !Serv.actions.mute_on && !Serv.actions.mute_off) {this.log('warning','Pas de type générique "Action/Haut-Parleur Toggle Mute" / "Action/Haut-Parleur Mute" / "Action/Haut-Parleur UnMute"');} Serv.cmd_id = cmd.volume.id; Serv.eqID = eqLogic.id; Serv.subtype = Serv.subtype || ''; @@ -1697,7 +1697,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Haut-Parleur Volume"'); + this.log('warning','Pas de type générique "Info/Haut-Parleur Volume"'); } else { HBservice = null; } @@ -1938,9 +1938,9 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.actions.toggle = cmd2.toggle; } }); - if(!Serv.actions.toggle && !Serv.actions.on && Serv.actions.off) {this.log('warn','Pas de type générique "Action/Portail ou garage bouton d\'ouverture"');} - if(!Serv.actions.toggle && Serv.actions.on && !Serv.actions.off) {this.log('warn','Pas de type générique "Action/Portail ou garage bouton de fermeture"');} - if(!Serv.actions.toggle && !Serv.actions.on && !Serv.actions.off) {this.log('warn','Pas de type générique ""Action/Portail ou garage bouton toggle" / "Action/Portail ou garage bouton d\'ouverture" / "Action/Portail ou garage bouton de fermeture"');} + if(!Serv.actions.toggle && !Serv.actions.on && Serv.actions.off) {this.log('warning','Pas de type générique "Action/Portail ou garage bouton d\'ouverture"');} + if(!Serv.actions.toggle && Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique "Action/Portail ou garage bouton de fermeture"');} + if(!Serv.actions.toggle && !Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique ""Action/Portail ou garage bouton toggle" / "Action/Portail ou garage bouton d\'ouverture" / "Action/Portail ou garage bouton de fermeture"');} if(eqLogic.customizedValues) { Serv.customizedValues = eqLogic.customizedValues; @@ -1956,7 +1956,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Garage état ouvrant" ou "Info/Portail état ouvrant"'); + this.log('warning','Pas de type générique "Info/Garage état ouvrant" ou "Info/Portail état ouvrant"'); } else { HBservice = null; } @@ -1980,8 +1980,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.actions.off = cmd2.off; } }); - if(!Serv.actions.on) {this.log('warn','Pas de type générique "Action/Serrure Bouton Ouvrir"');} - // if(!Serv.actions.off) {this.log('warn','Pas de type générique "Action/Serrure Bouton Fermer"');} + if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Serrure Bouton Ouvrir"');} + // if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Serrure Bouton Fermer"');} // add Active, Tampered and Defect Characteristics if needed HBservice=this.createStatusCharact(HBservice,eqServicesCopy); @@ -1993,7 +1993,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warn','Pas de type générique "Info/Serrure Etat"'); + this.log('warning','Pas de type générique "Info/Serrure Etat"'); } else { HBservice = null; } @@ -2069,7 +2069,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { } } else { - this.log('warn',"Pas le même nombre de boutons pour chaque évènement (il doit y avoir le même nombre de ';')"); + this.log('warning',"Pas le même nombre de boutons pour chaque évènement (il doit y avoir le même nombre de ';')"); } }); } @@ -2440,7 +2440,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.thermo.chauf.mode_id = splitted[0]; props.validValues.push(1); } else { - this.log('warn','Pas de config du mode Chauffage'); + this.log('warning','Pas de config du mode Chauffage'); } if(eqLogic.thermoModes.Clim && eqLogic.thermoModes.Clim != "NOT") { Serv.thermo.clim = {}; @@ -2449,7 +2449,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.thermo.clim.mode_id = splitted[0]; props.validValues.push(2); } else { - this.log('warn','Pas de config du mode Climatisation'); + this.log('warning','Pas de config du mode Climatisation'); } if(eqLogic.thermoModes.Off && eqLogic.thermoModes.Off != "NOT") { Serv.thermo.off = {}; @@ -2458,7 +2458,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.thermo.off.mode_id = splitted[0]; } } else if(this.myPlugin == "homebridge") { - this.log('warn','Pas de config des modes du thermostat'); + this.log('warning','Pas de config des modes du thermostat'); } // Serv.getCharacteristic(Characteristic.CurrentHeatingCoolingState).setProps(props); props.validValues.push(3); @@ -2553,7 +2553,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.thermoHC.chauf.mode_id = splitted[0]; props.validValues.push(1); } else { - this.log('warn','Pas de config du mode Chauffage'); + this.log('warning','Pas de config du mode Chauffage'); } if(eqLogic.thermoModes.Clim && eqLogic.thermoModes.Clim != "NOT") { Serv.thermoHC.clim = {}; @@ -2562,7 +2562,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.thermoHC.clim.mode_id = splitted[0]; props.validValues.push(2); } else { - this.log('warn','Pas de config du mode Climatisation'); + this.log('warning','Pas de config du mode Climatisation'); } if(eqLogic.thermoModes.Off && eqLogic.thermoModes.Off != "NOT") { Serv.thermoHC.off = {}; @@ -2572,7 +2572,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { } } else if(this.myPlugin == "homebridge") { - this.log('warn','Pas de config des modes du thermostatHC'); + this.log('warning','Pas de config des modes du thermostatHC'); } // Serv.getCharacteristic(Characteristic.CurrentHeatingCoolingState).setProps(props); props.validValues.push(3); @@ -2659,7 +2659,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { }); }); } else { - this.log('warn','Vous utilisez le type générique Mode en dehors du plugin Mode !'); + this.log('warning','Vous utilisez le type générique Mode en dehors du plugin Mode !'); } } if (eqLogic.services.siren) { @@ -2733,7 +2733,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { props.validValues.push(Characteristic.SecuritySystemTargetState.STAY_ARM); Serv.hasAlarmModes=true; } else { - this.log('warn','Pas de config du mode Domicile/Présence'); + this.log('warning','Pas de config du mode Domicile/Présence'); } if(eqLogic.alarmModes.SetModeAbsent && eqLogic.alarmModes.SetModeAbsent != "NOT") { Serv.alarm.away = {}; @@ -2743,7 +2743,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { props.validValues.push(Characteristic.SecuritySystemTargetState.AWAY_ARM); Serv.hasAlarmModes=true; } else { - this.log('warn','Pas de config du mode À distance/Absence'); + this.log('warning','Pas de config du mode À distance/Absence'); } if(eqLogic.alarmModes.SetModeNuit && eqLogic.alarmModes.SetModeNuit != "NOT") { Serv.alarm.night = {}; @@ -2753,12 +2753,12 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { props.validValues.push(Characteristic.SecuritySystemTargetState.NIGHT_ARM); Serv.hasAlarmModes=true; } else { - this.log('warn','Pas de config du mode Nuit'); + this.log('warning','Pas de config du mode Nuit'); } } if(this.myPlugin == "homebridge" && !Serv.hasAlarmModes) { props.validValues.push(Characteristic.SecuritySystemTargetState.AWAY_ARM); - this.log('warn','Pas de config des modes de l\'alarme'); + this.log('warning','Pas de config des modes de l\'alarme'); } props.validValues.push(Characteristic.SecuritySystemTargetState.DISARM); Serv.getCharacteristic(Characteristic.SecuritySystemTargetState).setProps(props); From 7066a6dcb95973aea9fb5b3948cb3125a11f8e85 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sat, 25 May 2024 09:18:29 +0200 Subject: [PATCH 02/56] Update myLogger.js --- lib/myLogger.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/myLogger.js b/lib/myLogger.js index 4df98f6..af85d27 100644 --- a/lib/myLogger.js +++ b/lib/myLogger.js @@ -28,7 +28,7 @@ module.exports = { var debug = {}; debug.DEBUG = 100; debug.INFO = 200; -debug.WARN = 300; +debug.WARNING = 300; debug.ERROR = 400; debug.NO = 1000; @@ -41,7 +41,7 @@ var loggerCache = {}; function myLogger(debugLevel,logger,creationLogPath) { this.logger = logger; this.debugLevel= debugLevel; - this.allowedLevel = ['debug','info','warn','error','conf']; + this.allowedLevel = ['debug','info','warning','error','conf']; this.creationLogPath = creationLogPath; this.creationPassed = false; fs.writeFileSync(this.creationLogPath+startLog, '['+(new Date().toISOString())+"] ---Début du log de création---\n"); @@ -69,7 +69,7 @@ function myLogger(debugLevel,logger,creationLogPath) { if(this.debugLevel == debug.NO) {msg=null;return;} if(this.debugLevel > debug.DEBUG && level == "debug") {msg=null;return;} if(this.debugLevel > debug.INFO && level == "info") {msg=null;return;} - if(this.debugLevel > debug.WARN && level == "warn") {msg=null;return;} + if(this.debugLevel > debug.WARNING && level == "warning") {msg=null;return;} if(this.debugLevel > debug.ERROR && level == "error") {msg=null;return;} this.logger(msg); From 7f5dc8dde164775b13fd2d2ceb25cb307b5010d3 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sat, 25 May 2024 10:03:02 +0200 Subject: [PATCH 03/56] Update index.js --- index.js | 216 +++++++++++++++++++++++++++---------------------------- 1 file changed, 108 insertions(+), 108 deletions(-) diff --git a/index.js b/index.js index 9352e5e..8e91256 100755 --- a/index.js +++ b/index.js @@ -450,13 +450,13 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.infos.brightness=cmd2.brightness; } }); - if (Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique "Action/Lumière OFF"');} - if (!Serv.actions.on && Serv.actions.off) {this.log('warning','Pas de type générique "Action/Lumière ON"');} - if (!Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique "Action/Lumière ON" et "Action/Lumière OFF"');} - if (Serv.infos.color && !Serv.actions.setcolor) {this.log('warning','Pas de type générique "Action/Lumière Couleur"');} - if (!Serv.infos.color && Serv.actions.setcolor) {this.log('warning','Pas de type générique "Info/Lumière Couleur"');} - if (Serv.infos.color_temp && !Serv.actions.setcolor_temp) {this.log('warning','Pas de type générique "Action/Lumière Température Couleur"');} - if (!Serv.infos.color_temp && Serv.actions.setcolor_temp) {this.log('warning','Pas de type générique "Info/Lumière Température Couleur"');} + if (Serv.actions.on && !Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Lumière OFF"');} + if (!Serv.actions.on && Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Lumière ON"');} + if (!Serv.actions.on && !Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Lumière ON" et "Action/Lumière OFF"');} + if (Serv.infos.color && !Serv.actions.setcolor) {this.log('|warning','Pas de type générique "Action/Lumière Couleur"');} + if (!Serv.infos.color && Serv.actions.setcolor) {this.log('|warning','Pas de type générique "Info/Lumière Couleur"');} + if (Serv.infos.color_temp && !Serv.actions.setcolor_temp) {this.log('|warning','Pas de type générique "Action/Lumière Température Couleur"');} + if (!Serv.infos.color_temp && Serv.actions.setcolor_temp) {this.log('|warning','Pas de type générique "Info/Lumière Température Couleur"');} if(Serv.actions.slider) { if(Serv.actions.slider.configuration && Serv.actions.slider.configuration.maxValue && parseInt(Serv.actions.slider.configuration.maxValue)) { @@ -468,7 +468,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservice.characteristics.push(Characteristic.Brightness); Serv.addCharacteristic(Characteristic.Brightness); } else { - this.log('info','La lumière n\'a pas de variateur'); + this.log('|info','La lumière n\'a pas de variateur'); } if(Serv.infos.color) { LightType += "_RGB"; @@ -507,7 +507,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { LightType+=Serv.colorTempType; } } else { - this.log('error','"Action/Lumière Température Couleur" doit avoir un minimum et un maximum !'); + this.log('|error','"Action/Lumière Température Couleur" doit avoir un minimum et un maximum !'); props.minValue = 0; // if not set in Jeedom it's 0 props.maxValue = 20000; // if not set in Jeedom it's 100 } @@ -529,7 +529,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { // add Active, Tampered and Defect Characteristics if needed HBservice=this.createStatusCharact(HBservice,eqServicesCopy); - this.log('info','La lumière est du type :',LightType); + this.log('|info','La lumière est du type :',LightType); Serv.LightType = LightType; Serv.cmd_id = cmd.state.id; Serv.eqID = eqLogic.id; @@ -538,7 +538,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Lumière Etat"'); + this.log('|warning','Pas de type générique "Info/Lumière Etat"'); } else { HBservice = null; } @@ -596,14 +596,14 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.infos.VerTiltState = cmd2.VerTiltState; } }); - if(Serv.actions.up && !Serv.actions.down) {this.log('warning','Pas de type générique "Action/Volet Bouton Descendre"');} - if(!Serv.actions.up && Serv.actions.down) {this.log('warning','Pas de type générique "Action/Volet Bouton Monter"');} - if(!Serv.actions.up && !Serv.actions.down) {this.log('warning','Pas de type générique "Action/Volet Bouton Descendre" et "Action/Volet Bouton Monter"');} - if(!Serv.actions.up && !Serv.actions.down && !Serv.actions.slider) {this.log('warning','Pas de type générique "Action/Volet Bouton Slider" et "Action/Volet Bouton Monter" et "Action/Volet Bouton Descendre"');} - if(Serv.actions.HorTiltSlider && !Serv.infos.HorTiltState) {this.log('warning','Pas de type générique "Info/Volet Etat Inclinaison Horizontale" malgré l\'action "Action/Volet Slider Inclinaison Horizontale"');} - if(Serv.actions.VerTiltSlider && !Serv.infos.VerTiltState) {this.log('warning','Pas de type générique "Info/Volet Etat Inclinaison Verticale" malgré l\'action "Action/Volet Slider Inclinaison Verticale"');} - if(!Serv.actions.HorTiltSlider && Serv.infos.HorTiltState) {this.log('warning','Pas de type générique "Action/Volet Slider Inclinaison Horizontale" malgré l\'état "Info/Volet Etat Inclinaison Horizontale"');} - if(!Serv.actions.VerTiltSlider && Serv.infos.VerTiltState) {this.log('warning','Pas de type générique "Action/Volet Slider Inclinaison Verticale" malgré l\'état "Info/Volet Etat Inclinaison Verticale"');} + if(Serv.actions.up && !Serv.actions.down) {this.log('|warning','Pas de type générique "Action/Volet Bouton Descendre"');} + if(!Serv.actions.up && Serv.actions.down) {this.log('|warning','Pas de type générique "Action/Volet Bouton Monter"');} + if(!Serv.actions.up && !Serv.actions.down) {this.log('|warning','Pas de type générique "Action/Volet Bouton Descendre" et "Action/Volet Bouton Monter"');} + if(!Serv.actions.up && !Serv.actions.down && !Serv.actions.slider) {this.log('|warning','Pas de type générique "Action/Volet Bouton Slider" et "Action/Volet Bouton Monter" et "Action/Volet Bouton Descendre"');} + if(Serv.actions.HorTiltSlider && !Serv.infos.HorTiltState) {this.log('|warning','Pas de type générique "Info/Volet Etat Inclinaison Horizontale" malgré l\'action "Action/Volet Slider Inclinaison Horizontale"');} + if(Serv.actions.VerTiltSlider && !Serv.infos.VerTiltState) {this.log('|warning','Pas de type générique "Info/Volet Etat Inclinaison Verticale" malgré l\'action "Action/Volet Slider Inclinaison Verticale"');} + if(!Serv.actions.HorTiltSlider && Serv.infos.HorTiltState) {this.log('|warning','Pas de type générique "Action/Volet Slider Inclinaison Horizontale" malgré l\'état "Info/Volet Etat Inclinaison Horizontale"');} + if(!Serv.actions.VerTiltSlider && Serv.infos.VerTiltState) {this.log('|warning','Pas de type générique "Action/Volet Slider Inclinaison Verticale" malgré l\'état "Info/Volet Etat Inclinaison Verticale"');} Serv.minValue=0; if(Serv.infos.state.subType == 'binary') { Serv.maxValue=1; @@ -638,7 +638,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservice.characteristics.push(Characteristic.TargetHorizontalTiltAngle); Serv.addCharacteristic(Characteristic.TargetHorizontalTiltAngle); Serv.getCharacteristic(Characteristic.TargetHorizontalTiltAngle).setProps(props); - this.log('debug','Horizontal Slider props :'+JSON.stringify(props)+'/'+JSON.stringify(Serv.actions.HorTiltSlider.configuration)); + this.log('|debug','Horizontal Slider props :'+JSON.stringify(props)+'/'+JSON.stringify(Serv.actions.HorTiltSlider.configuration)); } if(Serv.actions.VerTiltSlider) { @@ -660,7 +660,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservice.characteristics.push(Characteristic.TargetVerticalTiltAngle); Serv.addCharacteristic(Characteristic.TargetVerticalTiltAngle); Serv.getCharacteristic(Characteristic.TargetVerticalTiltAngle).setProps(props); - this.log('debug','Vertical Slider props :'+JSON.stringify(props)+'/'+JSON.stringify(Serv.actions.VerTiltSlider.configuration)); + this.log('|debug','Vertical Slider props :'+JSON.stringify(props)+'/'+JSON.stringify(Serv.actions.VerTiltSlider.configuration)); } // add Active, Tampered and Defect Characteristics if needed @@ -674,7 +674,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Volet Etat" ou "Info/Volet Etat Fermeture" on regarde s\'il y a uniquement les boutons...'); + this.log('|warning','Pas de type générique "Info/Volet Etat" ou "Info/Volet Etat Fermeture" on regarde s\'il y a uniquement les boutons...'); eqLogic.services.flap.forEach((cmd) => { if (cmd.up) { const SwitchName=cmd.up.name; @@ -757,7 +757,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { } }); if(!HBservice) { - this.log('warning','Pas de type générique "Action/Volet Bouton Monter" ou "Action/Volet Bouton Descendre" ou "Action/Volet Bouton Stop"'); + this.log('|warning','Pas de type générique "Action/Volet Bouton Monter" ou "Action/Volet Bouton Descendre" ou "Action/Volet Bouton Stop"'); } else { HBservice = null; } @@ -789,10 +789,10 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { }); Serv.maxValue = 100; // if not set in Jeedom it's 100 Serv.minValue = 0; // if not set in Jeedom it's 0 - if(Serv.actions.up && !Serv.actions.down) {this.log('warning','Pas de type générique "Action/Fenêtre Motorisée Descendre"');} - if(!Serv.actions.up && Serv.actions.down) {this.log('warning','Pas de type générique "Action/Fenêtre Motorisée Monter"');} - if(!Serv.actions.up && !Serv.actions.down) {this.log('warning','Pas de type générique "Action/Fenêtre Motorisée Descendre" et "Action/Fenêtre Motorisée Monter"');} - if(!Serv.actions.up && !Serv.actions.down && !Serv.actions.slider) {this.log('warning','Pas de type générique "Action/Fenêtre Motorisée Slider" et "Action/Fenêtre Motorisée Monter" et "Action/Fenêtre Motorisée Descendre"');} + if(Serv.actions.up && !Serv.actions.down) {this.log('|warning','Pas de type générique "Action/Fenêtre Motorisée Descendre"');} + if(!Serv.actions.up && Serv.actions.down) {this.log('|warning','Pas de type générique "Action/Fenêtre Motorisée Monter"');} + if(!Serv.actions.up && !Serv.actions.down) {this.log('|warning','Pas de type générique "Action/Fenêtre Motorisée Descendre" et "Action/Fenêtre Motorisée Monter"');} + if(!Serv.actions.up && !Serv.actions.down && !Serv.actions.slider) {this.log('|warning','Pas de type générique "Action/Fenêtre Motorisée Slider" et "Action/Fenêtre Motorisée Monter" et "Action/Fenêtre Motorisée Descendre"');} if(Serv.actions.slider) { if(Serv.actions.slider.configuration && Serv.actions.slider.configuration.maxValue && parseInt(Serv.actions.slider.configuration.maxValue)) { Serv.maxValue = parseInt(Serv.actions.slider.configuration.maxValue); @@ -812,7 +812,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Fenêtre Motorisée Etat"'); + this.log('|warning','Pas de type générique "Info/Fenêtre Motorisée Etat"'); } else { HBservice = null; } @@ -838,8 +838,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.infos.inuse = cmd2.inuse; } }); - if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Prise Bouton On"');} - if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Prise Bouton Off"');} + if(!Serv.actions.on) {this.log('|warning','Pas de type générique "Action/Prise Bouton On"');} + if(!Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Prise Bouton Off"');} // Test for AdminOnlyAccess, state need to have OwnerOnly attribute to True ou 1 if(Serv.infos.state.OwnerOnly) {Serv.getCharacteristic(Characteristic.On).setProps({adminOnlyAccess: [Access.WRITE]});} // add Active, Tampered and Defect Characteristics if needed @@ -852,7 +852,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Prise Etat"'); + this.log('|warning','Pas de type générique "Info/Prise Etat"'); } else { HBservice = null; } @@ -878,8 +878,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.actions.off = cmd2.off; } }); - if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Robinet Bouton On"');} - if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Robinet Bouton Off"');} + if(!Serv.actions.on) {this.log('|warning','Pas de type générique "Action/Robinet Bouton On"');} + if(!Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Robinet Bouton Off"');} // add Active, Tampered and Defect Characteristics if needed HBservice=this.createStatusCharact(HBservice,eqServicesCopy); @@ -891,7 +891,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Robinet Etat"'); + this.log('|warning','Pas de type générique "Info/Robinet Etat"'); } else { HBservice = null; } @@ -917,8 +917,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.actions.off = cmd2.off; } }); - if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Irrigation Bouton On"');} - if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Irrigation Bouton Off"');} + if(!Serv.actions.on) {this.log('|warning','Pas de type générique "Action/Irrigation Bouton On"');} + if(!Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Irrigation Bouton Off"');} // add Active, Tampered and Defect Characteristics if needed HBservice=this.createStatusCharact(HBservice,eqServicesCopy); @@ -930,7 +930,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Irrigation Etat"'); + this.log('|warning','Pas de type générique "Info/Irrigation Etat"'); } else { HBservice = null; } @@ -960,8 +960,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.infos.remainingDuration = cmd2.remainingDuration; } }); - if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Valve générique Bouton On"');} - if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Valve générique Bouton Off"');} + if(!Serv.actions.on) {this.log('|warning','Pas de type générique "Action/Valve générique Bouton On"');} + if(!Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Valve générique Bouton Off"');} if(Serv.actions.setDuration) { HBservice.characteristics.push(Characteristic.SetDuration); @@ -982,7 +982,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Valve générique Etat"'); + this.log('|warning','Pas de type générique "Info/Valve générique Etat"'); } else { HBservice = null; } @@ -1011,9 +1011,9 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.actions.slider=cmd2.slider; } }); - if (Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique "Action/Ventilateur OFF"');} - if (!Serv.actions.on && Serv.actions.off) {this.log('warning','Pas de type générique "Action/Ventilateur ON"');} - if (!Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique "Action/Ventilateur ON" et "Action/Ventilateur OFF"');} + if (Serv.actions.on && !Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Ventilateur OFF"');} + if (!Serv.actions.on && Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Ventilateur ON"');} + if (!Serv.actions.on && !Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Ventilateur ON" et "Action/Ventilateur OFF"');} if(Serv.actions.slider) { if(Serv.actions.slider.configuration && Serv.actions.slider.configuration.maxValue && parseInt(Serv.actions.slider.configuration.maxValue)) { @@ -1025,13 +1025,13 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservice.characteristics.push(Characteristic.RotationSpeed); Serv.addCharacteristic(Characteristic.RotationSpeed); } else { - this.log('info','Le ventilateur n\'a pas de variateur'); + this.log('|info','Le ventilateur n\'a pas de variateur'); } // add Active, Tampered and Defect Characteristics if needed HBservice=this.createStatusCharact(HBservice,eqServicesCopy); - this.log('info','Le ventilateur est du type :',FanType+((maxPower)?','+maxPower:'')); + this.log('|info','Le ventilateur est du type :',FanType+((maxPower)?','+maxPower:'')); Serv.FanType = FanType; Serv.maxPower = maxPower; Serv.cmd_id = cmd.state.id; @@ -1041,7 +1041,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Ventilateur Etat"'); + this.log('|warning','Pas de type générique "Info/Ventilateur Etat"'); } else { HBservice = null; } @@ -1051,7 +1051,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { if (!cmd.state) {return;} let SwitchName = eqLogic.name; if(cmd.state.generic_type == 'CAMERA_RECORD_STATE' || (cmd.state.generic_type == 'SWITCH_STATE' && eqLogic.numSwitches>1)) { - this.log('debug',"Switchs multiples dans même équipement, il y en a "+eqLogic.numSwitches); + this.log('|debug',"Switchs multiples dans même équipement, il y en a "+eqLogic.numSwitches); SwitchName=cmd.state.name; } HBservice = { @@ -1060,7 +1060,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { }; const Serv = HBservice.controlService; if(cmd.state.generic_type == 'CAMERA_RECORD_STATE' || (cmd.state.generic_type == 'SWITCH_STATE' && eqLogic.numSwitches>1)) { - this.log('debug',"Nom du switch (multi) : "+SwitchName); + this.log('|debug',"Nom du switch (multi) : "+SwitchName); Serv.getCharacteristic(Characteristic.On).displayName = SwitchName; Serv.ConfiguredName=SwitchName; @@ -1091,8 +1091,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { } } }); - if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Interrupteur Bouton On"');} - if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Interrupteur Bouton Off"');} + if(!Serv.actions.on) {this.log('|warning','Pas de type générique "Action/Interrupteur Bouton On"');} + if(!Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Interrupteur Bouton Off"');} // add Active, Tampered and Defect Characteristics if needed HBservice=this.createStatusCharact(HBservice,eqServicesCopy); @@ -1114,7 +1114,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Interrupteur Etat"'); + this.log('|warning','Pas de type générique "Info/Interrupteur Etat"'); } else { HBservice = null; } @@ -1147,7 +1147,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','La Commande Action associée doit être du type "Autre"'); + this.log('|warning','La Commande Action associée doit être du type "Autre"'); } else { HBservice = null; } @@ -1364,35 +1364,35 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { if(eqLogic.customizedValues.EXCELLENT && eqLogic.customizedValues.EXCELLENT != "NOT") { Serv.levelNum[Characteristic.AirQuality.EXCELLENT] = parseInt(eqLogic.customizedValues.EXCELLENT); } else { - this.log('warning',"Pas de config de la valeur 'Excellent', on la défini sur 50"); + this.log('|warning',"Pas de config de la valeur 'Excellent', on la défini sur 50"); Serv.levelNum[Characteristic.AirQuality.EXCELLENT]=50; } if(eqLogic.customizedValues.GOOD && eqLogic.customizedValues.GOOD != "NOT") { Serv.levelNum[Characteristic.AirQuality.GOOD] = parseInt(eqLogic.customizedValues.GOOD); } else { - this.log('warning',"Pas de config de la valeur 'Bon', on la défini sur 100"); + this.log('|warning',"Pas de config de la valeur 'Bon', on la défini sur 100"); Serv.levelNum[Characteristic.AirQuality.GOOD]=100; } if(eqLogic.customizedValues.FAIR && eqLogic.customizedValues.FAIR != "NOT") { Serv.levelNum[Characteristic.AirQuality.FAIR] = parseInt(eqLogic.customizedValues.FAIR); } else { - this.log('warning',"Pas de config de la valeur 'Moyen', on la défini sur 150"); + this.log('|warning',"Pas de config de la valeur 'Moyen', on la défini sur 150"); Serv.levelNum[Characteristic.AirQuality.FAIR]=150; } if(eqLogic.customizedValues.INFERIOR && eqLogic.customizedValues.INFERIOR != "NOT") { Serv.levelNum[Characteristic.AirQuality.INFERIOR] = parseInt(eqLogic.customizedValues.INFERIOR); } else { - this.log('warning',"Pas de config de la valeur 'Inférieur', on la défini sur 200"); + this.log('|warning',"Pas de config de la valeur 'Inférieur', on la défini sur 200"); Serv.levelNum[Characteristic.AirQuality.INFERIOR]=200; } if(eqLogic.customizedValues.POOR && eqLogic.customizedValues.POOR != "NOT") { Serv.levelNum[Characteristic.AirQuality.POOR] = parseInt(eqLogic.customizedValues.POOR); } else { - this.log('warning',"Pas de config de la valeur 'Faible', on la défini sur 1000"); + this.log('|warning',"Pas de config de la valeur 'Faible', on la défini sur 1000"); Serv.levelNum[Characteristic.AirQuality.POOR]=1000; } } else if(this.myPlugin == "homebridge") { - this.log('warning',"Pas de config numérique des valeurs que qualité d'air"); + this.log('|warning',"Pas de config numérique des valeurs que qualité d'air"); } @@ -1479,7 +1479,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { if (!cmd.presence) {return;} let SensorName=eqLogic.name; if(eqLogic.numDetector>1) { - this.log('debug',"Detecteurs multiples dans même équipement, il y en a "+eqLogic.numDetector); + this.log('|debug',"Detecteurs multiples dans même équipement, il y en a "+eqLogic.numDetector); SensorName=cmd.presence.name; } HBservice = { @@ -1488,7 +1488,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { }; const Serv = HBservice.controlService; if(eqLogic.numDetector>1) { - this.log('debug',"Nom du détecteur (multi) : "+SensorName); + this.log('|debug',"Nom du détecteur (multi) : "+SensorName); Serv.getCharacteristic(Characteristic.MotionDetected).displayName = SensorName; Serv.ConfiguredName=SensorName; @@ -1533,7 +1533,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { if (!cmd.occupancy) {return;} let SensorName=eqLogic.name; if(eqLogic.numDetector>1) { - this.log('debug',"Detecteurs occupancy multiples dans même équipement, il y en a "+eqLogic.numDetector); + this.log('|debug',"Detecteurs occupancy multiples dans même équipement, il y en a "+eqLogic.numDetector); SensorName=cmd.occupancy.name; } HBservice = { @@ -1542,7 +1542,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { }; const Serv = HBservice.controlService; if(eqLogic.numDetector>1) { - this.log('debug',"Nom du détecteur (multi) : "+SensorName); + this.log('|debug',"Nom du détecteur (multi) : "+SensorName); Serv.getCharacteristic(Characteristic.OccupancyDetected).displayName = SensorName; Serv.ConfiguredName=SensorName; @@ -1587,7 +1587,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { var props = {}; var unite = ''; if(cmd.state.subType=="numeric") { - this.log('debug','Le générique',cmd.state.name,'est un numérique'); + this.log('|debug','Le générique',cmd.state.name,'est un numérique'); // test if default value is Float or Int ? var CharactToSet=Characteristic.GenericFLOAT; var NumericGenericType='float'; @@ -1595,7 +1595,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { CharactToSet=Characteristic.GenericINT; NumericGenericType='int'; } - this.log('debug','Sur base de sa valeur actuelle',cmd.state.currentValue,', on determine un type :',NumericGenericType); + this.log('|debug','Sur base de sa valeur actuelle',cmd.state.currentValue,', on determine un type :',NumericGenericType); HBservice.characteristics.push(CharactToSet); Serv.addCharacteristic(CharactToSet); Serv.getCharacteristic(CharactToSet).displayName = cmd.state.name; @@ -1612,16 +1612,16 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { } } if(Object.keys(props).length !== 0) { - this.log('debug','On lui set les props suivants :',props); + this.log('|debug','On lui set les props suivants :',props); Serv.getCharacteristic(CharactToSet).setProps(props); } } else if (cmd.state.subType=="binary") { - this.log('debug','Le générique',cmd.state.name,'est un booléen'); + this.log('|debug','Le générique',cmd.state.name,'est un booléen'); HBservice.characteristics.push(Characteristic.GenericBOOL); Serv.addCharacteristic(Characteristic.GenericBOOL); Serv.getCharacteristic(Characteristic.GenericBOOL).displayName = cmd.state.name; } else if (cmd.state.subType=="string" || cmd.state.subType=="other") { - this.log('debug','Le générique',cmd.state.name,'est une chaîne'); + this.log('|debug','Le générique',cmd.state.name,'est une chaîne'); HBservice.characteristics.push(Characteristic.GenericSTRING); Serv.addCharacteristic(Characteristic.GenericSTRING); Serv.getCharacteristic(Characteristic.GenericSTRING).displayName = cmd.state.name; @@ -1629,7 +1629,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { unite = cmd.state.unite ? cmd.state.unite : ''; if(unite) {props.unit=unite;} if(Object.keys(props).length !== 0) { - this.log('debug','On lui set les props suivants :',props); + this.log('|debug','On lui set les props suivants :',props); Serv.getCharacteristic(Characteristic.GenericSTRING).setProps(props); } } @@ -1686,10 +1686,10 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.infos.mute=cmd2.mute; } }); - if(!Serv.actions.set_volume) {this.log('warning','Pas de type générique "Action/Haut-Parleur Volume"');} - if(!Serv.actions.mute_toggle && !Serv.actions.mute_on && Serv.actions.mute_off) {this.log('warning','Pas de type générique "Action/Haut-Parleur Mute"');} - if(!Serv.actions.mute_toggle && Serv.actions.mute_on && !Serv.actions.mute_off) {this.log('warning','Pas de type générique "Action/Haut-Parleur UnMute"');} - if(!Serv.actions.mute_toggle && !Serv.actions.mute_on && !Serv.actions.mute_off) {this.log('warning','Pas de type générique "Action/Haut-Parleur Toggle Mute" / "Action/Haut-Parleur Mute" / "Action/Haut-Parleur UnMute"');} + if(!Serv.actions.set_volume) {this.log('|warning','Pas de type générique "Action/Haut-Parleur Volume"');} + if(!Serv.actions.mute_toggle && !Serv.actions.mute_on && Serv.actions.mute_off) {this.log('|warning','Pas de type générique "Action/Haut-Parleur Mute"');} + if(!Serv.actions.mute_toggle && Serv.actions.mute_on && !Serv.actions.mute_off) {this.log('|warning','Pas de type générique "Action/Haut-Parleur UnMute"');} + if(!Serv.actions.mute_toggle && !Serv.actions.mute_on && !Serv.actions.mute_off) {this.log('|warning','Pas de type générique "Action/Haut-Parleur Toggle Mute" / "Action/Haut-Parleur Mute" / "Action/Haut-Parleur UnMute"');} Serv.cmd_id = cmd.volume.id; Serv.eqID = eqLogic.id; Serv.subtype = Serv.subtype || ''; @@ -1697,7 +1697,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Haut-Parleur Volume"'); + this.log('|warning','Pas de type générique "Info/Haut-Parleur Volume"'); } else { HBservice = null; } @@ -1938,9 +1938,9 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.actions.toggle = cmd2.toggle; } }); - if(!Serv.actions.toggle && !Serv.actions.on && Serv.actions.off) {this.log('warning','Pas de type générique "Action/Portail ou garage bouton d\'ouverture"');} - if(!Serv.actions.toggle && Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique "Action/Portail ou garage bouton de fermeture"');} - if(!Serv.actions.toggle && !Serv.actions.on && !Serv.actions.off) {this.log('warning','Pas de type générique ""Action/Portail ou garage bouton toggle" / "Action/Portail ou garage bouton d\'ouverture" / "Action/Portail ou garage bouton de fermeture"');} + if(!Serv.actions.toggle && !Serv.actions.on && Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Portail ou garage bouton d\'ouverture"');} + if(!Serv.actions.toggle && Serv.actions.on && !Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Portail ou garage bouton de fermeture"');} + if(!Serv.actions.toggle && !Serv.actions.on && !Serv.actions.off) {this.log('|warning','Pas de type générique ""Action/Portail ou garage bouton toggle" / "Action/Portail ou garage bouton d\'ouverture" / "Action/Portail ou garage bouton de fermeture"');} if(eqLogic.customizedValues) { Serv.customizedValues = eqLogic.customizedValues; @@ -1956,7 +1956,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Garage état ouvrant" ou "Info/Portail état ouvrant"'); + this.log('|warning','Pas de type générique "Info/Garage état ouvrant" ou "Info/Portail état ouvrant"'); } else { HBservice = null; } @@ -1980,8 +1980,8 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.actions.off = cmd2.off; } }); - if(!Serv.actions.on) {this.log('warning','Pas de type générique "Action/Serrure Bouton Ouvrir"');} - // if(!Serv.actions.off) {this.log('warning','Pas de type générique "Action/Serrure Bouton Fermer"');} + if(!Serv.actions.on) {this.log('|warning','Pas de type générique "Action/Serrure Bouton Ouvrir"');} + // if(!Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Serrure Bouton Fermer"');} // add Active, Tampered and Defect Characteristics if needed HBservice=this.createStatusCharact(HBservice,eqServicesCopy); @@ -1993,7 +1993,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { HBservices.push(HBservice); }); if(!HBservice) { - this.log('warning','Pas de type générique "Info/Serrure Etat"'); + this.log('|warning','Pas de type générique "Info/Serrure Etat"'); } else { HBservice = null; } @@ -2039,7 +2039,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { if(buttonSingle[b].trim() != '') {values.push(Characteristic.ProgrammableSwitchEvent.SINGLE_PRESS);} if(buttonDouble[b].trim() != '') {values.push(Characteristic.ProgrammableSwitchEvent.DOUBLE_PRESS);} if(buttonLong[b].trim() != '') {values.push(Characteristic.ProgrammableSwitchEvent.LONG_PRESS);} - this.log('debug','ValidValues',values); + this.log('|debug','ValidValues',values); Serv.getCharacteristic(Characteristic.ProgrammableSwitchEvent).setProps({validValues:values}); Serv.getCharacteristic(Characteristic.ServiceLabelIndex).updateValue(Serv.ServiceLabelIndex); @@ -2069,7 +2069,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { } } else { - this.log('warning',"Pas le même nombre de boutons pour chaque évènement (il doit y avoir le même nombre de ';')"); + this.log('|warning',"Pas le même nombre de boutons pour chaque évènement (il doit y avoir le même nombre de ';')"); } }); } @@ -2126,7 +2126,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.cmd_id += Serv.infos.Long.id; break; } - this.log('debug','ValidValues 0 Mono',values); + this.log('|debug','ValidValues 0 Mono',values); Serv.getCharacteristic(Characteristic.ProgrammableSwitchEvent).setProps({validValues:values}); @@ -2182,7 +2182,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.infos.Long=cmdType.Long; Serv.cmd_id += Serv.infos.Long.id; } - this.log('debug','ValidValues '+b+' Mono',values); + this.log('|debug','ValidValues '+b+' Mono',values); Serv.getCharacteristic(Characteristic.ProgrammableSwitchEvent).setProps({validValues:values}); @@ -2440,7 +2440,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.thermo.chauf.mode_id = splitted[0]; props.validValues.push(1); } else { - this.log('warning','Pas de config du mode Chauffage'); + this.log('|warning','Pas de config du mode Chauffage'); } if(eqLogic.thermoModes.Clim && eqLogic.thermoModes.Clim != "NOT") { Serv.thermo.clim = {}; @@ -2449,7 +2449,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.thermo.clim.mode_id = splitted[0]; props.validValues.push(2); } else { - this.log('warning','Pas de config du mode Climatisation'); + this.log('|warning','Pas de config du mode Climatisation'); } if(eqLogic.thermoModes.Off && eqLogic.thermoModes.Off != "NOT") { Serv.thermo.off = {}; @@ -2458,7 +2458,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.thermo.off.mode_id = splitted[0]; } } else if(this.myPlugin == "homebridge") { - this.log('warning','Pas de config des modes du thermostat'); + this.log('|warning','Pas de config des modes du thermostat'); } // Serv.getCharacteristic(Characteristic.CurrentHeatingCoolingState).setProps(props); props.validValues.push(3); @@ -2553,7 +2553,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.thermoHC.chauf.mode_id = splitted[0]; props.validValues.push(1); } else { - this.log('warning','Pas de config du mode Chauffage'); + this.log('|warning','Pas de config du mode Chauffage'); } if(eqLogic.thermoModes.Clim && eqLogic.thermoModes.Clim != "NOT") { Serv.thermoHC.clim = {}; @@ -2562,7 +2562,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { Serv.thermoHC.clim.mode_id = splitted[0]; props.validValues.push(2); } else { - this.log('warning','Pas de config du mode Climatisation'); + this.log('|warning','Pas de config du mode Climatisation'); } if(eqLogic.thermoModes.Off && eqLogic.thermoModes.Off != "NOT") { Serv.thermoHC.off = {}; @@ -2572,7 +2572,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { } } else if(this.myPlugin == "homebridge") { - this.log('warning','Pas de config des modes du thermostatHC'); + this.log('|warning','Pas de config des modes du thermostatHC'); } // Serv.getCharacteristic(Characteristic.CurrentHeatingCoolingState).setProps(props); props.validValues.push(3); @@ -2659,7 +2659,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { }); }); } else { - this.log('warning','Vous utilisez le type générique Mode en dehors du plugin Mode !'); + this.log('|warning','Vous utilisez le type générique Mode en dehors du plugin Mode !'); } } if (eqLogic.services.siren) { @@ -2733,7 +2733,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { props.validValues.push(Characteristic.SecuritySystemTargetState.STAY_ARM); Serv.hasAlarmModes=true; } else { - this.log('warning','Pas de config du mode Domicile/Présence'); + this.log('|warning','Pas de config du mode Domicile/Présence'); } if(eqLogic.alarmModes.SetModeAbsent && eqLogic.alarmModes.SetModeAbsent != "NOT") { Serv.alarm.away = {}; @@ -2743,7 +2743,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { props.validValues.push(Characteristic.SecuritySystemTargetState.AWAY_ARM); Serv.hasAlarmModes=true; } else { - this.log('warning','Pas de config du mode À distance/Absence'); + this.log('|warning','Pas de config du mode À distance/Absence'); } if(eqLogic.alarmModes.SetModeNuit && eqLogic.alarmModes.SetModeNuit != "NOT") { Serv.alarm.night = {}; @@ -2753,12 +2753,12 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { props.validValues.push(Characteristic.SecuritySystemTargetState.NIGHT_ARM); Serv.hasAlarmModes=true; } else { - this.log('warning','Pas de config du mode Nuit'); + this.log('|warning','Pas de config du mode Nuit'); } } if(this.myPlugin == "homebridge" && !Serv.hasAlarmModes) { props.validValues.push(Characteristic.SecuritySystemTargetState.AWAY_ARM); - this.log('warning','Pas de config des modes de l\'alarme'); + this.log('|warning','Pas de config des modes de l\'alarme'); } props.validValues.push(Characteristic.SecuritySystemTargetState.DISARM); Serv.getCharacteristic(Characteristic.SecuritySystemTargetState).setProps(props); @@ -2772,7 +2772,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { } if (HBservices.length != 0) { - if (DEV_DEBUG) {this.log('debug','HBservices : '+JSON.stringify(HBservices));} + if (DEV_DEBUG) {this.log('|debug','HBservices : '+JSON.stringify(HBservices));} createdAccessory = this.createAccessory(HBservices, eqLogic); this.addAccessory(createdAccessory); HBservices = []; @@ -2884,7 +2884,7 @@ JeedomPlatform.prototype.delAccessory = function(jeedomAccessory,silence=false) if (!jeedomAccessory) { return; } - if(!silence) {this.log('debug',' Vérification d\'existance de l\'accessoire dans le cache Homebridge...');} + if(!silence) {this.log('|debug',' Vérification d\'existance de l\'accessoire dans le cache Homebridge...');} existingAccessory = this.existingAccessory(jeedomAccessory.UUID,silence); if(existingAccessory) { @@ -2894,7 +2894,7 @@ JeedomPlatform.prototype.delAccessory = function(jeedomAccessory,silence=false) existingAccessory.reviewed=true; } else if(!silence) { - this.log('│ KO : Accessoire Ignoré'); + this.log('│ KO : Accessoire Ignoré'); } } catch(e){ @@ -2917,7 +2917,7 @@ JeedomPlatform.prototype.addAccessory = function(jeedomAccessory) { if (!jeedomAccessory) {return;} let isNewAccessory = false; const services2Add = jeedomAccessory.services_add; - this.log('debug'," Vérification d'existance de l'accessoire dans le cache Homebridge..."); + this.log('|debug'," Vérification d'existance de l'accessoire dans le cache Homebridge..."); HBAccessory = this.existingAccessory(jeedomAccessory.UUID); if (!HBAccessory) { this.log('│ Nouvel accessoire (' + jeedomAccessory.name + ')'); @@ -2965,7 +2965,7 @@ JeedomPlatform.prototype.addAccessory = function(jeedomAccessory) { HBAccessory.context.eqLogic.loggingService.subtype = loggingServiceParams.subtype; HBAccessory.context.eqLogic.loggingService.cmd_id = loggingServiceParams.cmd_id; // HBAccessory.addService(HBAccessory.context.eqLogic.loggingService); - this.log('debug',' Ajout service History :'+HBAccessory.displayName+' subtype:'+HBAccessory.context.eqLogic.loggingService.subtype+' cmd_id:'+HBAccessory.context.eqLogic.loggingService.cmd_id+' UUID:'+HBAccessory.context.eqLogic.loggingService.UUID); + this.log('|debug',' Ajout service History :'+HBAccessory.displayName+' subtype:'+HBAccessory.context.eqLogic.loggingService.subtype+' cmd_id:'+HBAccessory.context.eqLogic.loggingService.cmd_id+' UUID:'+HBAccessory.context.eqLogic.loggingService.UUID); } if(HBAccessory.context.eqLogic.hasAdaptive) { @@ -2977,10 +2977,10 @@ JeedomPlatform.prototype.addAccessory = function(jeedomAccessory) { } if (isNewAccessory) { - this.log('│ OK : Ajout de l\'accessoire (' + jeedomAccessory.name + ')'); + this.log('│ OK : Ajout de l\'accessoire (' + jeedomAccessory.name + ')'); this.api.registerPlatformAccessories('homebridge-jeedom', 'Jeedom', [HBAccessory]); }else{ - this.log('│ OK : Mise à jour de l\'accessoire (' + jeedomAccessory.name + ')'); + this.log('│ OK : Mise à jour de l\'accessoire (' + jeedomAccessory.name + ')'); this.api.updatePlatformAccessories([HBAccessory]); } HBAccessory.on('identify', (paired, callback) => { @@ -3008,11 +3008,11 @@ JeedomPlatform.prototype.existingAccessory = function(UUID,silence=false) { try{ for (const key of Object.keys(this.accessories)) { if (this.accessories[key].UUID == UUID) { - if(!silence) {this.log('debug',' Accessoire déjà existant dans le cache Homebridge');} + if(!silence) {this.log('|debug',' Accessoire déjà existant dans le cache Homebridge');} return this.accessories[key]; } } - if(!silence) {this.log('debug',' Accessoire non existant dans le cache Homebridge');} + if(!silence) {this.log('|debug',' Accessoire non existant dans le cache Homebridge');} return null; } catch(e){ @@ -6370,7 +6370,7 @@ JeedomBridgedAccessory.prototype.addServices = function(newAccessory,services,ca service = services[s]; if(!newAccessory.getService(service.controlService)){// not exist ? - this.log('debug',' Ajout service :'+service.controlService.displayName+' subtype:'+service.controlService.subtype+' cmd_id:'+service.controlService.cmd_id+' UUID:'+service.controlService.UUID); + this.log('|debug',' Ajout service :'+service.controlService.displayName+' subtype:'+service.controlService.subtype+' cmd_id:'+service.controlService.cmd_id+' UUID:'+service.controlService.UUID); newAccessory.addService(service.controlService); for (var i = 0; i < service.characteristics.length; i++) { characteristic = service.controlService.getCharacteristic(service.characteristics[i]); @@ -6390,7 +6390,7 @@ JeedomBridgedAccessory.prototype.addServices = function(newAccessory,services,ca characteristic.props.minStep = 0.01; } this.platform.bindCharacteristicEvents(characteristic, service.controlService); - this.log('debug',' Caractéristique :'+characteristic.displayName+' valeur initiale:'+characteristic.value); + this.log('|debug',' Caractéristique :'+characteristic.displayName+' valeur initiale:'+characteristic.value); } } else { this.log('debug','On essaye d\'ajouter un service mais il existe déjà : ',service.controlService); @@ -6418,9 +6418,9 @@ JeedomBridgedAccessory.prototype.delServices = function(accessory) { serviceList.forEach((svc) => { service=svc; - this.log('debug', ' Suppression service :' + service.displayName + ' subtype:' + service.subtype + ' UUID:' + service.UUID); + this.log('|debug', ' Suppression service :' + service.displayName + ' subtype:' + service.subtype + ' UUID:' + service.UUID); service.characteristics.forEach((c) => { - this.log('debug', ' Caractéristique :' + c.displayName + ' valeur cache:' + c.value); + this.log('|debug', ' Caractéristique :' + c.displayName + ' valeur cache:' + c.value); cachedValues[service.subtype + c.displayName] = c.value; }); accessory.removeService(service); From 7424b153c23ee90343dd1f357bf167f90dbe249d Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sat, 25 May 2024 10:03:21 +0200 Subject: [PATCH 04/56] Update myLogger.js --- lib/myLogger.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/myLogger.js b/lib/myLogger.js index af85d27..58a5a9e 100644 --- a/lib/myLogger.js +++ b/lib/myLogger.js @@ -41,7 +41,7 @@ var loggerCache = {}; function myLogger(debugLevel,logger,creationLogPath) { this.logger = logger; this.debugLevel= debugLevel; - this.allowedLevel = ['debug','info','warning','error','conf']; + this.allowedLevel = ['debug','info','warning','error','conf','|debug','|info','|warning','|error']; this.creationLogPath = creationLogPath; this.creationPassed = false; fs.writeFileSync(this.creationLogPath+startLog, '['+(new Date().toISOString())+"] ---Début du log de création---\n"); @@ -50,7 +50,11 @@ function myLogger(debugLevel,logger,creationLogPath) { if(msg) { if(this.allowedLevel.indexOf(level.toLowerCase()) !== -1) { - msg="["+level.toUpperCase()+"] "+msg; + if(level.charAt(0) === '|') { + msg="| ["+level.toUpperCase().replace("|","")+"] "+msg; + } else { + msg="["+level.toUpperCase()+"] "+msg; + } } else { msg=level.toLowerCase()+' '+msg; } @@ -67,10 +71,10 @@ function myLogger(debugLevel,logger,creationLogPath) { } if(this.debugLevel == debug.NO) {msg=null;return;} - if(this.debugLevel > debug.DEBUG && level == "debug") {msg=null;return;} - if(this.debugLevel > debug.INFO && level == "info") {msg=null;return;} - if(this.debugLevel > debug.WARNING && level == "warning") {msg=null;return;} - if(this.debugLevel > debug.ERROR && level == "error") {msg=null;return;} + if(this.debugLevel > debug.DEBUG && (level == "debug" || level == "|debug")) {msg=null;return;} + if(this.debugLevel > debug.INFO && (level == "info" || level == "|info")) {msg=null;return;} + if(this.debugLevel > debug.WARNING && (level == "warning" || level == "|warning")) {msg=null;return;} + if(this.debugLevel > debug.ERROR && (level == "error" || level == "|error")) {msg=null;return;} this.logger(msg); msg=null; From 1525d1fe3e6539c8a72fc6c1bfde6078f2fe8e8b Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sat, 25 May 2024 10:13:37 +0200 Subject: [PATCH 05/56] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 794e5c3..043f787 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nebz/homebridge-jeedom", "version": "v1.7.0", - "cust_serial": "0028", + "cust_serial": "0029", "description": "Homebridge plugin for Jeedom ", "main": "index.js", "private":true, From 19e89626787dd486d3bdb9f4da674c761b3dba72 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 3 Jun 2024 14:52:14 +0200 Subject: [PATCH 06/56] Update index.js --- index.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 8e91256..9f39fa2 100755 --- a/index.js +++ b/index.js @@ -3175,7 +3175,23 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } } } - this.command(value == 0 ? 'turnOff' : 'turnOn', null, service); + if(value == 0) { + if(service.actions.off) { + this.command('turnOff', null, service); + } else if(service.actions.slider && service.LightType) { + this.command('setValueBright', 0, service); + } else { + this.command('turnOff', null, service); + } + else { + if(service.actions.on) { + this.command('turnOn', null, service); + } else if(service.actions.slider && service.LightType) { + this.command('setValueBright', service.maxBright, service); + } else { + this.command('turnOn', null, service); + } + } } break; case Characteristic.Active.UUID : From 73a767499514823a5f8e097f373c972d11eb997a Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:15:48 +0200 Subject: [PATCH 07/56] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 9f39fa2..ef8f86c 100755 --- a/index.js +++ b/index.js @@ -3183,7 +3183,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } else { this.command('turnOff', null, service); } - else { + } else { if(service.actions.on) { this.command('turnOn', null, service); } else if(service.actions.slider && service.LightType) { From b41600104c4e7d7caa7d347e60af7ffd91feb462 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:21:54 +0200 Subject: [PATCH 08/56] Update index.js --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ef8f86c..359128d 100755 --- a/index.js +++ b/index.js @@ -419,7 +419,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { let LightType="Switch"; HBservice = { controlService : new Service.Lightbulb(eqLogic.name), - characteristics : [Characteristic.On], + characteristics : [], }; const Serv = HBservice.controlService; Serv.eqLogic=eqLogic; @@ -453,6 +453,10 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { if (Serv.actions.on && !Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Lumière OFF"');} if (!Serv.actions.on && Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Lumière ON"');} if (!Serv.actions.on && !Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Lumière ON" et "Action/Lumière OFF"');} + else { + HBservice.characteristics.push(Characteristic.On); + Serv.addCharacteristic(Characteristic.On); + } if (Serv.infos.color && !Serv.actions.setcolor) {this.log('|warning','Pas de type générique "Action/Lumière Couleur"');} if (!Serv.infos.color && Serv.actions.setcolor) {this.log('|warning','Pas de type générique "Info/Lumière Couleur"');} if (Serv.infos.color_temp && !Serv.actions.setcolor_temp) {this.log('|warning','Pas de type générique "Action/Lumière Température Couleur"');} From 82a8a894e0b90071c0a16bb0597aee34ad22f468 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:28:21 +0200 Subject: [PATCH 09/56] Update index.js --- index.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/index.js b/index.js index 359128d..ef8f86c 100755 --- a/index.js +++ b/index.js @@ -419,7 +419,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { let LightType="Switch"; HBservice = { controlService : new Service.Lightbulb(eqLogic.name), - characteristics : [], + characteristics : [Characteristic.On], }; const Serv = HBservice.controlService; Serv.eqLogic=eqLogic; @@ -453,10 +453,6 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { if (Serv.actions.on && !Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Lumière OFF"');} if (!Serv.actions.on && Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Lumière ON"');} if (!Serv.actions.on && !Serv.actions.off) {this.log('|warning','Pas de type générique "Action/Lumière ON" et "Action/Lumière OFF"');} - else { - HBservice.characteristics.push(Characteristic.On); - Serv.addCharacteristic(Characteristic.On); - } if (Serv.infos.color && !Serv.actions.setcolor) {this.log('|warning','Pas de type générique "Action/Lumière Couleur"');} if (!Serv.infos.color && Serv.actions.setcolor) {this.log('|warning','Pas de type générique "Info/Lumière Couleur"');} if (Serv.infos.color_temp && !Serv.actions.setcolor_temp) {this.log('|warning','Pas de type générique "Action/Lumière Température Couleur"');} From 85557a4cf25d530a91e8840740c165ae926f3565 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:35:31 +0200 Subject: [PATCH 10/56] Update index.js --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index ef8f86c..0f11f68 100755 --- a/index.js +++ b/index.js @@ -3176,6 +3176,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } } if(value == 0) { + // if we want to turn the switch off if(service.actions.off) { this.command('turnOff', null, service); } else if(service.actions.slider && service.LightType) { @@ -3184,6 +3185,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser this.command('turnOff', null, service); } } else { + // if we want to turn the switch on if(service.actions.on) { this.command('turnOn', null, service); } else if(service.actions.slider && service.LightType) { From d250114672fa6980740a4924dfd2c37d922db8c1 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:37:31 +0200 Subject: [PATCH 11/56] Update index.js --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 0f11f68..49bc9bc 100755 --- a/index.js +++ b/index.js @@ -3186,6 +3186,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } } else { // if we want to turn the switch on + void 0; if(service.actions.on) { this.command('turnOn', null, service); } else if(service.actions.slider && service.LightType) { From dd194c79e64eda1ba04cb4c746757e112e0e9b2a Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:41:05 +0200 Subject: [PATCH 12/56] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 49bc9bc..c6f9ece 100755 --- a/index.js +++ b/index.js @@ -3186,7 +3186,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } } else { // if we want to turn the switch on - void 0; + this.log('nothing',''); if(service.actions.on) { this.command('turnOn', null, service); } else if(service.actions.slider && service.LightType) { From f4d4f722fe5b21f9cad567503e5b50f3ee81d122 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:45:51 +0200 Subject: [PATCH 13/56] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index c6f9ece..7355388 100755 --- a/index.js +++ b/index.js @@ -3186,7 +3186,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } } else { // if we want to turn the switch on - this.log('nothing',''); + let doNothing=""; if(service.actions.on) { this.command('turnOn', null, service); } else if(service.actions.slider && service.LightType) { From a3030d45d5ef8da828d453da9d3f7c91830aafae Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:47:46 +0200 Subject: [PATCH 14/56] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 7355388..0fecca7 100755 --- a/index.js +++ b/index.js @@ -3186,7 +3186,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } } else { // if we want to turn the switch on - let doNothing=""; + let _doNothing=null; if(service.actions.on) { this.command('turnOn', null, service); } else if(service.actions.slider && service.LightType) { From 5ce7af334743adaea2dc4d03f09cde9456225ccc Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 3 Jun 2024 15:49:45 +0200 Subject: [PATCH 15/56] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 0fecca7..0a94c05 100755 --- a/index.js +++ b/index.js @@ -3186,7 +3186,7 @@ JeedomPlatform.prototype.setAccessoryValue = function(value, characteristic, ser } } else { // if we want to turn the switch on - let _doNothing=null; + const _doNothing=null; if(service.actions.on) { this.command('turnOn', null, service); } else if(service.actions.slider && service.LightType) { From dd4fffa58f9e6e963fde840f2cf17b9499769540 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sat, 20 Jul 2024 15:36:08 +0200 Subject: [PATCH 16/56] Prepare for Homebridge 2.0 and HAP-NodeJS 1.0 --- index.js | 152 +++++++++++++++++++++++++++---------------------------- 1 file changed, 75 insertions(+), 77 deletions(-) diff --git a/index.js b/index.js index 0a94c05..6f1ecbf 100755 --- a/index.js +++ b/index.js @@ -16,7 +16,7 @@ /* jshint esversion: 11,node: true,-W041: false */ 'use strict'; -let Access, Accessory, Service, Characteristic, AdaptiveLightingController, UUIDGen; +let Access, Accessory, Service, Characteristic, AdaptiveLightingController, UUIDGen, Units, Formats, Perms, FakeGatoHistoryService; const fs = require('fs'); const inherits = require('util').inherits; const myLogger = require('./lib/myLogger').myLogger; @@ -29,7 +29,6 @@ debug.WARNING = 300; debug.ERROR = 400; debug.NO = 1000; let hasError = false; -let FakeGatoHistoryService; let DEV_DEBUG=false; const GenericAssociated = ['GENERIC_INFO','SHOCK','RAIN_CURRENT','RAIN_TOTAL','WIND_SPEED','WIND_DIRECTION','MODE_STATE']; const PushButtonAssociated = ['PUSH_BUTTON','CAMERA_UP','CAMERA_DOWN','CAMERA_LEFT','CAMERA_RIGHT','CAMERA_ZOOM','CAMERA_DEZOOM','CAMERA_PRESET','FLAP_UP','FLAP_DOWN','FLAP_STOP']; @@ -39,6 +38,9 @@ module.exports = function(homebridge) { Service = homebridge.hap.Service; Characteristic = homebridge.hap.Characteristic; Access = homebridge.hap.Access; + Units = homebridge.hap.Units; + Formats = homebridge.hap.Formats; + Perms = homebridge.hap.Perms; AdaptiveLightingController = homebridge.hap.AdaptiveLightingController; UUIDGen = homebridge.hap.uuid; FakeGatoHistoryService = require('fakegato-history')(homebridge); @@ -2941,10 +2943,6 @@ JeedomPlatform.prototype.addAccessory = function(jeedomAccessory) { const exec = require('child_process').exec; exec('sudo rm -f '+this.pathHomebridgeConf+'*_persist.json'); } - - // No more supported by HAP-NodeJS - // HBAccessory.reachable = true; - // HBAccessory.updateReachability(true); if(!isNewAccessory) { const cachedValues=jeedomAccessory.delServices(HBAccessory); @@ -5025,34 +5023,34 @@ function sanitizeValue(currentValue,characteristic) { } switch(characteristic.props.format) { - case Characteristic.Formats.UINT8 : - case Characteristic.Formats.UINT16: - case Characteristic.Formats.UINT32 : - case Characteristic.Formats.UINT64 : + case Formats.UINT8 : + case Formats.UINT16: + case Formats.UINT32 : + case Formats.UINT64 : val = parseInt(currentValue); val = Math.abs(val); // unsigned if(!val) {val = 0;} if(characteristic.props.minValue != null && characteristic.props.minValue != undefined && val < parseInt(characteristic.props.minValue)) {val = parseInt(characteristic.props.minValue);} if(characteristic.props.maxValue != null && characteristic.props.maxValue != undefined && val > parseInt(characteristic.props.maxValue)) {val = parseInt(characteristic.props.maxValue);} break; - case Characteristic.Formats.INT : + case Formats.INT : val = parseInt(currentValue); if(!val) {val = 0;} if(characteristic.props.minValue != null && characteristic.props.minValue != undefined && val < parseInt(characteristic.props.minValue)) {val = parseInt(characteristic.props.minValue);} if(characteristic.props.maxValue != null && characteristic.props.maxValue != undefined && val > parseInt(characteristic.props.maxValue)) {val = parseInt(characteristic.props.maxValue);} break; - case Characteristic.Formats.FLOAT : + case Formats.FLOAT : val = minStepRound(parseFloat(currentValue),characteristic); if(!val) {val = 0.0;} if(characteristic.props.minValue != null && characteristic.props.minValue != undefined && val < parseFloat(characteristic.props.minValue)) {val = parseFloat(characteristic.props.minValue);} if(characteristic.props.maxValue != null && characteristic.props.maxValue != undefined && val > parseFloat(characteristic.props.maxValue)) {val = parseFloat(characteristic.props.maxValue);} break; - case Characteristic.Formats.BOOL : + case Formats.BOOL : val = toBool(currentValue); if(!val) {val = false;} break; - case Characteristic.Formats.STRING : - case Characteristic.Formats.TLV8 : + case Formats.STRING : + case Formats.TLV8 : if(currentValue !== undefined) { val = currentValue.toString(); } @@ -5841,12 +5839,12 @@ function RegisterCustomCharacteristics() { Characteristic.TimeInterval = function() { Characteristic.call(this, 'Time Interval', '2A6529B5-5825-4AF3-AD52-20288FBDA115'); this.setProps({ - format : Characteristic.Formats.FLOAT, - unit : Characteristic.Units.SECONDS, + format : Formats.FLOAT, + unit : Units.SECONDS, maxValue : 21600, // 12 hours minValue : 0, minStep : 900, // 15 min - perms : [Characteristic.Perms.READ, Characteristic.Perms.WRITE, Characteristic.Perms.NOTIFY], + perms : [Perms.READ, Perms.WRITE, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -5856,12 +5854,12 @@ function RegisterCustomCharacteristics() { Characteristic.CurrentPowerConsumption = function() { Characteristic.call(this, 'Consumption', 'E863F10D-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format : Characteristic.Formats.UINT16, + format : Formats.UINT16, unit : 'Watts', maxValue : 100000, minValue : -100000, minStep : 1, - perms : [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms : [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -5871,12 +5869,12 @@ function RegisterCustomCharacteristics() { Characteristic.TotalPowerConsumption = function() { Characteristic.call(this, 'Total Consumption', 'E863F10C-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format : Characteristic.Formats.FLOAT, // Deviation from Eve Energy observed type + format : Formats.FLOAT, // Deviation from Eve Energy observed type unit : 'kWh', maxValue : 100000000000, minValue : 0, minStep : 0.001, - perms : [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms : [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -5886,11 +5884,11 @@ function RegisterCustomCharacteristics() { Characteristic.UVIndex = function() { Characteristic.call(this, 'UV Index', '05ba0fe0-b848-4226-906d-5b64272e05ce'); this.setProps({ - format: Characteristic.Formats.UINT8, + format: Formats.UINT8, maxValue: 10, minValue: 0, minStep: 1, - perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -5900,12 +5898,12 @@ function RegisterCustomCharacteristics() { Characteristic.AirPressure = function() { Characteristic.call(this, 'Air Pressure', 'E863F10F-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format: Characteristic.Formats.UINT16, + format: Formats.UINT16, unit: "hPa", maxValue: 1100, minValue: 700, minStep: 1, - perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -5916,8 +5914,8 @@ function RegisterCustomCharacteristics() { Characteristic.TimesOpened = function() { Characteristic.call(this, 'TimesOpened', 'E863F129-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format: Characteristic.Formats.UINT32, - perms: [ Characteristic.Perms.WRITE, Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -5927,8 +5925,8 @@ function RegisterCustomCharacteristics() { Characteristic.Char118 = function() { Characteristic.call(this, 'Char118', 'E863F118-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format: Characteristic.Formats.UINT32, - perms: [ Characteristic.Perms.WRITE, Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -5938,8 +5936,8 @@ function RegisterCustomCharacteristics() { Characteristic.Char119 = function() { Characteristic.call(this, 'Char119', 'E863F119-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format: Characteristic.Formats.UINT32, - perms: [ Characteristic.Perms.WRITE, Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -5949,8 +5947,8 @@ function RegisterCustomCharacteristics() { Characteristic.LastActivation = function() { Characteristic.call(this, 'LastActivation', 'E863F11A-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format: Characteristic.Formats.UINT32, - perms: [ Characteristic.Perms.WRITE, Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -5960,8 +5958,8 @@ function RegisterCustomCharacteristics() { Characteristic.ResetTotal = function() { Characteristic.call(this, 'ResetTotal', 'E863F112-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format: Characteristic.Formats.UINT32, - perms: [ Characteristic.Perms.WRITE, Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -5973,11 +5971,11 @@ function RegisterCustomCharacteristics() { Characteristic.Sensitivity = function() { Characteristic.call(this, 'Sensitivity', 'E863F120-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format: Characteristic.Formats.UINT16, + format: Formats.UINT16, maxValue: 7, minValue: 0, minStep: 1, - perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE], + perms: [Perms.READ, Perms.WRITE], }); this.value = this.getDefaultValue(); }; @@ -5987,11 +5985,11 @@ function RegisterCustomCharacteristics() { Characteristic.Duration = function() { Characteristic.call(this, 'Duration', 'E863F12D-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format: Characteristic.Formats.UINT16, + format: Formats.UINT16, maxValue: 3600, minValue: 0, minStep: 1, - perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE], + perms: [Perms.READ, Perms.WRITE], }); this.value = this.getDefaultValue(); }; @@ -6004,9 +6002,9 @@ function RegisterCustomCharacteristics() { Characteristic.GenericINT = function() { Characteristic.call(this, 'ValueINT', '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'); this.setProps({ - format: Characteristic.Formats.INT, + format: Formats.INT, minStep: 1, - perms: [ Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms: [ Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6016,9 +6014,9 @@ function RegisterCustomCharacteristics() { Characteristic.GenericFLOAT = function() { Characteristic.call(this, 'ValueFLOAT', '0168A695-70A7-4AF7-A800-417D30055719'); this.setProps({ - format: Characteristic.Formats.FLOAT, + format: Formats.FLOAT, minStep: 0.01, - perms: [ Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms: [ Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6028,8 +6026,8 @@ function RegisterCustomCharacteristics() { Characteristic.GenericBOOL = function() { Characteristic.call(this, 'ValueBOOL', 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'); this.setProps({ - format: Characteristic.Formats.BOOL, - perms: [ Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + format: Formats.BOOL, + perms: [ Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6039,8 +6037,8 @@ function RegisterCustomCharacteristics() { Characteristic.GenericSTRING = function() { Characteristic.call(this, 'ValueSTRING', 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'); this.setProps({ - format: Characteristic.Formats.STRING, - perms: [ Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + format: Formats.STRING, + perms: [ Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6050,10 +6048,10 @@ function RegisterCustomCharacteristics() { Characteristic.AQI = function() { Characteristic.call(this, 'Index', '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'); this.setProps({ - format: Characteristic.Formats.INT, + format: Formats.INT, unit: '', minStep: 1, - perms: [ Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms: [ Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6063,8 +6061,8 @@ function RegisterCustomCharacteristics() { Characteristic.PPM = function() { Characteristic.call(this, 'PPM', 'E863F10B-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format: Characteristic.Formats.UINT16, - perms: [ Characteristic.Perms.READ, Characteristic.Perms.HIDDEN], + format: Formats.UINT16, + perms: [ Perms.READ, Perms.HIDDEN], }); this.value = this.getDefaultValue(); }; @@ -6074,8 +6072,8 @@ function RegisterCustomCharacteristics() { Characteristic.AQExtraCharacteristic = function() { Characteristic.call(this, 'AQX2', 'E863F132-079E-48FF-8F27-9C2605A29F52'); this.setProps({ - format: Characteristic.Formats.DATA, - perms: [ Characteristic.Perms.READ, Characteristic.Perms.HIDDEN], + format: Formats.DATA, + perms: [ Perms.READ, Perms.HIDDEN], }); this.value = this.getDefaultValue(); }; @@ -6085,12 +6083,12 @@ function RegisterCustomCharacteristics() { Characteristic.WindSpeed = function() { Characteristic.call(this, 'Wind speed', '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'); this.setProps({ - format: Characteristic.Formats.FLOAT, + format: Formats.FLOAT, unit: "km/h", maxValue: 100, minValue: 0, minStep: 0.1, - perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6100,8 +6098,8 @@ function RegisterCustomCharacteristics() { Characteristic.WindDirection = function() { Characteristic.call(this, 'Wind direction', '46f1284c-1912-421b-82f5-eb75008b167e'); this.setProps({ - format: Characteristic.Formats.STRING, - perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + format: Formats.STRING, + perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6111,8 +6109,8 @@ function RegisterCustomCharacteristics() { Characteristic.WeatherCondition = function() { Characteristic.call(this, 'Condition', 'cd65a9ab-85ad-494a-b2bd-2f380084134d'); this.setProps({ - format: Characteristic.Formats.STRING, - perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + format: Formats.STRING, + perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6122,12 +6120,12 @@ function RegisterCustomCharacteristics() { Characteristic.Visibility = function() { Characteristic.call(this, 'Visibility', 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'); this.setProps({ - format: Characteristic.Formats.UINT8, + format: Formats.UINT8, unit: "km", maxValue: 200, minValue: 0, minStep: 1, - perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6137,8 +6135,8 @@ function RegisterCustomCharacteristics() { Characteristic.Rain = function() { Characteristic.call(this, 'Rain', 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'); this.setProps({ - format: Characteristic.Formats.BOOL, - perms: [ Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + format: Formats.BOOL, + perms: [ Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6148,8 +6146,8 @@ function RegisterCustomCharacteristics() { Characteristic.Snow = function() { Characteristic.call(this, 'Snow', 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'); this.setProps({ - format: Characteristic.Formats.BOOL, - perms: [ Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + format: Formats.BOOL, + perms: [ Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6159,12 +6157,12 @@ function RegisterCustomCharacteristics() { Characteristic.MinimumTemperature = function() { Characteristic.call(this, 'MinimumTemperature', '707B78CA-51AB-4DC9-8630-80A58F07E419'); this.setProps({ - format: Characteristic.Formats.FLOAT, - unit: Characteristic.Units.CELSIUS, + format: Formats.FLOAT, + unit: Units.CELSIUS, maxValue: 100, minValue: -40, minStep: 0.1, - perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6174,12 +6172,12 @@ function RegisterCustomCharacteristics() { Characteristic.NoiseLevel = function() { Characteristic.call(this, 'Noise Level', 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'); this.setProps({ - format: Characteristic.Formats.UINT8, + format: Formats.UINT8, unit: "dB", maxValue: 1000, minValue: 0, minStep: 1, - perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6189,11 +6187,11 @@ function RegisterCustomCharacteristics() { Characteristic.NoiseQuality = function() { Characteristic.call(this, 'Noise Quality', '627ea399-29d9-5dc8-9a02-08ae928f73d8'); this.setProps({ - format: Characteristic.Formats.UINT8, + format: Formats.UINT8, maxValue: 5, minValue: 0, minStep: 1, - perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6211,11 +6209,11 @@ function RegisterCustomCharacteristics() { Characteristic.SetDuration = function() { Characteristic.call(this, 'Set Duration', '000000D3-0000-1000-8000-0026BB765291'); this.setProps({ - format: Characteristic.Formats.UINT32, + format: Formats.UINT32, maxValue: 3600, minValue: 0, minStep: 1, - perms: [Characteristic.Perms.READ, Characteristic.Perms.WRITE, Characteristic.Perms.NOTIFY], + perms: [Perms.READ, Perms.WRITE, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; @@ -6225,11 +6223,11 @@ function RegisterCustomCharacteristics() { Characteristic.RemainingDuration = function() { Characteristic.call(this, 'Remaining Duration', '000000D4-0000-1000-8000-0026BB765291'); this.setProps({ - format: Characteristic.Formats.UINT32, + format: Formats.UINT32, maxValue: 3600, minValue: 0, minStep: 1, - perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY], + perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); }; From f837cf8ddca0742519a2b31b80ec47f081de438b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 20 Jul 2024 13:36:35 +0000 Subject: [PATCH 17/56] Update @babel/core requirement from >=7.24.5 to >=7.24.9 (#237) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 043f787..450d1da 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "fakegato-history": "NebzHB/fakegato-history#master" }, "devDependencies": { - "@babel/core": ">=7.24.5", + "@babel/core": ">=7.24.9", "@babel/eslint-parser": "^7.24.5", "eslint": "^8.57.0" }, From 693d2484546663f9f23d0df9524da9a438c6014b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 20 Jul 2024 13:36:50 +0000 Subject: [PATCH 18/56] Bump axios from 1.7.1 to 1.7.2 (#230) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 450d1da..7ad1652 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "dependencies": { "async": "3.2.5", - "axios": "1.7.1", + "axios": "1.7.2", "express": "4.19.2", "fakegato-history": "NebzHB/fakegato-history#master" }, From c10a2dfe67c37d52e2883ab3cd1e6ba3c24daa6e Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sat, 20 Jul 2024 15:49:02 +0200 Subject: [PATCH 19/56] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7ad1652..9eb71ee 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nebz/homebridge-jeedom", "version": "v1.7.0", - "cust_serial": "0029", + "cust_serial": "0030", "description": "Homebridge plugin for Jeedom ", "main": "index.js", "private":true, From cc716820a25f52319e246537f8a88c297c869b0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 20 Jul 2024 13:49:16 +0000 Subject: [PATCH 20/56] Update @babel/eslint-parser requirement from ^7.24.5 to ^7.24.8 (#236) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9eb71ee..793c826 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "devDependencies": { "@babel/core": ">=7.24.9", - "@babel/eslint-parser": "^7.24.5", + "@babel/eslint-parser": "^7.24.8", "eslint": "^8.57.0" }, "author": "Nebz ", From 91fff870d8b00f90e1fbb09cd08169e6080da7a0 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 08:06:31 +0200 Subject: [PATCH 21/56] Update package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 793c826..f616260 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,8 @@ "start": "echo \"Error: configure and run homebridge to start\" && exit 1" }, "engines": { - "node": ">=10.17.0", - "homebridge": ">=0.4.38" + "node": "^18.0.0", + "homebridge": "^1.6.0 || ^2.0.0-beta.0" }, "repository": { "type": "git", From ef7d91fc842cf3f7fd2854ca33fd31a168e2f645 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 08:19:38 +0200 Subject: [PATCH 22/56] Update for hap 2 --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 6f1ecbf..e4c3605 100755 --- a/index.js +++ b/index.js @@ -1195,7 +1195,7 @@ JeedomPlatform.prototype.AccessoireCreateHomebridge = function(eqLogic) { eqLogic.services.battery.forEach((cmd) => { if (!cmd.battery) {return;} HBservice = { - controlService : new Service.BatteryService(eqLogic.name), + controlService : new Service.Battery(eqLogic.name), characteristics : [Characteristic.BatteryLevel,Characteristic.ChargingState,Characteristic.StatusLowBattery], }; const Serv = HBservice.controlService; @@ -6431,7 +6431,7 @@ JeedomBridgedAccessory.prototype.delServices = function(accessory) { let service; try { const cachedValues = []; - const serviceList = accessory.services.filter((svc) => svc.UUID !== Service.AccessoryInformation.UUID && svc.UUID !== Service.BridgingState.UUID); + const serviceList = accessory.services.filter((svc) => svc.UUID !== Service.AccessoryInformation.UUID); serviceList.forEach((svc) => { service=svc; From e39024689c81f5a8d92233483b1fd61069a9d75b Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 08:19:50 +0200 Subject: [PATCH 23/56] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f616260..5771436 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nebz/homebridge-jeedom", "version": "v1.7.0", - "cust_serial": "0030", + "cust_serial": "0031", "description": "Homebridge plugin for Jeedom ", "main": "index.js", "private":true, From f56fbe03e01cd6efbaaffb18b6e8abff1b5a28c1 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 08:53:02 +0200 Subject: [PATCH 24/56] Update index.js --- index.js | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/index.js b/index.js index e4c3605..f8d4a15 100755 --- a/index.js +++ b/index.js @@ -5835,21 +5835,21 @@ JeedomPlatform.prototype.syncColorCharacteristics = function(rgb, service) { // -- Params -- // -- Return : nothing function RegisterCustomCharacteristics() { - // Custom Services and Characteristics - Characteristic.TimeInterval = function() { - Characteristic.call(this, 'Time Interval', '2A6529B5-5825-4AF3-AD52-20288FBDA115'); - this.setProps({ - format : Formats.FLOAT, - unit : Units.SECONDS, - maxValue : 21600, // 12 hours - minValue : 0, - minStep : 900, // 15 min - perms : [Perms.READ, Perms.WRITE, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - inherits(Characteristic.TimeInterval, Characteristic); - Characteristic.TimeInterval.UUID = '2A6529B5-5825-4AF3-AD52-20288FBDA115'; + // Custom Services and Characteristics + class TimeInterval extends Characteristic { + constructor() { + super('Time Interval', TimeInterval.UUID); + this.setProps({ + format : Formats.FLOAT, + unit : Units.SECONDS, + maxValue : 21600, // 12 hours + minValue : 0, + minStep : 900, // 15 min + perms : [Perms.READ, Perms.WRITE, Perms.NOTIFY], + }); + } + } + TimeInterval.UUID = '2A6529B5-5825-4AF3-AD52-20288FBDA115'; Characteristic.CurrentPowerConsumption = function() { Characteristic.call(this, 'Consumption', 'E863F10D-079E-48FF-8F27-9C2605A29F52'); @@ -5911,16 +5911,17 @@ function RegisterCustomCharacteristics() { Characteristic.AirPressure.UUID = 'E863F10F-079E-48FF-8F27-9C2605A29F52'; // contacts helpers, need to identify - Characteristic.TimesOpened = function() { - Characteristic.call(this, 'TimesOpened', 'E863F129-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT32, - perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.TimesOpened.UUID = 'E863F129-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.TimesOpened, Characteristic); + class TimesOpened extends Characteristic { + constructor() { + super('TimesOpened', TimesOpened.UUID); + this.setProps({ + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + TimesOpened.UUID = 'E863F129-079E-48FF-8F27-9C2605A29F52'; Characteristic.Char118 = function() { Characteristic.call(this, 'Char118', 'E863F118-079E-48FF-8F27-9C2605A29F52'); From c6f1d3e8de3db275fd0c0437c93a75bb9b53059c Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 09:38:17 +0200 Subject: [PATCH 25/56] fix char and serv declarations --- index.js | 771 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 398 insertions(+), 373 deletions(-) diff --git a/index.js b/index.js index f8d4a15..60e3d59 100755 --- a/index.js +++ b/index.js @@ -5847,68 +5847,73 @@ function RegisterCustomCharacteristics() { minStep : 900, // 15 min perms : [Perms.READ, Perms.WRITE, Perms.NOTIFY], }); + this.value = this.getDefaultValue(); } } TimeInterval.UUID = '2A6529B5-5825-4AF3-AD52-20288FBDA115'; - Characteristic.CurrentPowerConsumption = function() { - Characteristic.call(this, 'Consumption', 'E863F10D-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format : Formats.UINT16, - unit : 'Watts', - maxValue : 100000, - minValue : -100000, - minStep : 1, - perms : [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - inherits(Characteristic.CurrentPowerConsumption, Characteristic); - Characteristic.CurrentPowerConsumption.UUID = 'E863F10D-079E-48FF-8F27-9C2605A29F52'; - - Characteristic.TotalPowerConsumption = function() { - Characteristic.call(this, 'Total Consumption', 'E863F10C-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format : Formats.FLOAT, // Deviation from Eve Energy observed type - unit : 'kWh', - maxValue : 100000000000, - minValue : 0, - minStep : 0.001, - perms : [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - inherits(Characteristic.TotalPowerConsumption, Characteristic); - Characteristic.TotalPowerConsumption.UUID = 'E863F10C-079E-48FF-8F27-9C2605A29F52'; - - Characteristic.UVIndex = function() { - Characteristic.call(this, 'UV Index', '05ba0fe0-b848-4226-906d-5b64272e05ce'); - this.setProps({ - format: Formats.UINT8, - maxValue: 10, - minValue: 0, - minStep: 1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - inherits(Characteristic.UVIndex, Characteristic); - Characteristic.UVIndex.UUID = '05ba0fe0-b848-4226-906d-5b64272e05ce'; - - Characteristic.AirPressure = function() { - Characteristic.call(this, 'Air Pressure', 'E863F10F-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT16, - unit: "hPa", - maxValue: 1100, - minValue: 700, - minStep: 1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - inherits(Characteristic.AirPressure, Characteristic); - Characteristic.AirPressure.UUID = 'E863F10F-079E-48FF-8F27-9C2605A29F52'; + class CurrentPowerConsumption extends Characteristic { + constructor() { + super('Consumption', CurrentPowerConsumption.UUID); + this.setProps({ + format: Formats.UINT16, + unit: 'Watts', + maxValue: 100000, + minValue: -100000, + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + CurrentPowerConsumption.UUID = 'E863F10D-079E-48FF-8F27-9C2605A29F52'; + + class TotalPowerConsumption extends Characteristic { + constructor() { + super('Total Consumption', TotalPowerConsumption.UUID); + this.setProps({ + format: Formats.FLOAT, + unit: 'kWh', + maxValue: 100000000000, + minValue: 0, + minStep: 0.001, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + TotalPowerConsumption.UUID = 'E863F10C-079E-48FF-8F27-9C2605A29F52'; + + class UVIndex extends Characteristic { + constructor() { + super('UV Index', UVIndex.UUID); + this.setProps({ + format: Formats.UINT8, + maxValue: 10, + minValue: 0, + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + UVIndex.UUID = '05ba0fe0-b848-4226-906d-5b64272e05ce'; + + class AirPressure extends Characteristic { + constructor() { + super('Air Pressure', AirPressure.UUID); + this.setProps({ + format: Formats.UINT16, + unit: 'hPa', + maxValue: 1100, + minValue: 700, + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + AirPressure.UUID = 'E863F10F-079E-48FF-8F27-9C2605A29F52'; // contacts helpers, need to identify class TimesOpened extends Characteristic { @@ -5923,203 +5928,220 @@ function RegisterCustomCharacteristics() { } TimesOpened.UUID = 'E863F129-079E-48FF-8F27-9C2605A29F52'; - Characteristic.Char118 = function() { - Characteristic.call(this, 'Char118', 'E863F118-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT32, - perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Char118.UUID = 'E863F118-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.Char118, Characteristic); + class Char118 extends Characteristic { + constructor() { + super('Char118', Char118.UUID); + this.setProps({ + format: Formats.UINT32, + perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + Char118.UUID = 'E863F118-079E-48FF-8F27-9C2605A29F52'; - Characteristic.Char119 = function() { - Characteristic.call(this, 'Char119', 'E863F119-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT32, - perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Char119.UUID = 'E863F119-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.Char119, Characteristic); + class Char119 extends Characteristic { + constructor() { + super('Char119', Char119.UUID); + this.setProps({ + format: Formats.UINT32, + perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + Char119.UUID = 'E863F119-079E-48FF-8F27-9C2605A29F52'; - Characteristic.LastActivation = function() { - Characteristic.call(this, 'LastActivation', 'E863F11A-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT32, - perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.LastActivation.UUID = 'E863F11A-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.LastActivation, Characteristic); + class LastActivation extends Characteristic { + constructor() { + super('LastActivation', LastActivation.UUID); + this.setProps({ + format: Formats.UINT32, + perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + LastActivation.UUID = 'E863F11A-079E-48FF-8F27-9C2605A29F52'; - Characteristic.ResetTotal = function() { - Characteristic.call(this, 'ResetTotal', 'E863F112-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT32, - perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.ResetTotal.UUID = 'E863F112-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.ResetTotal, Characteristic); + class ResetTotal extends Characteristic { + constructor() { + super('ResetTotal', ResetTotal.UUID); + this.setProps({ + format: Formats.UINT32, + perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + ResetTotal.UUID = 'E863F112-079E-48FF-8F27-9C2605A29F52'; // / contacts helpers // Motion Helpers - Characteristic.Sensitivity = function() { - Characteristic.call(this, 'Sensitivity', 'E863F120-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT16, - maxValue: 7, - minValue: 0, - minStep: 1, - perms: [Perms.READ, Perms.WRITE], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Sensitivity.UUID = 'E863F120-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.Sensitivity, Characteristic); - - Characteristic.Duration = function() { - Characteristic.call(this, 'Duration', 'E863F12D-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT16, - maxValue: 3600, - minValue: 0, - minStep: 1, - perms: [Perms.READ, Perms.WRITE], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Duration.UUID = 'E863F12D-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.Duration, Characteristic); + class Sensitivity extends Characteristic { + constructor() { + super('Sensitivity', Sensitivity.UUID); + this.setProps({ + format: Formats.UINT16, + maxValue: 7, + minValue: 0, + minStep: 1, + perms: [Perms.READ, Perms.WRITE], + }); + this.value = this.getDefaultValue(); + } + } + Sensitivity.UUID = 'E863F120-079E-48FF-8F27-9C2605A29F52'; + + class Duration extends Characteristic { + constructor() { + super('Duration', Duration.UUID); + this.setProps({ + format: Formats.UINT16, + maxValue: 3600, + minValue: 0, + minStep: 1, + perms: [Perms.READ, Perms.WRITE], + }); + this.value = this.getDefaultValue(); + } + } + Duration.UUID = 'E863F12D-079E-48FF-8F27-9C2605A29F52'; // /Motion Helpers - Characteristic.GenericINT = function() { - Characteristic.call(this, 'ValueINT', '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'); - this.setProps({ - format: Formats.INT, - minStep: 1, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.GenericINT.UUID = '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'; - inherits(Characteristic.GenericINT, Characteristic); + class GenericINT extends Characteristic { + constructor() { + super('ValueINT', GenericINT.UUID); + this.setProps({ + format: Formats.INT, + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + GenericINT.UUID = '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'; - Characteristic.GenericFLOAT = function() { - Characteristic.call(this, 'ValueFLOAT', '0168A695-70A7-4AF7-A800-417D30055719'); - this.setProps({ - format: Formats.FLOAT, - minStep: 0.01, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.GenericFLOAT.UUID = '0168A695-70A7-4AF7-A800-417D30055719'; - inherits(Characteristic.GenericFLOAT, Characteristic); + class GenericFLOAT extends Characteristic { + constructor() { + super('ValueFLOAT', GenericFLOAT.UUID); + this.setProps({ + format: Formats.FLOAT, + minStep: 0.01, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + GenericFLOAT.UUID = '0168A695-70A7-4AF7-A800-417D30055719'; - Characteristic.GenericBOOL = function() { - Characteristic.call(this, 'ValueBOOL', 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'); - this.setProps({ - format: Formats.BOOL, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.GenericBOOL.UUID = 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'; - inherits(Characteristic.GenericBOOL, Characteristic); - - Characteristic.GenericSTRING = function() { - Characteristic.call(this, 'ValueSTRING', 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'); - this.setProps({ - format: Formats.STRING, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.GenericSTRING.UUID = 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'; - inherits(Characteristic.GenericSTRING, Characteristic); + class GenericBOOL extends Characteristic { + constructor() { + super('ValueBOOL', GenericBOOL.UUID); + this.setProps({ + format: Formats.BOOL, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + GenericBOOL.UUID = 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'; + + class GenericSTRING extends Characteristic { + constructor() { + super('ValueSTRING', GenericSTRING.UUID); + this.setProps({ + format: Formats.STRING, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + GenericSTRING.UUID = 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'; - Characteristic.AQI = function() { - Characteristic.call(this, 'Index', '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'); - this.setProps({ - format: Formats.INT, - unit: '', - minStep: 1, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.AQI.UUID = '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'; - inherits(Characteristic.AQI, Characteristic); - - Characteristic.PPM = function() { - Characteristic.call(this, 'PPM', 'E863F10B-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT16, - perms: [ Perms.READ, Perms.HIDDEN], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.PPM.UUID = 'E863F10B-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.PPM, Characteristic); - - Characteristic.AQExtraCharacteristic = function() { - Characteristic.call(this, 'AQX2', 'E863F132-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.DATA, - perms: [ Perms.READ, Perms.HIDDEN], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.AQExtraCharacteristic.UUID = 'E863F132-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.AQExtraCharacteristic, Characteristic); + class AQI extends Characteristic { + constructor() { + super('Index', AQI.UUID); + this.setProps({ + format: Formats.INT, + unit: '', + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + AQI.UUID = '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'; + + class PPM extends Characteristic { + constructor() { + super('PPM', PPM.UUID); + this.setProps({ + format: Formats.UINT16, + perms: [Perms.READ, Perms.HIDDEN], + }); + this.value = this.getDefaultValue(); + } + } + PPM.UUID = 'E863F10B-079E-48FF-8F27-9C2605A29F52'; + + class AQExtraCharacteristic extends Characteristic { + constructor() { + super('AQX2', AQExtraCharacteristic.UUID); + this.setProps({ + format: Formats.DATA, + perms: [Perms.READ, Perms.HIDDEN], + }); + this.value = this.getDefaultValue(); + } + } + AQExtraCharacteristic.UUID = 'E863F132-079E-48FF-8F27-9C2605A29F52'; - Characteristic.WindSpeed = function() { - Characteristic.call(this, 'Wind speed', '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'); - this.setProps({ - format: Formats.FLOAT, - unit: "km/h", - maxValue: 100, - minValue: 0, - minStep: 0.1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.WindSpeed.UUID = '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'; - inherits(Characteristic.WindSpeed, Characteristic); - - Characteristic.WindDirection = function() { - Characteristic.call(this, 'Wind direction', '46f1284c-1912-421b-82f5-eb75008b167e'); - this.setProps({ - format: Formats.STRING, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.WindDirection.UUID = '46f1284c-1912-421b-82f5-eb75008b167e'; - inherits(Characteristic.WindDirection, Characteristic); - - Characteristic.WeatherCondition = function() { - Characteristic.call(this, 'Condition', 'cd65a9ab-85ad-494a-b2bd-2f380084134d'); - this.setProps({ - format: Formats.STRING, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.WeatherCondition.UUID = 'cd65a9ab-85ad-494a-b2bd-2f380084134d'; - inherits(Characteristic.WeatherCondition, Characteristic); + class WindSpeed extends Characteristic { + constructor() { + super('Wind speed', WindSpeed.UUID); + this.setProps({ + format: Formats.FLOAT, + unit: 'km/h', + maxValue: 100, + minValue: 0, + minStep: 0.1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + WindSpeed.UUID = '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'; + + class WindDirection extends Characteristic { + constructor() { + super('Wind direction', WindDirection.UUID); + this.setProps({ + format: Formats.STRING, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + WindDirection.UUID = '46f1284c-1912-421b-82f5-eb75008b167e'; - Characteristic.Visibility = function() { - Characteristic.call(this, 'Visibility', 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'); + class WeatherCondition extends Characteristic { + constructor() { + super('Condition', WeatherCondition.UUID); + this.setProps({ + format: Formats.UINT8, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + WeatherCondition.UUID = 'CD65A9AB-85AD-494A-B2BD-2F380084134D'; + + class Visibility extends Characteristic { + constructor() { + super('Visibility', Visibility.UUID); this.setProps({ format: Formats.UINT8, unit: "km", @@ -6129,49 +6151,53 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - }; - Characteristic.Visibility.UUID = 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'; - inherits(Characteristic.Visibility, Characteristic); + } + } + Visibility.UUID = 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'; - Characteristic.Rain = function() { - Characteristic.call(this, 'Rain', 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'); - this.setProps({ - format: Formats.BOOL, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Rain.UUID = 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'; - inherits(Characteristic.Rain, Characteristic); + class Rain extends Characteristic { + constructor() { + super('Rain', Rain.UUID); + this.setProps({ + format: Formats.BOOL, + perms: [ Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + Rain.UUID = 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'; - Characteristic.Snow = function() { - Characteristic.call(this, 'Snow', 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'); - this.setProps({ - format: Formats.BOOL, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Snow.UUID = 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'; - inherits(Characteristic.Snow, Characteristic); + class Snow extends Characteristic { + constructor() { + super('Snow', Snow.UUID); + this.setProps({ + format: Formats.BOOL, + perms: [ Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + Snow.UUID = 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'; - Characteristic.MinimumTemperature = function() { - Characteristic.call(this, 'MinimumTemperature', '707B78CA-51AB-4DC9-8630-80A58F07E419'); - this.setProps({ - format: Formats.FLOAT, - unit: Units.CELSIUS, - maxValue: 100, - minValue: -40, - minStep: 0.1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.MinimumTemperature.UUID = '707B78CA-51AB-4DC9-8630-80A58F07E419'; - inherits(Characteristic.MinimumTemperature, Characteristic); + class MinimumTemperature extends Characteristic { + constructor() { + super('MinimumTemperature', MinimumTemperature.UUID); + this.setProps({ + format: Formats.FLOAT, + unit: Units.CELSIUS, + maxValue: 100, + minValue: -40, + minStep: 0.1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + MinimumTemperature.UUID = '707B78CA-51AB-4DC9-8630-80A58F07E419'; - Characteristic.NoiseLevel = function() { - Characteristic.call(this, 'Noise Level', 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'); + class NoiseLevel extends Characteristic { + constructor() { + super('Noise Level', NoiseLevel.UUID); this.setProps({ format: Formats.UINT8, unit: "dB", @@ -6181,12 +6207,13 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - }; - Characteristic.NoiseLevel.UUID = 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'; - inherits(Characteristic.NoiseLevel, Characteristic); + } + } + NoiseLevel.UUID = 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'; - Characteristic.NoiseQuality = function() { - Characteristic.call(this, 'Noise Quality', '627ea399-29d9-5dc8-9a02-08ae928f73d8'); + class NoiseQuality extends Characteristic { + constructor() { + super('Noise Quality', NoiseQuality.UUID); this.setProps({ format: Formats.UINT8, maxValue: 5, @@ -6195,9 +6222,9 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - }; - Characteristic.NoiseQuality.UUID = '627ea399-29d9-5dc8-9a02-08ae928f73d8'; - inherits(Characteristic.NoiseQuality, Characteristic); + } + } + NoiseQuality.UUID = '627ea399-29d9-5dc8-9a02-08ae928f73d8'; Characteristic.NoiseQuality.UNKNOWN = 0; Characteristic.NoiseQuality.SILENT = 1; @@ -6206,9 +6233,9 @@ function RegisterCustomCharacteristics() { Characteristic.NoiseQuality.NOISY = 4; Characteristic.NoiseQuality.TOONOISY = 5; - - Characteristic.SetDuration = function() { - Characteristic.call(this, 'Set Duration', '000000D3-0000-1000-8000-0026BB765291'); + class SetDuration extends Characteristic { + constructor() { + super('Set Duration', SetDuration.UUID); this.setProps({ format: Formats.UINT32, maxValue: 3600, @@ -6217,12 +6244,13 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.WRITE, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - }; - Characteristic.SetDuration.UUID = '000000D3-0000-1000-8000-0026BB765291'; - inherits(Characteristic.SetDuration, Characteristic); + } + } + SetDuration.UUID = '000000D3-0000-1000-8000-0026BB765291'; - Characteristic.RemainingDuration = function() { - Characteristic.call(this, 'Remaining Duration', '000000D4-0000-1000-8000-0026BB765291'); + class RemainingDuration extends Characteristic { + constructor() { + super('Remaining Duration', RemainingDuration.UUID); this.setProps({ format: Formats.UINT32, maxValue: 3600, @@ -6231,9 +6259,9 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - }; - Characteristic.RemainingDuration.UUID = '000000D4-0000-1000-8000-0026BB765291'; - inherits(Characteristic.RemainingDuration, Characteristic); + } + } + RemainingDuration.UUID = '000000D4-0000-1000-8000-0026BB765291'; /** * FakeGato History Service @@ -6245,107 +6273,104 @@ function RegisterCustomCharacteristics() { * Custom Service 'Power Monitor' */ - Service.PowerMonitor = function(displayName, subtype) { - Service.call(this, displayName, '0EB29E08-C307-498E-8E1A-4EDC5FF70607', subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.CurrentPowerConsumption); - this.addCharacteristic(Characteristic.TotalPowerConsumption); - - // Optional Characteristics - - }; - inherits(Service.PowerMonitor, Service); - Service.PowerMonitor.UUID = '0EB29E08-C307-498E-8E1A-4EDC5FF70607'; + class PowerMonitor extends Service { + constructor(displayName, subtype) { + super(displayName, PowerMonitor.UUID, subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.CurrentPowerConsumption); + this.addCharacteristic(Characteristic.TotalPowerConsumption); + + // Optional Characteristics + } + } + PowerMonitor.UUID = '0EB29E08-C307-498E-8E1A-4EDC5FF70607'; /** * Custom Service 'Pressure Sensor' */ - Service.PressureSensor = function(displayName, subtype) { - Service.call(this, displayName, 'E863F00A-079E-48FF-8F27-9C2605A29F52', subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.AirPressure); - - // Optional Characteristics - - }; - inherits(Service.PressureSensor, Service); - Service.PressureSensor.UUID = 'E863F00A-079E-48FF-8F27-9C2605A29F52'; + class PressureSensor extends Service { + constructor(displayName, subtype) { + super(displayName, PressureSensor.UUID, subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.AirPressure); + + // Optional Characteristics + } + } + PressureSensor.UUID = 'E863F00A-079E-48FF-8F27-9C2605A29F52'; /** * Custom Service 'Noise Sensor' */ - Service.NoiseSensor = function(displayName, subtype) { - Service.call(this, displayName, '6237cefc-9f4d-54b2-8033-2eda0053b811', subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.NoiseLevel); - this.addCharacteristic(Characteristic.NoiseQuality); - // Optional Characteristics - - }; - inherits(Service.NoiseSensor, Service); - Service.NoiseSensor.UUID = '6237cefc-9f4d-54b2-8033-2eda0053b811'; + class NoiseSensor extends Service { + constructor(displayName, subtype) { + super(displayName, NoiseSensor.UUID, subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.NoiseLevel); + this.addCharacteristic(Characteristic.NoiseQuality); + // Optional Characteristics + } + } + NoiseSensor.UUID = '6237cefc-9f4d-54b2-8033-2eda0053b811'; /** * Custom Service 'Weather Service' */ - Service.WeatherService = function(displayName, subtype) { - Service.call(this, displayName, 'E863F001-079E-48FF-8F27-9C2605A29F52', subtype); - - // Required Characteristics - // this.addCharacteristic(Characteristic.CurrentTemperature); - // this.addCharacteristic(Characteristic.CurrentRelativeHumidity); - // this.addCharacteristic(Characteristic.AirPressure); - this.addCharacteristic(Characteristic.WeatherCondition); - - // Optional Characteristics - this.addOptionalCharacteristic(Characteristic.WindDirection); - this.addOptionalCharacteristic(Characteristic.WindSpeed); - // this.addOptionalCharacteristic(Characteristic.WeatherCondition); - this.addOptionalCharacteristic(Characteristic.UVIndex); - this.addOptionalCharacteristic(Characteristic.Rain); - this.addOptionalCharacteristic(Characteristic.Snow); - this.addOptionalCharacteristic(Characteristic.MinimumTemperature); - }; - inherits(Service.WeatherService, Service); - Service.WeatherService.UUID = 'E863F001-079E-48FF-8F27-9C2605A29F52'; + class WeatherService extends Service { + constructor(displayName, subtype) { + super(displayName, WeatherService.UUID, subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.WeatherCondition); + + // Optional Characteristics + this.addOptionalCharacteristic(Characteristic.WindDirection); + this.addOptionalCharacteristic(Characteristic.WindSpeed); + // this.addOptionalCharacteristic(Characteristic.WeatherCondition); + this.addOptionalCharacteristic(Characteristic.UVIndex); + this.addOptionalCharacteristic(Characteristic.Rain); + this.addOptionalCharacteristic(Characteristic.Snow); + this.addOptionalCharacteristic(Characteristic.MinimumTemperature); + } + } + WeatherService.UUID = 'E863F001-079E-48FF-8F27-9C2605A29F52'; /** * Custom Service 'EveRoom Service' */ - Service.EveRoomService = function(displayName, subtype) { - Service.call(this, displayName, '0000008D-0000-1000-8000-0026BB765291', subtype); - - // Required Characteristics - // this.addCharacteristic(Characteristic.CurrentTemperature); - // this.addCharacteristic(Characteristic.CurrentRelativeHumidity); - // this.addCharacteristic(Characteristic.AirPressure); - this.addCharacteristic(Characteristic.AirQuality); - - // Optional Characteristics - // this.addOptionalCharacteristic(Characteristic.WeatherCondition); - - }; - inherits(Service.EveRoomService, Service); - Service.EveRoomService.UUID = '0000008D-0000-1000-8000-0026BB765291'; + class EveRoomService extends Service { + constructor(displayName, subtype) { + super(displayName, EveRoomService.UUID, subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.AirQuality); + // Optional Characteristics + } + } + EveRoomService.UUID = '0000008D-0000-1000-8000-0026BB765291'; /** * Custom Service 'Custom Service' */ - Service.CustomService = function(displayName, subtype) { - Service.call(this, displayName, 'BF0477D3-699A-42F1-BF98-04FCCFE5C8E7', subtype); + class CustomService extends Service { + constructor(displayName, subtype) { + super(displayName, CustomService.UUID, subtype); + + // Required Characteristics - this.addOptionalCharacteristic(Characteristic.Name); - }; - inherits(Service.CustomService, Service); - Service.CustomService.UUID = 'BF0477D3-699A-42F1-BF98-04FCCFE5C8E7'; + // Optional Characteristics + this.addOptionalCharacteristic(Characteristic.Name); + } + } + CustomService.UUID = 'BF0477D3-699A-42F1-BF98-04FCCFE5C8E7'; // End of custom Services and Characteristics } From df2e13beed2257d94a8014c8f90276328c6a9bc3 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 09:41:28 +0200 Subject: [PATCH 26/56] Update index.js --- index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 60e3d59..24949d9 100755 --- a/index.js +++ b/index.js @@ -6226,12 +6226,12 @@ function RegisterCustomCharacteristics() { } NoiseQuality.UUID = '627ea399-29d9-5dc8-9a02-08ae928f73d8'; - Characteristic.NoiseQuality.UNKNOWN = 0; - Characteristic.NoiseQuality.SILENT = 1; - Characteristic.NoiseQuality.CALM = 2; - Characteristic.NoiseQuality.LIGHTLYNOISY = 3; - Characteristic.NoiseQuality.NOISY = 4; - Characteristic.NoiseQuality.TOONOISY = 5; + NoiseQuality.UNKNOWN = 0; + NoiseQuality.SILENT = 1; + NoiseQuality.CALM = 2; + NoiseQuality.LIGHTLYNOISY = 3; + NoiseQuality.NOISY = 4; + NoiseQuality.TOONOISY = 5; class SetDuration extends Characteristic { constructor() { From ef01f04916c99f4b1d835cc4cac189a8fabb9904 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 09:51:28 +0200 Subject: [PATCH 27/56] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 24949d9..99158f8 100755 --- a/index.js +++ b/index.js @@ -6414,7 +6414,7 @@ JeedomBridgedAccessory.prototype.addServices = function(newAccessory,services,ca if(!newAccessory.getService(service.controlService)){// not exist ? this.log('|debug',' Ajout service :'+service.controlService.displayName+' subtype:'+service.controlService.subtype+' cmd_id:'+service.controlService.cmd_id+' UUID:'+service.controlService.UUID); - newAccessory.addService(service.controlService); + newAccessory.addService(new service.controlService); for (var i = 0; i < service.characteristics.length; i++) { characteristic = service.controlService.getCharacteristic(service.characteristics[i]); From ab9c7e64bc06e5bde898f5c6bf3e694e7a0ffc22 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 09:54:10 +0200 Subject: [PATCH 28/56] Update index.js --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 99158f8..24949d9 100755 --- a/index.js +++ b/index.js @@ -6414,7 +6414,7 @@ JeedomBridgedAccessory.prototype.addServices = function(newAccessory,services,ca if(!newAccessory.getService(service.controlService)){// not exist ? this.log('|debug',' Ajout service :'+service.controlService.displayName+' subtype:'+service.controlService.subtype+' cmd_id:'+service.controlService.cmd_id+' UUID:'+service.controlService.UUID); - newAccessory.addService(new service.controlService); + newAccessory.addService(service.controlService); for (var i = 0; i < service.characteristics.length; i++) { characteristic = service.controlService.getCharacteristic(service.characteristics[i]); From 245a2b04fceb9ca888c6bc8d2cc8b4e7ecbfeed1 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:35:23 +0200 Subject: [PATCH 29/56] Update index.js --- index.js | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 24949d9..b532744 100755 --- a/index.js +++ b/index.js @@ -5851,6 +5851,7 @@ function RegisterCustomCharacteristics() { } } TimeInterval.UUID = '2A6529B5-5825-4AF3-AD52-20288FBDA115'; + Characteristic.TimeInterval=TimeInterval; class CurrentPowerConsumption extends Characteristic { constructor() { @@ -5867,6 +5868,7 @@ function RegisterCustomCharacteristics() { } } CurrentPowerConsumption.UUID = 'E863F10D-079E-48FF-8F27-9C2605A29F52'; + Characteristic.CurrentPowerConsumption=CurrentPowerConsumption; class TotalPowerConsumption extends Characteristic { constructor() { @@ -5883,6 +5885,7 @@ function RegisterCustomCharacteristics() { } } TotalPowerConsumption.UUID = 'E863F10C-079E-48FF-8F27-9C2605A29F52'; + Characteristic.TotalPowerConsumption=TotalPowerConsumption; class UVIndex extends Characteristic { constructor() { @@ -5898,6 +5901,7 @@ function RegisterCustomCharacteristics() { } } UVIndex.UUID = '05ba0fe0-b848-4226-906d-5b64272e05ce'; + Characteristic.UVIndex=UVIndex; class AirPressure extends Characteristic { constructor() { @@ -5914,6 +5918,7 @@ function RegisterCustomCharacteristics() { } } AirPressure.UUID = 'E863F10F-079E-48FF-8F27-9C2605A29F52'; + Characteristic.AirPressure=AirPressure; // contacts helpers, need to identify class TimesOpened extends Characteristic { @@ -5927,6 +5932,7 @@ function RegisterCustomCharacteristics() { } } TimesOpened.UUID = 'E863F129-079E-48FF-8F27-9C2605A29F52'; + Characteristic.TimesOpened=TimesOpened; class Char118 extends Characteristic { constructor() { @@ -5939,6 +5945,7 @@ function RegisterCustomCharacteristics() { } } Char118.UUID = 'E863F118-079E-48FF-8F27-9C2605A29F52'; + Characteristic.Char118=Char118; class Char119 extends Characteristic { constructor() { @@ -5951,6 +5958,7 @@ function RegisterCustomCharacteristics() { } } Char119.UUID = 'E863F119-079E-48FF-8F27-9C2605A29F52'; + Characteristic.Char119=Char119; class LastActivation extends Characteristic { constructor() { @@ -5963,6 +5971,7 @@ function RegisterCustomCharacteristics() { } } LastActivation.UUID = 'E863F11A-079E-48FF-8F27-9C2605A29F52'; + Characteristic.LastActivation=LastActivation; class ResetTotal extends Characteristic { constructor() { @@ -5975,6 +5984,7 @@ function RegisterCustomCharacteristics() { } } ResetTotal.UUID = 'E863F112-079E-48FF-8F27-9C2605A29F52'; + Characteristic.ResetTotal=ResetTotal; // / contacts helpers // Motion Helpers @@ -5992,6 +6002,7 @@ function RegisterCustomCharacteristics() { } } Sensitivity.UUID = 'E863F120-079E-48FF-8F27-9C2605A29F52'; + Characteristic.Sensitivity=Sensitivity; class Duration extends Characteristic { constructor() { @@ -6007,6 +6018,7 @@ function RegisterCustomCharacteristics() { } } Duration.UUID = 'E863F12D-079E-48FF-8F27-9C2605A29F52'; + Characteristic.Duration=Duration; // /Motion Helpers @@ -6023,6 +6035,7 @@ function RegisterCustomCharacteristics() { } } GenericINT.UUID = '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'; + Characteristic.GenericINT=GenericINT; class GenericFLOAT extends Characteristic { constructor() { @@ -6035,7 +6048,8 @@ function RegisterCustomCharacteristics() { this.value = this.getDefaultValue(); } } - GenericFLOAT.UUID = '0168A695-70A7-4AF7-A800-417D30055719'; + GenericFLOAT.UUID = '0168A695-70A7-4AF7-A800-417D30055719'; + Characteristic.GenericFLOAT=GenericFLOAT; class GenericBOOL extends Characteristic { constructor() { @@ -6048,6 +6062,7 @@ function RegisterCustomCharacteristics() { } } GenericBOOL.UUID = 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'; + Characteristic.GenericBOOL=GenericBOOL; class GenericSTRING extends Characteristic { constructor() { @@ -6060,6 +6075,7 @@ function RegisterCustomCharacteristics() { } } GenericSTRING.UUID = 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'; + Characteristic.GenericSTRING=GenericSTRING; class AQI extends Characteristic { constructor() { @@ -6074,6 +6090,7 @@ function RegisterCustomCharacteristics() { } } AQI.UUID = '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'; + Characteristic.AQI=AQI; class PPM extends Characteristic { constructor() { @@ -6086,6 +6103,7 @@ function RegisterCustomCharacteristics() { } } PPM.UUID = 'E863F10B-079E-48FF-8F27-9C2605A29F52'; + Characteristic.PPM=PPM; class AQExtraCharacteristic extends Characteristic { constructor() { @@ -6098,6 +6116,7 @@ function RegisterCustomCharacteristics() { } } AQExtraCharacteristic.UUID = 'E863F132-079E-48FF-8F27-9C2605A29F52'; + Characteristic.AQExtraCharacteristic=AQExtraCharacteristic; class WindSpeed extends Characteristic { constructor() { @@ -6114,6 +6133,7 @@ function RegisterCustomCharacteristics() { } } WindSpeed.UUID = '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'; + Characteristic.WindSpeed=WindSpeed; class WindDirection extends Characteristic { constructor() { @@ -6126,6 +6146,7 @@ function RegisterCustomCharacteristics() { } } WindDirection.UUID = '46f1284c-1912-421b-82f5-eb75008b167e'; + Characteristic.WindDirection=WindDirection; class WeatherCondition extends Characteristic { constructor() { @@ -6138,6 +6159,7 @@ function RegisterCustomCharacteristics() { } } WeatherCondition.UUID = 'CD65A9AB-85AD-494A-B2BD-2F380084134D'; + Characteristic.WeatherCondition=WeatherCondition; class Visibility extends Characteristic { constructor() { @@ -6154,6 +6176,7 @@ function RegisterCustomCharacteristics() { } } Visibility.UUID = 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'; + Characteristic.Visibility=Visibility; class Rain extends Characteristic { constructor() { @@ -6166,6 +6189,7 @@ function RegisterCustomCharacteristics() { } } Rain.UUID = 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'; + Characteristic.Rain=Rain; class Snow extends Characteristic { constructor() { @@ -6178,6 +6202,7 @@ function RegisterCustomCharacteristics() { } } Snow.UUID = 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'; + Characteristic.Snow=Snow; class MinimumTemperature extends Characteristic { constructor() { @@ -6194,6 +6219,7 @@ function RegisterCustomCharacteristics() { } } MinimumTemperature.UUID = '707B78CA-51AB-4DC9-8630-80A58F07E419'; + Characteristic.MinimumTemperature=MinimumTemperature; class NoiseLevel extends Characteristic { constructor() { @@ -6210,6 +6236,7 @@ function RegisterCustomCharacteristics() { } } NoiseLevel.UUID = 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'; + Characteristic.NoiseLevel=NoiseLevel; class NoiseQuality extends Characteristic { constructor() { @@ -6232,6 +6259,7 @@ function RegisterCustomCharacteristics() { NoiseQuality.LIGHTLYNOISY = 3; NoiseQuality.NOISY = 4; NoiseQuality.TOONOISY = 5; + Characteristic.NoiseQuality=NoiseQuality; class SetDuration extends Characteristic { constructor() { @@ -6247,6 +6275,7 @@ function RegisterCustomCharacteristics() { } } SetDuration.UUID = '000000D3-0000-1000-8000-0026BB765291'; + Characteristic.SetDuration=SetDuration; class RemainingDuration extends Characteristic { constructor() { @@ -6262,6 +6291,7 @@ function RegisterCustomCharacteristics() { } } RemainingDuration.UUID = '000000D4-0000-1000-8000-0026BB765291'; + Characteristic.RemainingDuration=RemainingDuration; /** * FakeGato History Service @@ -6285,6 +6315,7 @@ function RegisterCustomCharacteristics() { } } PowerMonitor.UUID = '0EB29E08-C307-498E-8E1A-4EDC5FF70607'; + Service.PowerMonitor=PowerMonitor; /** * Custom Service 'Pressure Sensor' @@ -6301,6 +6332,7 @@ function RegisterCustomCharacteristics() { } } PressureSensor.UUID = 'E863F00A-079E-48FF-8F27-9C2605A29F52'; + Service.PressureSensor=PressureSensor; /** * Custom Service 'Noise Sensor' @@ -6317,6 +6349,7 @@ function RegisterCustomCharacteristics() { } } NoiseSensor.UUID = '6237cefc-9f4d-54b2-8033-2eda0053b811'; + Service.NoiseSensor=NoiseSensor; /** * Custom Service 'Weather Service' @@ -6340,6 +6373,7 @@ function RegisterCustomCharacteristics() { } } WeatherService.UUID = 'E863F001-079E-48FF-8F27-9C2605A29F52'; + Service.WeatherService=WeatherService; /** * Custom Service 'EveRoom Service' @@ -6355,6 +6389,7 @@ function RegisterCustomCharacteristics() { } } EveRoomService.UUID = '0000008D-0000-1000-8000-0026BB765291'; + Service.EveRoomService=EveRoomService; /** * Custom Service 'Custom Service' @@ -6371,6 +6406,7 @@ function RegisterCustomCharacteristics() { } } CustomService.UUID = 'BF0477D3-699A-42F1-BF98-04FCCFE5C8E7'; + Service.CustomService=CustomService; // End of custom Services and Characteristics } From a003f30a3c5bdf5957e22d7ca0f2e5a651ffe930 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:50:20 +0200 Subject: [PATCH 30/56] Update index.js --- index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/index.js b/index.js index b532744..cb508ab 100755 --- a/index.js +++ b/index.js @@ -18,7 +18,6 @@ let Access, Accessory, Service, Characteristic, AdaptiveLightingController, UUIDGen, Units, Formats, Perms, FakeGatoHistoryService; const fs = require('fs'); -const inherits = require('util').inherits; const myLogger = require('./lib/myLogger').myLogger; const express = require('express'); From 0ee93c6759d09e586e74cd7b4fa71a5af1c08e74 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:14:06 +0200 Subject: [PATCH 31/56] Revert "Update index.js" This reverts commit a003f30a3c5bdf5957e22d7ca0f2e5a651ffe930. --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index cb508ab..b532744 100755 --- a/index.js +++ b/index.js @@ -18,6 +18,7 @@ let Access, Accessory, Service, Characteristic, AdaptiveLightingController, UUIDGen, Units, Formats, Perms, FakeGatoHistoryService; const fs = require('fs'); +const inherits = require('util').inherits; const myLogger = require('./lib/myLogger').myLogger; const express = require('express'); From f90aa823f5f3d81b8847d521311334b34961781a Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:14:12 +0200 Subject: [PATCH 32/56] Revert "Update index.js" This reverts commit 245a2b04fceb9ca888c6bc8d2cc8b4e7ecbfeed1. --- index.js | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/index.js b/index.js index b532744..24949d9 100755 --- a/index.js +++ b/index.js @@ -5851,7 +5851,6 @@ function RegisterCustomCharacteristics() { } } TimeInterval.UUID = '2A6529B5-5825-4AF3-AD52-20288FBDA115'; - Characteristic.TimeInterval=TimeInterval; class CurrentPowerConsumption extends Characteristic { constructor() { @@ -5868,7 +5867,6 @@ function RegisterCustomCharacteristics() { } } CurrentPowerConsumption.UUID = 'E863F10D-079E-48FF-8F27-9C2605A29F52'; - Characteristic.CurrentPowerConsumption=CurrentPowerConsumption; class TotalPowerConsumption extends Characteristic { constructor() { @@ -5885,7 +5883,6 @@ function RegisterCustomCharacteristics() { } } TotalPowerConsumption.UUID = 'E863F10C-079E-48FF-8F27-9C2605A29F52'; - Characteristic.TotalPowerConsumption=TotalPowerConsumption; class UVIndex extends Characteristic { constructor() { @@ -5901,7 +5898,6 @@ function RegisterCustomCharacteristics() { } } UVIndex.UUID = '05ba0fe0-b848-4226-906d-5b64272e05ce'; - Characteristic.UVIndex=UVIndex; class AirPressure extends Characteristic { constructor() { @@ -5918,7 +5914,6 @@ function RegisterCustomCharacteristics() { } } AirPressure.UUID = 'E863F10F-079E-48FF-8F27-9C2605A29F52'; - Characteristic.AirPressure=AirPressure; // contacts helpers, need to identify class TimesOpened extends Characteristic { @@ -5932,7 +5927,6 @@ function RegisterCustomCharacteristics() { } } TimesOpened.UUID = 'E863F129-079E-48FF-8F27-9C2605A29F52'; - Characteristic.TimesOpened=TimesOpened; class Char118 extends Characteristic { constructor() { @@ -5945,7 +5939,6 @@ function RegisterCustomCharacteristics() { } } Char118.UUID = 'E863F118-079E-48FF-8F27-9C2605A29F52'; - Characteristic.Char118=Char118; class Char119 extends Characteristic { constructor() { @@ -5958,7 +5951,6 @@ function RegisterCustomCharacteristics() { } } Char119.UUID = 'E863F119-079E-48FF-8F27-9C2605A29F52'; - Characteristic.Char119=Char119; class LastActivation extends Characteristic { constructor() { @@ -5971,7 +5963,6 @@ function RegisterCustomCharacteristics() { } } LastActivation.UUID = 'E863F11A-079E-48FF-8F27-9C2605A29F52'; - Characteristic.LastActivation=LastActivation; class ResetTotal extends Characteristic { constructor() { @@ -5984,7 +5975,6 @@ function RegisterCustomCharacteristics() { } } ResetTotal.UUID = 'E863F112-079E-48FF-8F27-9C2605A29F52'; - Characteristic.ResetTotal=ResetTotal; // / contacts helpers // Motion Helpers @@ -6002,7 +5992,6 @@ function RegisterCustomCharacteristics() { } } Sensitivity.UUID = 'E863F120-079E-48FF-8F27-9C2605A29F52'; - Characteristic.Sensitivity=Sensitivity; class Duration extends Characteristic { constructor() { @@ -6018,7 +6007,6 @@ function RegisterCustomCharacteristics() { } } Duration.UUID = 'E863F12D-079E-48FF-8F27-9C2605A29F52'; - Characteristic.Duration=Duration; // /Motion Helpers @@ -6035,7 +6023,6 @@ function RegisterCustomCharacteristics() { } } GenericINT.UUID = '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'; - Characteristic.GenericINT=GenericINT; class GenericFLOAT extends Characteristic { constructor() { @@ -6048,8 +6035,7 @@ function RegisterCustomCharacteristics() { this.value = this.getDefaultValue(); } } - GenericFLOAT.UUID = '0168A695-70A7-4AF7-A800-417D30055719'; - Characteristic.GenericFLOAT=GenericFLOAT; + GenericFLOAT.UUID = '0168A695-70A7-4AF7-A800-417D30055719'; class GenericBOOL extends Characteristic { constructor() { @@ -6062,7 +6048,6 @@ function RegisterCustomCharacteristics() { } } GenericBOOL.UUID = 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'; - Characteristic.GenericBOOL=GenericBOOL; class GenericSTRING extends Characteristic { constructor() { @@ -6075,7 +6060,6 @@ function RegisterCustomCharacteristics() { } } GenericSTRING.UUID = 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'; - Characteristic.GenericSTRING=GenericSTRING; class AQI extends Characteristic { constructor() { @@ -6090,7 +6074,6 @@ function RegisterCustomCharacteristics() { } } AQI.UUID = '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'; - Characteristic.AQI=AQI; class PPM extends Characteristic { constructor() { @@ -6103,7 +6086,6 @@ function RegisterCustomCharacteristics() { } } PPM.UUID = 'E863F10B-079E-48FF-8F27-9C2605A29F52'; - Characteristic.PPM=PPM; class AQExtraCharacteristic extends Characteristic { constructor() { @@ -6116,7 +6098,6 @@ function RegisterCustomCharacteristics() { } } AQExtraCharacteristic.UUID = 'E863F132-079E-48FF-8F27-9C2605A29F52'; - Characteristic.AQExtraCharacteristic=AQExtraCharacteristic; class WindSpeed extends Characteristic { constructor() { @@ -6133,7 +6114,6 @@ function RegisterCustomCharacteristics() { } } WindSpeed.UUID = '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'; - Characteristic.WindSpeed=WindSpeed; class WindDirection extends Characteristic { constructor() { @@ -6146,7 +6126,6 @@ function RegisterCustomCharacteristics() { } } WindDirection.UUID = '46f1284c-1912-421b-82f5-eb75008b167e'; - Characteristic.WindDirection=WindDirection; class WeatherCondition extends Characteristic { constructor() { @@ -6159,7 +6138,6 @@ function RegisterCustomCharacteristics() { } } WeatherCondition.UUID = 'CD65A9AB-85AD-494A-B2BD-2F380084134D'; - Characteristic.WeatherCondition=WeatherCondition; class Visibility extends Characteristic { constructor() { @@ -6176,7 +6154,6 @@ function RegisterCustomCharacteristics() { } } Visibility.UUID = 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'; - Characteristic.Visibility=Visibility; class Rain extends Characteristic { constructor() { @@ -6189,7 +6166,6 @@ function RegisterCustomCharacteristics() { } } Rain.UUID = 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'; - Characteristic.Rain=Rain; class Snow extends Characteristic { constructor() { @@ -6202,7 +6178,6 @@ function RegisterCustomCharacteristics() { } } Snow.UUID = 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'; - Characteristic.Snow=Snow; class MinimumTemperature extends Characteristic { constructor() { @@ -6219,7 +6194,6 @@ function RegisterCustomCharacteristics() { } } MinimumTemperature.UUID = '707B78CA-51AB-4DC9-8630-80A58F07E419'; - Characteristic.MinimumTemperature=MinimumTemperature; class NoiseLevel extends Characteristic { constructor() { @@ -6236,7 +6210,6 @@ function RegisterCustomCharacteristics() { } } NoiseLevel.UUID = 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'; - Characteristic.NoiseLevel=NoiseLevel; class NoiseQuality extends Characteristic { constructor() { @@ -6259,7 +6232,6 @@ function RegisterCustomCharacteristics() { NoiseQuality.LIGHTLYNOISY = 3; NoiseQuality.NOISY = 4; NoiseQuality.TOONOISY = 5; - Characteristic.NoiseQuality=NoiseQuality; class SetDuration extends Characteristic { constructor() { @@ -6275,7 +6247,6 @@ function RegisterCustomCharacteristics() { } } SetDuration.UUID = '000000D3-0000-1000-8000-0026BB765291'; - Characteristic.SetDuration=SetDuration; class RemainingDuration extends Characteristic { constructor() { @@ -6291,7 +6262,6 @@ function RegisterCustomCharacteristics() { } } RemainingDuration.UUID = '000000D4-0000-1000-8000-0026BB765291'; - Characteristic.RemainingDuration=RemainingDuration; /** * FakeGato History Service @@ -6315,7 +6285,6 @@ function RegisterCustomCharacteristics() { } } PowerMonitor.UUID = '0EB29E08-C307-498E-8E1A-4EDC5FF70607'; - Service.PowerMonitor=PowerMonitor; /** * Custom Service 'Pressure Sensor' @@ -6332,7 +6301,6 @@ function RegisterCustomCharacteristics() { } } PressureSensor.UUID = 'E863F00A-079E-48FF-8F27-9C2605A29F52'; - Service.PressureSensor=PressureSensor; /** * Custom Service 'Noise Sensor' @@ -6349,7 +6317,6 @@ function RegisterCustomCharacteristics() { } } NoiseSensor.UUID = '6237cefc-9f4d-54b2-8033-2eda0053b811'; - Service.NoiseSensor=NoiseSensor; /** * Custom Service 'Weather Service' @@ -6373,7 +6340,6 @@ function RegisterCustomCharacteristics() { } } WeatherService.UUID = 'E863F001-079E-48FF-8F27-9C2605A29F52'; - Service.WeatherService=WeatherService; /** * Custom Service 'EveRoom Service' @@ -6389,7 +6355,6 @@ function RegisterCustomCharacteristics() { } } EveRoomService.UUID = '0000008D-0000-1000-8000-0026BB765291'; - Service.EveRoomService=EveRoomService; /** * Custom Service 'Custom Service' @@ -6406,7 +6371,6 @@ function RegisterCustomCharacteristics() { } } CustomService.UUID = 'BF0477D3-699A-42F1-BF98-04FCCFE5C8E7'; - Service.CustomService=CustomService; // End of custom Services and Characteristics } From c4ce16083fac80a48f6b49383c3bf91d4976704d Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:14:16 +0200 Subject: [PATCH 33/56] Revert "Update index.js" This reverts commit ab9c7e64bc06e5bde898f5c6bf3e694e7a0ffc22. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 24949d9..99158f8 100755 --- a/index.js +++ b/index.js @@ -6414,7 +6414,7 @@ JeedomBridgedAccessory.prototype.addServices = function(newAccessory,services,ca if(!newAccessory.getService(service.controlService)){// not exist ? this.log('|debug',' Ajout service :'+service.controlService.displayName+' subtype:'+service.controlService.subtype+' cmd_id:'+service.controlService.cmd_id+' UUID:'+service.controlService.UUID); - newAccessory.addService(service.controlService); + newAccessory.addService(new service.controlService); for (var i = 0; i < service.characteristics.length; i++) { characteristic = service.controlService.getCharacteristic(service.characteristics[i]); From c584c1a8d018c113c6f9b9fa57b61cf79ef908d9 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:14:19 +0200 Subject: [PATCH 34/56] Revert "Update index.js" This reverts commit ef01f04916c99f4b1d835cc4cac189a8fabb9904. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 99158f8..24949d9 100755 --- a/index.js +++ b/index.js @@ -6414,7 +6414,7 @@ JeedomBridgedAccessory.prototype.addServices = function(newAccessory,services,ca if(!newAccessory.getService(service.controlService)){// not exist ? this.log('|debug',' Ajout service :'+service.controlService.displayName+' subtype:'+service.controlService.subtype+' cmd_id:'+service.controlService.cmd_id+' UUID:'+service.controlService.UUID); - newAccessory.addService(new service.controlService); + newAccessory.addService(service.controlService); for (var i = 0; i < service.characteristics.length; i++) { characteristic = service.controlService.getCharacteristic(service.characteristics[i]); From 11dd1cce182cc1c93bdeae716b884c1b152a5b2e Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:14:23 +0200 Subject: [PATCH 35/56] Revert "Update index.js" This reverts commit df2e13beed2257d94a8014c8f90276328c6a9bc3. --- index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 24949d9..60e3d59 100755 --- a/index.js +++ b/index.js @@ -6226,12 +6226,12 @@ function RegisterCustomCharacteristics() { } NoiseQuality.UUID = '627ea399-29d9-5dc8-9a02-08ae928f73d8'; - NoiseQuality.UNKNOWN = 0; - NoiseQuality.SILENT = 1; - NoiseQuality.CALM = 2; - NoiseQuality.LIGHTLYNOISY = 3; - NoiseQuality.NOISY = 4; - NoiseQuality.TOONOISY = 5; + Characteristic.NoiseQuality.UNKNOWN = 0; + Characteristic.NoiseQuality.SILENT = 1; + Characteristic.NoiseQuality.CALM = 2; + Characteristic.NoiseQuality.LIGHTLYNOISY = 3; + Characteristic.NoiseQuality.NOISY = 4; + Characteristic.NoiseQuality.TOONOISY = 5; class SetDuration extends Characteristic { constructor() { From 161afefdc1fa3040cff515cce69a0e1f022254a4 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:14:29 +0200 Subject: [PATCH 36/56] Revert "fix char and serv declarations" This reverts commit c6f1d3e8de3db275fd0c0437c93a75bb9b53059c. --- index.js | 771 +++++++++++++++++++++++++++---------------------------- 1 file changed, 373 insertions(+), 398 deletions(-) diff --git a/index.js b/index.js index 60e3d59..f8d4a15 100755 --- a/index.js +++ b/index.js @@ -5847,73 +5847,68 @@ function RegisterCustomCharacteristics() { minStep : 900, // 15 min perms : [Perms.READ, Perms.WRITE, Perms.NOTIFY], }); - this.value = this.getDefaultValue(); } } TimeInterval.UUID = '2A6529B5-5825-4AF3-AD52-20288FBDA115'; - class CurrentPowerConsumption extends Characteristic { - constructor() { - super('Consumption', CurrentPowerConsumption.UUID); - this.setProps({ - format: Formats.UINT16, - unit: 'Watts', - maxValue: 100000, - minValue: -100000, - minStep: 1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - CurrentPowerConsumption.UUID = 'E863F10D-079E-48FF-8F27-9C2605A29F52'; - - class TotalPowerConsumption extends Characteristic { - constructor() { - super('Total Consumption', TotalPowerConsumption.UUID); - this.setProps({ - format: Formats.FLOAT, - unit: 'kWh', - maxValue: 100000000000, - minValue: 0, - minStep: 0.001, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - TotalPowerConsumption.UUID = 'E863F10C-079E-48FF-8F27-9C2605A29F52'; - - class UVIndex extends Characteristic { - constructor() { - super('UV Index', UVIndex.UUID); - this.setProps({ - format: Formats.UINT8, - maxValue: 10, - minValue: 0, - minStep: 1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - UVIndex.UUID = '05ba0fe0-b848-4226-906d-5b64272e05ce'; - - class AirPressure extends Characteristic { - constructor() { - super('Air Pressure', AirPressure.UUID); - this.setProps({ - format: Formats.UINT16, - unit: 'hPa', - maxValue: 1100, - minValue: 700, - minStep: 1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - AirPressure.UUID = 'E863F10F-079E-48FF-8F27-9C2605A29F52'; + Characteristic.CurrentPowerConsumption = function() { + Characteristic.call(this, 'Consumption', 'E863F10D-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format : Formats.UINT16, + unit : 'Watts', + maxValue : 100000, + minValue : -100000, + minStep : 1, + perms : [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + inherits(Characteristic.CurrentPowerConsumption, Characteristic); + Characteristic.CurrentPowerConsumption.UUID = 'E863F10D-079E-48FF-8F27-9C2605A29F52'; + + Characteristic.TotalPowerConsumption = function() { + Characteristic.call(this, 'Total Consumption', 'E863F10C-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format : Formats.FLOAT, // Deviation from Eve Energy observed type + unit : 'kWh', + maxValue : 100000000000, + minValue : 0, + minStep : 0.001, + perms : [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + inherits(Characteristic.TotalPowerConsumption, Characteristic); + Characteristic.TotalPowerConsumption.UUID = 'E863F10C-079E-48FF-8F27-9C2605A29F52'; + + Characteristic.UVIndex = function() { + Characteristic.call(this, 'UV Index', '05ba0fe0-b848-4226-906d-5b64272e05ce'); + this.setProps({ + format: Formats.UINT8, + maxValue: 10, + minValue: 0, + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + inherits(Characteristic.UVIndex, Characteristic); + Characteristic.UVIndex.UUID = '05ba0fe0-b848-4226-906d-5b64272e05ce'; + + Characteristic.AirPressure = function() { + Characteristic.call(this, 'Air Pressure', 'E863F10F-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format: Formats.UINT16, + unit: "hPa", + maxValue: 1100, + minValue: 700, + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + inherits(Characteristic.AirPressure, Characteristic); + Characteristic.AirPressure.UUID = 'E863F10F-079E-48FF-8F27-9C2605A29F52'; // contacts helpers, need to identify class TimesOpened extends Characteristic { @@ -5928,220 +5923,203 @@ function RegisterCustomCharacteristics() { } TimesOpened.UUID = 'E863F129-079E-48FF-8F27-9C2605A29F52'; - class Char118 extends Characteristic { - constructor() { - super('Char118', Char118.UUID); - this.setProps({ - format: Formats.UINT32, - perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - Char118.UUID = 'E863F118-079E-48FF-8F27-9C2605A29F52'; + Characteristic.Char118 = function() { + Characteristic.call(this, 'Char118', 'E863F118-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.Char118.UUID = 'E863F118-079E-48FF-8F27-9C2605A29F52'; + inherits(Characteristic.Char118, Characteristic); - class Char119 extends Characteristic { - constructor() { - super('Char119', Char119.UUID); - this.setProps({ - format: Formats.UINT32, - perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - Char119.UUID = 'E863F119-079E-48FF-8F27-9C2605A29F52'; + Characteristic.Char119 = function() { + Characteristic.call(this, 'Char119', 'E863F119-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.Char119.UUID = 'E863F119-079E-48FF-8F27-9C2605A29F52'; + inherits(Characteristic.Char119, Characteristic); - class LastActivation extends Characteristic { - constructor() { - super('LastActivation', LastActivation.UUID); - this.setProps({ - format: Formats.UINT32, - perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - LastActivation.UUID = 'E863F11A-079E-48FF-8F27-9C2605A29F52'; + Characteristic.LastActivation = function() { + Characteristic.call(this, 'LastActivation', 'E863F11A-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.LastActivation.UUID = 'E863F11A-079E-48FF-8F27-9C2605A29F52'; + inherits(Characteristic.LastActivation, Characteristic); - class ResetTotal extends Characteristic { - constructor() { - super('ResetTotal', ResetTotal.UUID); - this.setProps({ - format: Formats.UINT32, - perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - ResetTotal.UUID = 'E863F112-079E-48FF-8F27-9C2605A29F52'; + Characteristic.ResetTotal = function() { + Characteristic.call(this, 'ResetTotal', 'E863F112-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.ResetTotal.UUID = 'E863F112-079E-48FF-8F27-9C2605A29F52'; + inherits(Characteristic.ResetTotal, Characteristic); // / contacts helpers // Motion Helpers - class Sensitivity extends Characteristic { - constructor() { - super('Sensitivity', Sensitivity.UUID); - this.setProps({ - format: Formats.UINT16, - maxValue: 7, - minValue: 0, - minStep: 1, - perms: [Perms.READ, Perms.WRITE], - }); - this.value = this.getDefaultValue(); - } - } - Sensitivity.UUID = 'E863F120-079E-48FF-8F27-9C2605A29F52'; - - class Duration extends Characteristic { - constructor() { - super('Duration', Duration.UUID); - this.setProps({ - format: Formats.UINT16, - maxValue: 3600, - minValue: 0, - minStep: 1, - perms: [Perms.READ, Perms.WRITE], - }); - this.value = this.getDefaultValue(); - } - } - Duration.UUID = 'E863F12D-079E-48FF-8F27-9C2605A29F52'; + Characteristic.Sensitivity = function() { + Characteristic.call(this, 'Sensitivity', 'E863F120-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format: Formats.UINT16, + maxValue: 7, + minValue: 0, + minStep: 1, + perms: [Perms.READ, Perms.WRITE], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.Sensitivity.UUID = 'E863F120-079E-48FF-8F27-9C2605A29F52'; + inherits(Characteristic.Sensitivity, Characteristic); + + Characteristic.Duration = function() { + Characteristic.call(this, 'Duration', 'E863F12D-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format: Formats.UINT16, + maxValue: 3600, + minValue: 0, + minStep: 1, + perms: [Perms.READ, Perms.WRITE], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.Duration.UUID = 'E863F12D-079E-48FF-8F27-9C2605A29F52'; + inherits(Characteristic.Duration, Characteristic); // /Motion Helpers - class GenericINT extends Characteristic { - constructor() { - super('ValueINT', GenericINT.UUID); - this.setProps({ - format: Formats.INT, - minStep: 1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - GenericINT.UUID = '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'; + Characteristic.GenericINT = function() { + Characteristic.call(this, 'ValueINT', '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'); + this.setProps({ + format: Formats.INT, + minStep: 1, + perms: [ Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.GenericINT.UUID = '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'; + inherits(Characteristic.GenericINT, Characteristic); - class GenericFLOAT extends Characteristic { - constructor() { - super('ValueFLOAT', GenericFLOAT.UUID); - this.setProps({ - format: Formats.FLOAT, - minStep: 0.01, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - GenericFLOAT.UUID = '0168A695-70A7-4AF7-A800-417D30055719'; + Characteristic.GenericFLOAT = function() { + Characteristic.call(this, 'ValueFLOAT', '0168A695-70A7-4AF7-A800-417D30055719'); + this.setProps({ + format: Formats.FLOAT, + minStep: 0.01, + perms: [ Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.GenericFLOAT.UUID = '0168A695-70A7-4AF7-A800-417D30055719'; + inherits(Characteristic.GenericFLOAT, Characteristic); - class GenericBOOL extends Characteristic { - constructor() { - super('ValueBOOL', GenericBOOL.UUID); - this.setProps({ - format: Formats.BOOL, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - GenericBOOL.UUID = 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'; - - class GenericSTRING extends Characteristic { - constructor() { - super('ValueSTRING', GenericSTRING.UUID); - this.setProps({ - format: Formats.STRING, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - GenericSTRING.UUID = 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'; + Characteristic.GenericBOOL = function() { + Characteristic.call(this, 'ValueBOOL', 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'); + this.setProps({ + format: Formats.BOOL, + perms: [ Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.GenericBOOL.UUID = 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'; + inherits(Characteristic.GenericBOOL, Characteristic); + + Characteristic.GenericSTRING = function() { + Characteristic.call(this, 'ValueSTRING', 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'); + this.setProps({ + format: Formats.STRING, + perms: [ Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.GenericSTRING.UUID = 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'; + inherits(Characteristic.GenericSTRING, Characteristic); - class AQI extends Characteristic { - constructor() { - super('Index', AQI.UUID); - this.setProps({ - format: Formats.INT, - unit: '', - minStep: 1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - AQI.UUID = '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'; - - class PPM extends Characteristic { - constructor() { - super('PPM', PPM.UUID); - this.setProps({ - format: Formats.UINT16, - perms: [Perms.READ, Perms.HIDDEN], - }); - this.value = this.getDefaultValue(); - } - } - PPM.UUID = 'E863F10B-079E-48FF-8F27-9C2605A29F52'; - - class AQExtraCharacteristic extends Characteristic { - constructor() { - super('AQX2', AQExtraCharacteristic.UUID); - this.setProps({ - format: Formats.DATA, - perms: [Perms.READ, Perms.HIDDEN], - }); - this.value = this.getDefaultValue(); - } - } - AQExtraCharacteristic.UUID = 'E863F132-079E-48FF-8F27-9C2605A29F52'; + Characteristic.AQI = function() { + Characteristic.call(this, 'Index', '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'); + this.setProps({ + format: Formats.INT, + unit: '', + minStep: 1, + perms: [ Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.AQI.UUID = '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'; + inherits(Characteristic.AQI, Characteristic); + + Characteristic.PPM = function() { + Characteristic.call(this, 'PPM', 'E863F10B-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format: Formats.UINT16, + perms: [ Perms.READ, Perms.HIDDEN], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.PPM.UUID = 'E863F10B-079E-48FF-8F27-9C2605A29F52'; + inherits(Characteristic.PPM, Characteristic); + + Characteristic.AQExtraCharacteristic = function() { + Characteristic.call(this, 'AQX2', 'E863F132-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format: Formats.DATA, + perms: [ Perms.READ, Perms.HIDDEN], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.AQExtraCharacteristic.UUID = 'E863F132-079E-48FF-8F27-9C2605A29F52'; + inherits(Characteristic.AQExtraCharacteristic, Characteristic); - class WindSpeed extends Characteristic { - constructor() { - super('Wind speed', WindSpeed.UUID); - this.setProps({ - format: Formats.FLOAT, - unit: 'km/h', - maxValue: 100, - minValue: 0, - minStep: 0.1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - WindSpeed.UUID = '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'; - - class WindDirection extends Characteristic { - constructor() { - super('Wind direction', WindDirection.UUID); - this.setProps({ - format: Formats.STRING, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - WindDirection.UUID = '46f1284c-1912-421b-82f5-eb75008b167e'; - - class WeatherCondition extends Characteristic { - constructor() { - super('Condition', WeatherCondition.UUID); - this.setProps({ - format: Formats.UINT8, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - WeatherCondition.UUID = 'CD65A9AB-85AD-494A-B2BD-2F380084134D'; + Characteristic.WindSpeed = function() { + Characteristic.call(this, 'Wind speed', '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'); + this.setProps({ + format: Formats.FLOAT, + unit: "km/h", + maxValue: 100, + minValue: 0, + minStep: 0.1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.WindSpeed.UUID = '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'; + inherits(Characteristic.WindSpeed, Characteristic); + + Characteristic.WindDirection = function() { + Characteristic.call(this, 'Wind direction', '46f1284c-1912-421b-82f5-eb75008b167e'); + this.setProps({ + format: Formats.STRING, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.WindDirection.UUID = '46f1284c-1912-421b-82f5-eb75008b167e'; + inherits(Characteristic.WindDirection, Characteristic); + + Characteristic.WeatherCondition = function() { + Characteristic.call(this, 'Condition', 'cd65a9ab-85ad-494a-b2bd-2f380084134d'); + this.setProps({ + format: Formats.STRING, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.WeatherCondition.UUID = 'cd65a9ab-85ad-494a-b2bd-2f380084134d'; + inherits(Characteristic.WeatherCondition, Characteristic); - class Visibility extends Characteristic { - constructor() { - super('Visibility', Visibility.UUID); + Characteristic.Visibility = function() { + Characteristic.call(this, 'Visibility', 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'); this.setProps({ format: Formats.UINT8, unit: "km", @@ -6151,53 +6129,49 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - } - } - Visibility.UUID = 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'; + }; + Characteristic.Visibility.UUID = 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'; + inherits(Characteristic.Visibility, Characteristic); - class Rain extends Characteristic { - constructor() { - super('Rain', Rain.UUID); - this.setProps({ - format: Formats.BOOL, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - Rain.UUID = 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'; + Characteristic.Rain = function() { + Characteristic.call(this, 'Rain', 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'); + this.setProps({ + format: Formats.BOOL, + perms: [ Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.Rain.UUID = 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'; + inherits(Characteristic.Rain, Characteristic); - class Snow extends Characteristic { - constructor() { - super('Snow', Snow.UUID); - this.setProps({ - format: Formats.BOOL, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - Snow.UUID = 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'; + Characteristic.Snow = function() { + Characteristic.call(this, 'Snow', 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'); + this.setProps({ + format: Formats.BOOL, + perms: [ Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.Snow.UUID = 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'; + inherits(Characteristic.Snow, Characteristic); - class MinimumTemperature extends Characteristic { - constructor() { - super('MinimumTemperature', MinimumTemperature.UUID); - this.setProps({ - format: Formats.FLOAT, - unit: Units.CELSIUS, - maxValue: 100, - minValue: -40, - minStep: 0.1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - MinimumTemperature.UUID = '707B78CA-51AB-4DC9-8630-80A58F07E419'; + Characteristic.MinimumTemperature = function() { + Characteristic.call(this, 'MinimumTemperature', '707B78CA-51AB-4DC9-8630-80A58F07E419'); + this.setProps({ + format: Formats.FLOAT, + unit: Units.CELSIUS, + maxValue: 100, + minValue: -40, + minStep: 0.1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.MinimumTemperature.UUID = '707B78CA-51AB-4DC9-8630-80A58F07E419'; + inherits(Characteristic.MinimumTemperature, Characteristic); - class NoiseLevel extends Characteristic { - constructor() { - super('Noise Level', NoiseLevel.UUID); + Characteristic.NoiseLevel = function() { + Characteristic.call(this, 'Noise Level', 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'); this.setProps({ format: Formats.UINT8, unit: "dB", @@ -6207,13 +6181,12 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - } - } - NoiseLevel.UUID = 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'; + }; + Characteristic.NoiseLevel.UUID = 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'; + inherits(Characteristic.NoiseLevel, Characteristic); - class NoiseQuality extends Characteristic { - constructor() { - super('Noise Quality', NoiseQuality.UUID); + Characteristic.NoiseQuality = function() { + Characteristic.call(this, 'Noise Quality', '627ea399-29d9-5dc8-9a02-08ae928f73d8'); this.setProps({ format: Formats.UINT8, maxValue: 5, @@ -6222,9 +6195,9 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - } - } - NoiseQuality.UUID = '627ea399-29d9-5dc8-9a02-08ae928f73d8'; + }; + Characteristic.NoiseQuality.UUID = '627ea399-29d9-5dc8-9a02-08ae928f73d8'; + inherits(Characteristic.NoiseQuality, Characteristic); Characteristic.NoiseQuality.UNKNOWN = 0; Characteristic.NoiseQuality.SILENT = 1; @@ -6233,9 +6206,9 @@ function RegisterCustomCharacteristics() { Characteristic.NoiseQuality.NOISY = 4; Characteristic.NoiseQuality.TOONOISY = 5; - class SetDuration extends Characteristic { - constructor() { - super('Set Duration', SetDuration.UUID); + + Characteristic.SetDuration = function() { + Characteristic.call(this, 'Set Duration', '000000D3-0000-1000-8000-0026BB765291'); this.setProps({ format: Formats.UINT32, maxValue: 3600, @@ -6244,13 +6217,12 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.WRITE, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - } - } - SetDuration.UUID = '000000D3-0000-1000-8000-0026BB765291'; + }; + Characteristic.SetDuration.UUID = '000000D3-0000-1000-8000-0026BB765291'; + inherits(Characteristic.SetDuration, Characteristic); - class RemainingDuration extends Characteristic { - constructor() { - super('Remaining Duration', RemainingDuration.UUID); + Characteristic.RemainingDuration = function() { + Characteristic.call(this, 'Remaining Duration', '000000D4-0000-1000-8000-0026BB765291'); this.setProps({ format: Formats.UINT32, maxValue: 3600, @@ -6259,9 +6231,9 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - } - } - RemainingDuration.UUID = '000000D4-0000-1000-8000-0026BB765291'; + }; + Characteristic.RemainingDuration.UUID = '000000D4-0000-1000-8000-0026BB765291'; + inherits(Characteristic.RemainingDuration, Characteristic); /** * FakeGato History Service @@ -6273,104 +6245,107 @@ function RegisterCustomCharacteristics() { * Custom Service 'Power Monitor' */ - class PowerMonitor extends Service { - constructor(displayName, subtype) { - super(displayName, PowerMonitor.UUID, subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.CurrentPowerConsumption); - this.addCharacteristic(Characteristic.TotalPowerConsumption); - - // Optional Characteristics - } - } - PowerMonitor.UUID = '0EB29E08-C307-498E-8E1A-4EDC5FF70607'; + Service.PowerMonitor = function(displayName, subtype) { + Service.call(this, displayName, '0EB29E08-C307-498E-8E1A-4EDC5FF70607', subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.CurrentPowerConsumption); + this.addCharacteristic(Characteristic.TotalPowerConsumption); + + // Optional Characteristics + + }; + inherits(Service.PowerMonitor, Service); + Service.PowerMonitor.UUID = '0EB29E08-C307-498E-8E1A-4EDC5FF70607'; /** * Custom Service 'Pressure Sensor' */ - class PressureSensor extends Service { - constructor(displayName, subtype) { - super(displayName, PressureSensor.UUID, subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.AirPressure); - - // Optional Characteristics - } - } - PressureSensor.UUID = 'E863F00A-079E-48FF-8F27-9C2605A29F52'; + Service.PressureSensor = function(displayName, subtype) { + Service.call(this, displayName, 'E863F00A-079E-48FF-8F27-9C2605A29F52', subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.AirPressure); + + // Optional Characteristics + + }; + inherits(Service.PressureSensor, Service); + Service.PressureSensor.UUID = 'E863F00A-079E-48FF-8F27-9C2605A29F52'; /** * Custom Service 'Noise Sensor' */ - class NoiseSensor extends Service { - constructor(displayName, subtype) { - super(displayName, NoiseSensor.UUID, subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.NoiseLevel); - this.addCharacteristic(Characteristic.NoiseQuality); - // Optional Characteristics - } - } - NoiseSensor.UUID = '6237cefc-9f4d-54b2-8033-2eda0053b811'; + Service.NoiseSensor = function(displayName, subtype) { + Service.call(this, displayName, '6237cefc-9f4d-54b2-8033-2eda0053b811', subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.NoiseLevel); + this.addCharacteristic(Characteristic.NoiseQuality); + // Optional Characteristics + + }; + inherits(Service.NoiseSensor, Service); + Service.NoiseSensor.UUID = '6237cefc-9f4d-54b2-8033-2eda0053b811'; /** * Custom Service 'Weather Service' */ - class WeatherService extends Service { - constructor(displayName, subtype) { - super(displayName, WeatherService.UUID, subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.WeatherCondition); - - // Optional Characteristics - this.addOptionalCharacteristic(Characteristic.WindDirection); - this.addOptionalCharacteristic(Characteristic.WindSpeed); - // this.addOptionalCharacteristic(Characteristic.WeatherCondition); - this.addOptionalCharacteristic(Characteristic.UVIndex); - this.addOptionalCharacteristic(Characteristic.Rain); - this.addOptionalCharacteristic(Characteristic.Snow); - this.addOptionalCharacteristic(Characteristic.MinimumTemperature); - } - } - WeatherService.UUID = 'E863F001-079E-48FF-8F27-9C2605A29F52'; + Service.WeatherService = function(displayName, subtype) { + Service.call(this, displayName, 'E863F001-079E-48FF-8F27-9C2605A29F52', subtype); + + // Required Characteristics + // this.addCharacteristic(Characteristic.CurrentTemperature); + // this.addCharacteristic(Characteristic.CurrentRelativeHumidity); + // this.addCharacteristic(Characteristic.AirPressure); + this.addCharacteristic(Characteristic.WeatherCondition); + + // Optional Characteristics + this.addOptionalCharacteristic(Characteristic.WindDirection); + this.addOptionalCharacteristic(Characteristic.WindSpeed); + // this.addOptionalCharacteristic(Characteristic.WeatherCondition); + this.addOptionalCharacteristic(Characteristic.UVIndex); + this.addOptionalCharacteristic(Characteristic.Rain); + this.addOptionalCharacteristic(Characteristic.Snow); + this.addOptionalCharacteristic(Characteristic.MinimumTemperature); + }; + inherits(Service.WeatherService, Service); + Service.WeatherService.UUID = 'E863F001-079E-48FF-8F27-9C2605A29F52'; /** * Custom Service 'EveRoom Service' */ - class EveRoomService extends Service { - constructor(displayName, subtype) { - super(displayName, EveRoomService.UUID, subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.AirQuality); - // Optional Characteristics - } - } - EveRoomService.UUID = '0000008D-0000-1000-8000-0026BB765291'; + Service.EveRoomService = function(displayName, subtype) { + Service.call(this, displayName, '0000008D-0000-1000-8000-0026BB765291', subtype); + + // Required Characteristics + // this.addCharacteristic(Characteristic.CurrentTemperature); + // this.addCharacteristic(Characteristic.CurrentRelativeHumidity); + // this.addCharacteristic(Characteristic.AirPressure); + this.addCharacteristic(Characteristic.AirQuality); + + // Optional Characteristics + // this.addOptionalCharacteristic(Characteristic.WeatherCondition); + + }; + inherits(Service.EveRoomService, Service); + Service.EveRoomService.UUID = '0000008D-0000-1000-8000-0026BB765291'; /** * Custom Service 'Custom Service' */ - class CustomService extends Service { - constructor(displayName, subtype) { - super(displayName, CustomService.UUID, subtype); - - // Required Characteristics + Service.CustomService = function(displayName, subtype) { + Service.call(this, displayName, 'BF0477D3-699A-42F1-BF98-04FCCFE5C8E7', subtype); - // Optional Characteristics - this.addOptionalCharacteristic(Characteristic.Name); - } - } - CustomService.UUID = 'BF0477D3-699A-42F1-BF98-04FCCFE5C8E7'; + this.addOptionalCharacteristic(Characteristic.Name); + }; + inherits(Service.CustomService, Service); + Service.CustomService.UUID = 'BF0477D3-699A-42F1-BF98-04FCCFE5C8E7'; // End of custom Services and Characteristics } From b0ceeec9c20cda28108e9033d279b87df930395e Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:14:34 +0200 Subject: [PATCH 37/56] Revert "Update index.js" This reverts commit f56fbe03e01cd6efbaaffb18b6e8abff1b5a28c1. --- index.js | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/index.js b/index.js index f8d4a15..e4c3605 100755 --- a/index.js +++ b/index.js @@ -5835,21 +5835,21 @@ JeedomPlatform.prototype.syncColorCharacteristics = function(rgb, service) { // -- Params -- // -- Return : nothing function RegisterCustomCharacteristics() { - // Custom Services and Characteristics - class TimeInterval extends Characteristic { - constructor() { - super('Time Interval', TimeInterval.UUID); - this.setProps({ - format : Formats.FLOAT, - unit : Units.SECONDS, - maxValue : 21600, // 12 hours - minValue : 0, - minStep : 900, // 15 min - perms : [Perms.READ, Perms.WRITE, Perms.NOTIFY], - }); - } - } - TimeInterval.UUID = '2A6529B5-5825-4AF3-AD52-20288FBDA115'; + // Custom Services and Characteristics + Characteristic.TimeInterval = function() { + Characteristic.call(this, 'Time Interval', '2A6529B5-5825-4AF3-AD52-20288FBDA115'); + this.setProps({ + format : Formats.FLOAT, + unit : Units.SECONDS, + maxValue : 21600, // 12 hours + minValue : 0, + minStep : 900, // 15 min + perms : [Perms.READ, Perms.WRITE, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + inherits(Characteristic.TimeInterval, Characteristic); + Characteristic.TimeInterval.UUID = '2A6529B5-5825-4AF3-AD52-20288FBDA115'; Characteristic.CurrentPowerConsumption = function() { Characteristic.call(this, 'Consumption', 'E863F10D-079E-48FF-8F27-9C2605A29F52'); @@ -5911,17 +5911,16 @@ function RegisterCustomCharacteristics() { Characteristic.AirPressure.UUID = 'E863F10F-079E-48FF-8F27-9C2605A29F52'; // contacts helpers, need to identify - class TimesOpened extends Characteristic { - constructor() { - super('TimesOpened', TimesOpened.UUID); - this.setProps({ - format: Formats.UINT32, - perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - } - } - TimesOpened.UUID = 'E863F129-079E-48FF-8F27-9C2605A29F52'; + Characteristic.TimesOpened = function() { + Characteristic.call(this, 'TimesOpened', 'E863F129-079E-48FF-8F27-9C2605A29F52'); + this.setProps({ + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + }; + Characteristic.TimesOpened.UUID = 'E863F129-079E-48FF-8F27-9C2605A29F52'; + inherits(Characteristic.TimesOpened, Characteristic); Characteristic.Char118 = function() { Characteristic.call(this, 'Char118', 'E863F118-079E-48FF-8F27-9C2605A29F52'); From 6ab0af4ce63835e7a1929d2885d04f9c592a9de4 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:22:28 +0200 Subject: [PATCH 38/56] Update index.js --- index.js | 873 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 467 insertions(+), 406 deletions(-) diff --git a/index.js b/index.js index e4c3605..130d756 100755 --- a/index.js +++ b/index.js @@ -18,7 +18,6 @@ let Access, Accessory, Service, Characteristic, AdaptiveLightingController, UUIDGen, Units, Formats, Perms, FakeGatoHistoryService; const fs = require('fs'); -const inherits = require('util').inherits; const myLogger = require('./lib/myLogger').myLogger; const express = require('express'); @@ -5835,290 +5834,335 @@ JeedomPlatform.prototype.syncColorCharacteristics = function(rgb, service) { // -- Params -- // -- Return : nothing function RegisterCustomCharacteristics() { - // Custom Services and Characteristics - Characteristic.TimeInterval = function() { - Characteristic.call(this, 'Time Interval', '2A6529B5-5825-4AF3-AD52-20288FBDA115'); - this.setProps({ - format : Formats.FLOAT, - unit : Units.SECONDS, - maxValue : 21600, // 12 hours - minValue : 0, - minStep : 900, // 15 min - perms : [Perms.READ, Perms.WRITE, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - inherits(Characteristic.TimeInterval, Characteristic); - Characteristic.TimeInterval.UUID = '2A6529B5-5825-4AF3-AD52-20288FBDA115'; - - Characteristic.CurrentPowerConsumption = function() { - Characteristic.call(this, 'Consumption', 'E863F10D-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format : Formats.UINT16, - unit : 'Watts', - maxValue : 100000, - minValue : -100000, - minStep : 1, - perms : [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - inherits(Characteristic.CurrentPowerConsumption, Characteristic); - Characteristic.CurrentPowerConsumption.UUID = 'E863F10D-079E-48FF-8F27-9C2605A29F52'; - - Characteristic.TotalPowerConsumption = function() { - Characteristic.call(this, 'Total Consumption', 'E863F10C-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format : Formats.FLOAT, // Deviation from Eve Energy observed type - unit : 'kWh', - maxValue : 100000000000, - minValue : 0, - minStep : 0.001, - perms : [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - inherits(Characteristic.TotalPowerConsumption, Characteristic); - Characteristic.TotalPowerConsumption.UUID = 'E863F10C-079E-48FF-8F27-9C2605A29F52'; - - Characteristic.UVIndex = function() { - Characteristic.call(this, 'UV Index', '05ba0fe0-b848-4226-906d-5b64272e05ce'); - this.setProps({ - format: Formats.UINT8, - maxValue: 10, - minValue: 0, - minStep: 1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - inherits(Characteristic.UVIndex, Characteristic); - Characteristic.UVIndex.UUID = '05ba0fe0-b848-4226-906d-5b64272e05ce'; - - Characteristic.AirPressure = function() { - Characteristic.call(this, 'Air Pressure', 'E863F10F-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT16, - unit: "hPa", - maxValue: 1100, - minValue: 700, - minStep: 1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - inherits(Characteristic.AirPressure, Characteristic); - Characteristic.AirPressure.UUID = 'E863F10F-079E-48FF-8F27-9C2605A29F52'; + // Custom Services and Characteristics + class TimeInterval extends Characteristic { + constructor() { + super('Time Interval', TimeInterval.UUID); + this.setProps({ + format : Formats.FLOAT, + unit : Units.SECONDS, + maxValue : 21600, // 12 hours + minValue : 0, + minStep : 900, // 15 min + perms : [Perms.READ, Perms.WRITE, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + TimeInterval.UUID = '2A6529B5-5825-4AF3-AD52-20288FBDA115'; + Characteristic.TimeInterval=TimeInterval; + + class CurrentPowerConsumption extends Characteristic { + constructor() { + super('Consumption', CurrentPowerConsumption.UUID); + this.setProps({ + format: Formats.UINT16, + unit: 'Watts', + maxValue: 100000, + minValue: -100000, + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + CurrentPowerConsumption.UUID = 'E863F10D-079E-48FF-8F27-9C2605A29F52'; + Characteristic.CurrentPowerConsumption=CurrentPowerConsumption; + + class TotalPowerConsumption extends Characteristic { + constructor() { + super('Total Consumption', TotalPowerConsumption.UUID); + this.setProps({ + format: Formats.FLOAT, + unit: 'kWh', + maxValue: 100000000000, + minValue: 0, + minStep: 0.001, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + TotalPowerConsumption.UUID = 'E863F10C-079E-48FF-8F27-9C2605A29F52'; + Characteristic.TotalPowerConsumption=TotalPowerConsumption; + + class UVIndex extends Characteristic { + constructor() { + super('UV Index', UVIndex.UUID); + this.setProps({ + format: Formats.UINT8, + maxValue: 10, + minValue: 0, + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + UVIndex.UUID = '05ba0fe0-b848-4226-906d-5b64272e05ce'; + Characteristic.UVIndex=UVIndex; + + class AirPressure extends Characteristic { + constructor() { + super('Air Pressure', AirPressure.UUID); + this.setProps({ + format: Formats.UINT16, + unit: 'hPa', + maxValue: 1100, + minValue: 700, + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + AirPressure.UUID = 'E863F10F-079E-48FF-8F27-9C2605A29F52'; + Characteristic.AirPressure=AirPressure; // contacts helpers, need to identify - Characteristic.TimesOpened = function() { - Characteristic.call(this, 'TimesOpened', 'E863F129-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT32, - perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.TimesOpened.UUID = 'E863F129-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.TimesOpened, Characteristic); + class TimesOpened extends Characteristic { + constructor() { + super('TimesOpened', TimesOpened.UUID); + this.setProps({ + format: Formats.UINT32, + perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + TimesOpened.UUID = 'E863F129-079E-48FF-8F27-9C2605A29F52'; + Characteristic.TimesOpened=TimesOpened; - Characteristic.Char118 = function() { - Characteristic.call(this, 'Char118', 'E863F118-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT32, - perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Char118.UUID = 'E863F118-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.Char118, Characteristic); + class Char118 extends Characteristic { + constructor() { + super('Char118', Char118.UUID); + this.setProps({ + format: Formats.UINT32, + perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + Char118.UUID = 'E863F118-079E-48FF-8F27-9C2605A29F52'; + Characteristic.Char118=Char118; - Characteristic.Char119 = function() { - Characteristic.call(this, 'Char119', 'E863F119-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT32, - perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Char119.UUID = 'E863F119-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.Char119, Characteristic); + class Char119 extends Characteristic { + constructor() { + super('Char119', Char119.UUID); + this.setProps({ + format: Formats.UINT32, + perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + Char119.UUID = 'E863F119-079E-48FF-8F27-9C2605A29F52'; + Characteristic.Char119=Char119; - Characteristic.LastActivation = function() { - Characteristic.call(this, 'LastActivation', 'E863F11A-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT32, - perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.LastActivation.UUID = 'E863F11A-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.LastActivation, Characteristic); + class LastActivation extends Characteristic { + constructor() { + super('LastActivation', LastActivation.UUID); + this.setProps({ + format: Formats.UINT32, + perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + LastActivation.UUID = 'E863F11A-079E-48FF-8F27-9C2605A29F52'; + Characteristic.LastActivation=LastActivation; - Characteristic.ResetTotal = function() { - Characteristic.call(this, 'ResetTotal', 'E863F112-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT32, - perms: [ Perms.WRITE, Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.ResetTotal.UUID = 'E863F112-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.ResetTotal, Characteristic); + class ResetTotal extends Characteristic { + constructor() { + super('ResetTotal', ResetTotal.UUID); + this.setProps({ + format: Formats.UINT32, + perms: [Perms.WRITE, Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + ResetTotal.UUID = 'E863F112-079E-48FF-8F27-9C2605A29F52'; + Characteristic.ResetTotal=ResetTotal; // / contacts helpers // Motion Helpers - Characteristic.Sensitivity = function() { - Characteristic.call(this, 'Sensitivity', 'E863F120-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT16, - maxValue: 7, - minValue: 0, - minStep: 1, - perms: [Perms.READ, Perms.WRITE], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Sensitivity.UUID = 'E863F120-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.Sensitivity, Characteristic); - - Characteristic.Duration = function() { - Characteristic.call(this, 'Duration', 'E863F12D-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT16, - maxValue: 3600, - minValue: 0, - minStep: 1, - perms: [Perms.READ, Perms.WRITE], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Duration.UUID = 'E863F12D-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.Duration, Characteristic); + class Sensitivity extends Characteristic { + constructor() { + super('Sensitivity', Sensitivity.UUID); + this.setProps({ + format: Formats.UINT16, + maxValue: 7, + minValue: 0, + minStep: 1, + perms: [Perms.READ, Perms.WRITE], + }); + this.value = this.getDefaultValue(); + } + } + Sensitivity.UUID = 'E863F120-079E-48FF-8F27-9C2605A29F52'; + Characteristic.Sensitivity=Sensitivity; + + class Duration extends Characteristic { + constructor() { + super('Duration', Duration.UUID); + this.setProps({ + format: Formats.UINT16, + maxValue: 3600, + minValue: 0, + minStep: 1, + perms: [Perms.READ, Perms.WRITE], + }); + this.value = this.getDefaultValue(); + } + } + Duration.UUID = 'E863F12D-079E-48FF-8F27-9C2605A29F52'; + Characteristic.Duration=Duration; // /Motion Helpers - Characteristic.GenericINT = function() { - Characteristic.call(this, 'ValueINT', '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'); - this.setProps({ - format: Formats.INT, - minStep: 1, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.GenericINT.UUID = '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'; - inherits(Characteristic.GenericINT, Characteristic); + class GenericINT extends Characteristic { + constructor() { + super('ValueINT', GenericINT.UUID); + this.setProps({ + format: Formats.INT, + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + GenericINT.UUID = '2ACF6D35-4FBF-4688-8787-6D5C4BA3A263'; + Characteristic.GenericINT=GenericINT; - Characteristic.GenericFLOAT = function() { - Characteristic.call(this, 'ValueFLOAT', '0168A695-70A7-4AF7-A800-417D30055719'); - this.setProps({ - format: Formats.FLOAT, - minStep: 0.01, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.GenericFLOAT.UUID = '0168A695-70A7-4AF7-A800-417D30055719'; - inherits(Characteristic.GenericFLOAT, Characteristic); + class GenericFLOAT extends Characteristic { + constructor() { + super('ValueFLOAT', GenericFLOAT.UUID); + this.setProps({ + format: Formats.FLOAT, + minStep: 0.01, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + GenericFLOAT.UUID = '0168A695-70A7-4AF7-A800-417D30055719'; + Characteristic.GenericFLOAT=GenericFLOAT; - Characteristic.GenericBOOL = function() { - Characteristic.call(this, 'ValueBOOL', 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'); - this.setProps({ - format: Formats.BOOL, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.GenericBOOL.UUID = 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'; - inherits(Characteristic.GenericBOOL, Characteristic); - - Characteristic.GenericSTRING = function() { - Characteristic.call(this, 'ValueSTRING', 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'); - this.setProps({ - format: Formats.STRING, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.GenericSTRING.UUID = 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'; - inherits(Characteristic.GenericSTRING, Characteristic); + class GenericBOOL extends Characteristic { + constructor() { + super('ValueBOOL', GenericBOOL.UUID); + this.setProps({ + format: Formats.BOOL, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + GenericBOOL.UUID = 'D8E3301A-CD20-4AAB-8F70-F80789E6ADCB'; + Characteristic.GenericBOOL=GenericBOOL; + + class GenericSTRING extends Characteristic { + constructor() { + super('ValueSTRING', GenericSTRING.UUID); + this.setProps({ + format: Formats.STRING, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + GenericSTRING.UUID = 'EB19CE11-01F4-47DD-B7DA-B81C0640A5C1'; + Characteristic.GenericSTRING=GenericSTRING; - Characteristic.AQI = function() { - Characteristic.call(this, 'Index', '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'); - this.setProps({ - format: Formats.INT, - unit: '', - minStep: 1, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.AQI.UUID = '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'; - inherits(Characteristic.AQI, Characteristic); - - Characteristic.PPM = function() { - Characteristic.call(this, 'PPM', 'E863F10B-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.UINT16, - perms: [ Perms.READ, Perms.HIDDEN], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.PPM.UUID = 'E863F10B-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.PPM, Characteristic); - - Characteristic.AQExtraCharacteristic = function() { - Characteristic.call(this, 'AQX2', 'E863F132-079E-48FF-8F27-9C2605A29F52'); - this.setProps({ - format: Formats.DATA, - perms: [ Perms.READ, Perms.HIDDEN], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.AQExtraCharacteristic.UUID = 'E863F132-079E-48FF-8F27-9C2605A29F52'; - inherits(Characteristic.AQExtraCharacteristic, Characteristic); + class AQI extends Characteristic { + constructor() { + super('Index', AQI.UUID); + this.setProps({ + format: Formats.INT, + unit: '', + minStep: 1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + AQI.UUID = '2ACF6D35-4FBF-4689-8787-6D5C4BA3A263'; + Characteristic.AQI=AQI; + + class PPM extends Characteristic { + constructor() { + super('PPM', PPM.UUID); + this.setProps({ + format: Formats.UINT16, + perms: [Perms.READ, Perms.HIDDEN], + }); + this.value = this.getDefaultValue(); + } + } + PPM.UUID = 'E863F10B-079E-48FF-8F27-9C2605A29F52'; + Characteristic.PPM=PPM; + + class AQExtraCharacteristic extends Characteristic { + constructor() { + super('AQX2', AQExtraCharacteristic.UUID); + this.setProps({ + format: Formats.DATA, + perms: [Perms.READ, Perms.HIDDEN], + }); + this.value = this.getDefaultValue(); + } + } + AQExtraCharacteristic.UUID = 'E863F132-079E-48FF-8F27-9C2605A29F52'; + Characteristic.AQExtraCharacteristic=AQExtraCharacteristic; - Characteristic.WindSpeed = function() { - Characteristic.call(this, 'Wind speed', '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'); - this.setProps({ - format: Formats.FLOAT, - unit: "km/h", - maxValue: 100, - minValue: 0, - minStep: 0.1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.WindSpeed.UUID = '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'; - inherits(Characteristic.WindSpeed, Characteristic); - - Characteristic.WindDirection = function() { - Characteristic.call(this, 'Wind direction', '46f1284c-1912-421b-82f5-eb75008b167e'); - this.setProps({ - format: Formats.STRING, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.WindDirection.UUID = '46f1284c-1912-421b-82f5-eb75008b167e'; - inherits(Characteristic.WindDirection, Characteristic); - - Characteristic.WeatherCondition = function() { - Characteristic.call(this, 'Condition', 'cd65a9ab-85ad-494a-b2bd-2f380084134d'); - this.setProps({ - format: Formats.STRING, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.WeatherCondition.UUID = 'cd65a9ab-85ad-494a-b2bd-2f380084134d'; - inherits(Characteristic.WeatherCondition, Characteristic); + class WindSpeed extends Characteristic { + constructor() { + super('Wind speed', WindSpeed.UUID); + this.setProps({ + format: Formats.FLOAT, + unit: 'km/h', + maxValue: 100, + minValue: 0, + minStep: 0.1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + WindSpeed.UUID = '49C8AE5A-A3A5-41AB-BF1F-12D5654F9F41'; + Characteristic.WindSpeed=WindSpeed; - Characteristic.Visibility = function() { - Characteristic.call(this, 'Visibility', 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'); + class WindDirection extends Characteristic { + constructor() { + super('Wind direction', WindDirection.UUID); + this.setProps({ + format: Formats.STRING, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + WindDirection.UUID = '46f1284c-1912-421b-82f5-eb75008b167e'; + Characteristic.WindDirection=WindDirection; + + class WeatherCondition extends Characteristic { + constructor() { + super('Condition', WeatherCondition.UUID); + this.setProps({ + format: Formats.STRING, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + WeatherCondition.UUID = 'CD65A9AB-85AD-494A-B2BD-2F380084134D'; + Characteristic.WeatherCondition=WeatherCondition; + + class Visibility extends Characteristic { + constructor() { + super('Visibility', Visibility.UUID); this.setProps({ format: Formats.UINT8, unit: "km", @@ -6128,49 +6172,57 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - }; - Characteristic.Visibility.UUID = 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'; - inherits(Characteristic.Visibility, Characteristic); + } + } + Visibility.UUID = 'd24ecc1e-6fad-4fb5-8137-5af88bd5e857'; + Characteristic.Visibility=Visibility; - Characteristic.Rain = function() { - Characteristic.call(this, 'Rain', 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'); - this.setProps({ - format: Formats.BOOL, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Rain.UUID = 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'; - inherits(Characteristic.Rain, Characteristic); + class Rain extends Characteristic { + constructor() { + super('Rain', Rain.UUID); + this.setProps({ + format: Formats.BOOL, + perms: [ Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + Rain.UUID = 'F14EB1AD-E000-4EF4-A54F-0CF07B2E7BE7'; + Characteristic.Rain=Rain; - Characteristic.Snow = function() { - Characteristic.call(this, 'Snow', 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'); - this.setProps({ - format: Formats.BOOL, - perms: [ Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.Snow.UUID = 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'; - inherits(Characteristic.Snow, Characteristic); + class Snow extends Characteristic { + constructor() { + super('Snow', Snow.UUID); + this.setProps({ + format: Formats.BOOL, + perms: [ Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + Snow.UUID = 'F14EB1AD-E000-4CE6-BD0E-384F9EC4D5DD'; + Characteristic.Snow=Snow; - Characteristic.MinimumTemperature = function() { - Characteristic.call(this, 'MinimumTemperature', '707B78CA-51AB-4DC9-8630-80A58F07E419'); - this.setProps({ - format: Formats.FLOAT, - unit: Units.CELSIUS, - maxValue: 100, - minValue: -40, - minStep: 0.1, - perms: [Perms.READ, Perms.NOTIFY], - }); - this.value = this.getDefaultValue(); - }; - Characteristic.MinimumTemperature.UUID = '707B78CA-51AB-4DC9-8630-80A58F07E419'; - inherits(Characteristic.MinimumTemperature, Characteristic); + class MinimumTemperature extends Characteristic { + constructor() { + super('MinimumTemperature', MinimumTemperature.UUID); + this.setProps({ + format: Formats.FLOAT, + unit: Units.CELSIUS, + maxValue: 100, + minValue: -40, + minStep: 0.1, + perms: [Perms.READ, Perms.NOTIFY], + }); + this.value = this.getDefaultValue(); + } + } + MinimumTemperature.UUID = '707B78CA-51AB-4DC9-8630-80A58F07E419'; + Characteristic.MinimumTemperature=MinimumTemperature; - Characteristic.NoiseLevel = function() { - Characteristic.call(this, 'Noise Level', 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'); + class NoiseLevel extends Characteristic { + constructor() { + super('Noise Level', NoiseLevel.UUID); this.setProps({ format: Formats.UINT8, unit: "dB", @@ -6180,12 +6232,14 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - }; - Characteristic.NoiseLevel.UUID = 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'; - inherits(Characteristic.NoiseLevel, Characteristic); + } + } + NoiseLevel.UUID = 'b3bbfabc-d78c-5b8d-948c-5dac1ee2cde5'; + Characteristic.NoiseLevel=NoiseLevel; - Characteristic.NoiseQuality = function() { - Characteristic.call(this, 'Noise Quality', '627ea399-29d9-5dc8-9a02-08ae928f73d8'); + class NoiseQuality extends Characteristic { + constructor() { + super('Noise Quality', NoiseQuality.UUID); this.setProps({ format: Formats.UINT8, maxValue: 5, @@ -6194,20 +6248,21 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - }; - Characteristic.NoiseQuality.UUID = '627ea399-29d9-5dc8-9a02-08ae928f73d8'; - inherits(Characteristic.NoiseQuality, Characteristic); - - Characteristic.NoiseQuality.UNKNOWN = 0; - Characteristic.NoiseQuality.SILENT = 1; - Characteristic.NoiseQuality.CALM = 2; - Characteristic.NoiseQuality.LIGHTLYNOISY = 3; - Characteristic.NoiseQuality.NOISY = 4; - Characteristic.NoiseQuality.TOONOISY = 5; + } + } + NoiseQuality.UUID = '627ea399-29d9-5dc8-9a02-08ae928f73d8'; + NoiseQuality.UNKNOWN = 0; + NoiseQuality.SILENT = 1; + NoiseQuality.CALM = 2; + NoiseQuality.LIGHTLYNOISY = 3; + NoiseQuality.NOISY = 4; + NoiseQuality.TOONOISY = 5; + Characteristic.NoiseQuality=NoiseQuality; - Characteristic.SetDuration = function() { - Characteristic.call(this, 'Set Duration', '000000D3-0000-1000-8000-0026BB765291'); + class SetDuration extends Characteristic { + constructor() { + super('Set Duration', SetDuration.UUID); this.setProps({ format: Formats.UINT32, maxValue: 3600, @@ -6216,12 +6271,14 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.WRITE, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - }; - Characteristic.SetDuration.UUID = '000000D3-0000-1000-8000-0026BB765291'; - inherits(Characteristic.SetDuration, Characteristic); + } + } + SetDuration.UUID = '000000D3-0000-1000-8000-0026BB765291'; + Characteristic.SetDuration=SetDuration; - Characteristic.RemainingDuration = function() { - Characteristic.call(this, 'Remaining Duration', '000000D4-0000-1000-8000-0026BB765291'); + class RemainingDuration extends Characteristic { + constructor() { + super('Remaining Duration', RemainingDuration.UUID); this.setProps({ format: Formats.UINT32, maxValue: 3600, @@ -6230,9 +6287,10 @@ function RegisterCustomCharacteristics() { perms: [Perms.READ, Perms.NOTIFY], }); this.value = this.getDefaultValue(); - }; - Characteristic.RemainingDuration.UUID = '000000D4-0000-1000-8000-0026BB765291'; - inherits(Characteristic.RemainingDuration, Characteristic); + } + } + RemainingDuration.UUID = '000000D4-0000-1000-8000-0026BB765291'; + Characteristic.RemainingDuration=RemainingDuration; /** * FakeGato History Service @@ -6244,107 +6302,110 @@ function RegisterCustomCharacteristics() { * Custom Service 'Power Monitor' */ - Service.PowerMonitor = function(displayName, subtype) { - Service.call(this, displayName, '0EB29E08-C307-498E-8E1A-4EDC5FF70607', subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.CurrentPowerConsumption); - this.addCharacteristic(Characteristic.TotalPowerConsumption); - - // Optional Characteristics - - }; - inherits(Service.PowerMonitor, Service); - Service.PowerMonitor.UUID = '0EB29E08-C307-498E-8E1A-4EDC5FF70607'; + class PowerMonitor extends Service { + constructor(displayName, subtype) { + super(displayName, PowerMonitor.UUID, subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.CurrentPowerConsumption); + this.addCharacteristic(Characteristic.TotalPowerConsumption); + + // Optional Characteristics + } + } + PowerMonitor.UUID = '0EB29E08-C307-498E-8E1A-4EDC5FF70607'; + Service.PowerMonitor=PowerMonitor; /** * Custom Service 'Pressure Sensor' */ - Service.PressureSensor = function(displayName, subtype) { - Service.call(this, displayName, 'E863F00A-079E-48FF-8F27-9C2605A29F52', subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.AirPressure); - - // Optional Characteristics - - }; - inherits(Service.PressureSensor, Service); - Service.PressureSensor.UUID = 'E863F00A-079E-48FF-8F27-9C2605A29F52'; + class PressureSensor extends Service { + constructor(displayName, subtype) { + super(displayName, PressureSensor.UUID, subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.AirPressure); + + // Optional Characteristics + } + } + PressureSensor.UUID = 'E863F00A-079E-48FF-8F27-9C2605A29F52'; + Service.PressureSensor=PressureSensor; /** * Custom Service 'Noise Sensor' */ - Service.NoiseSensor = function(displayName, subtype) { - Service.call(this, displayName, '6237cefc-9f4d-54b2-8033-2eda0053b811', subtype); - - // Required Characteristics - this.addCharacteristic(Characteristic.NoiseLevel); - this.addCharacteristic(Characteristic.NoiseQuality); - // Optional Characteristics - - }; - inherits(Service.NoiseSensor, Service); - Service.NoiseSensor.UUID = '6237cefc-9f4d-54b2-8033-2eda0053b811'; + class NoiseSensor extends Service { + constructor(displayName, subtype) { + super(displayName, NoiseSensor.UUID, subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.NoiseLevel); + this.addCharacteristic(Characteristic.NoiseQuality); + // Optional Characteristics + } + } + NoiseSensor.UUID = '6237cefc-9f4d-54b2-8033-2eda0053b811'; + Service.NoiseSensor=NoiseSensor; /** * Custom Service 'Weather Service' */ - Service.WeatherService = function(displayName, subtype) { - Service.call(this, displayName, 'E863F001-079E-48FF-8F27-9C2605A29F52', subtype); - - // Required Characteristics - // this.addCharacteristic(Characteristic.CurrentTemperature); - // this.addCharacteristic(Characteristic.CurrentRelativeHumidity); - // this.addCharacteristic(Characteristic.AirPressure); - this.addCharacteristic(Characteristic.WeatherCondition); - - // Optional Characteristics - this.addOptionalCharacteristic(Characteristic.WindDirection); - this.addOptionalCharacteristic(Characteristic.WindSpeed); - // this.addOptionalCharacteristic(Characteristic.WeatherCondition); - this.addOptionalCharacteristic(Characteristic.UVIndex); - this.addOptionalCharacteristic(Characteristic.Rain); - this.addOptionalCharacteristic(Characteristic.Snow); - this.addOptionalCharacteristic(Characteristic.MinimumTemperature); - }; - inherits(Service.WeatherService, Service); - Service.WeatherService.UUID = 'E863F001-079E-48FF-8F27-9C2605A29F52'; + class WeatherService extends Service { + constructor(displayName, subtype) { + super(displayName, WeatherService.UUID, subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.WeatherCondition); + + // Optional Characteristics + this.addOptionalCharacteristic(Characteristic.WindDirection); + this.addOptionalCharacteristic(Characteristic.WindSpeed); + // this.addOptionalCharacteristic(Characteristic.WeatherCondition); + this.addOptionalCharacteristic(Characteristic.UVIndex); + this.addOptionalCharacteristic(Characteristic.Rain); + this.addOptionalCharacteristic(Characteristic.Snow); + this.addOptionalCharacteristic(Characteristic.MinimumTemperature); + } + } + WeatherService.UUID = 'E863F001-079E-48FF-8F27-9C2605A29F52'; + Service.WeatherService=WeatherService; /** * Custom Service 'EveRoom Service' */ - Service.EveRoomService = function(displayName, subtype) { - Service.call(this, displayName, '0000008D-0000-1000-8000-0026BB765291', subtype); - - // Required Characteristics - // this.addCharacteristic(Characteristic.CurrentTemperature); - // this.addCharacteristic(Characteristic.CurrentRelativeHumidity); - // this.addCharacteristic(Characteristic.AirPressure); - this.addCharacteristic(Characteristic.AirQuality); - - // Optional Characteristics - // this.addOptionalCharacteristic(Characteristic.WeatherCondition); - - }; - inherits(Service.EveRoomService, Service); - Service.EveRoomService.UUID = '0000008D-0000-1000-8000-0026BB765291'; + class EveRoomService extends Service { + constructor(displayName, subtype) { + super(displayName, EveRoomService.UUID, subtype); + + // Required Characteristics + this.addCharacteristic(Characteristic.AirQuality); + // Optional Characteristics + } + } + EveRoomService.UUID = '0000008D-0000-1000-8000-0026BB765291'; + Service.EveRoomService=EveRoomService; /** * Custom Service 'Custom Service' */ - Service.CustomService = function(displayName, subtype) { - Service.call(this, displayName, 'BF0477D3-699A-42F1-BF98-04FCCFE5C8E7', subtype); + class CustomService extends Service { + constructor(displayName, subtype) { + super(displayName, CustomService.UUID, subtype); + + // Required Characteristics - this.addOptionalCharacteristic(Characteristic.Name); - }; - inherits(Service.CustomService, Service); - Service.CustomService.UUID = 'BF0477D3-699A-42F1-BF98-04FCCFE5C8E7'; + // Optional Characteristics + this.addOptionalCharacteristic(Characteristic.Name); + } + } + CustomService.UUID = 'BF0477D3-699A-42F1-BF98-04FCCFE5C8E7'; + Service.CustomService=CustomService; // End of custom Services and Characteristics } From b99c1db5dda344b862fa3f9e46872c92c55a2023 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:54:39 +0200 Subject: [PATCH 39/56] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5771436..a1f0954 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nebz/homebridge-jeedom", "version": "v1.7.0", - "cust_serial": "0031", + "cust_serial": "0032", "description": "Homebridge plugin for Jeedom ", "main": "index.js", "private":true, From 83a650ab8039194c0b6ca74f612bb2011e03ec10 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Mon, 22 Jul 2024 15:54:54 +0200 Subject: [PATCH 40/56] Update package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index a1f0954..f4ff6dd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@nebz/homebridge-jeedom", - "version": "v1.7.0", - "cust_serial": "0032", + "version": "v1.8.4", + "cust_serial": "0001", "description": "Homebridge plugin for Jeedom ", "main": "index.js", "private":true, From e3adeaeb8ef18fbf07ea8c2468502e60558c3bff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 06:10:27 +0000 Subject: [PATCH 41/56] Update @babel/core requirement from >=7.24.9 to >=7.25.2 (#244) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f4ff6dd..fc7b828 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "fakegato-history": "NebzHB/fakegato-history#master" }, "devDependencies": { - "@babel/core": ">=7.24.9", + "@babel/core": ">=7.25.2", "@babel/eslint-parser": "^7.24.8", "eslint": "^8.57.0" }, From da2ff2d00892481368896816f56707985099b2c5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 06:10:44 +0000 Subject: [PATCH 42/56] Bump axios from 1.7.2 to 1.7.3 (#243) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc7b828..d967271 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "dependencies": { "async": "3.2.5", - "axios": "1.7.2", + "axios": "1.7.3", "express": "4.19.2", "fakegato-history": "NebzHB/fakegato-history#master" }, From fc8df72319c5957537b290d228bc25b6efa541f5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 06:14:06 +0000 Subject: [PATCH 43/56] Update @babel/eslint-parser requirement from ^7.24.8 to ^7.25.1 (#241) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d967271..1024343 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "devDependencies": { "@babel/core": ">=7.25.2", - "@babel/eslint-parser": "^7.24.8", + "@babel/eslint-parser": "^7.25.1", "eslint": "^8.57.0" }, "author": "Nebz ", From e8e52289750b3dfe8e62b555bf9e00bc1eefb43d Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 08:51:11 +0200 Subject: [PATCH 44/56] Update .eslintrc.js --- .eslintrc.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index bb2ee3d..4d282f2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,14 +3,15 @@ module.exports = { 'browser': false, 'commonjs': true, 'es6': true, - 'jasmine': true, - 'jest': true, - 'mocha': true, + 'es2021': true, + 'jasmine': false, + 'jest': false, + 'mocha': false, 'node': true }, 'extends': 'eslint:recommended', - 'parser': '@babel/eslint-parser', 'parserOptions': { + 'ecmaVersion': 2021, 'sourceType': 'module', 'requireConfigFile': false }, From f02e2b761153211f37e9ae191ee7de835ffa5c52 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:02:17 +0200 Subject: [PATCH 45/56] Update package.json --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 1024343..21662f8 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "private":true, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "echo \"Error: configure and run homebridge to start\" && exit 1" + "start": "echo \"Error: configure and run homebridge to start\" && exit 1", + "lint:js": "eslint resources/*.js", + "lint": "npm run lint:js" }, "engines": { "node": "^18.0.0", @@ -31,8 +33,6 @@ "fakegato-history": "NebzHB/fakegato-history#master" }, "devDependencies": { - "@babel/core": ">=7.25.2", - "@babel/eslint-parser": "^7.25.1", "eslint": "^8.57.0" }, "author": "Nebz ", From 36934686570ba68edde2247ef4a231c39ec5e614 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:05:46 +0200 Subject: [PATCH 46/56] Update build.yml --- .github/workflows/build.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b23d97..debcafe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,8 +22,5 @@ jobs: - name: Install dependencies run: | npm i - - name: Install ESLint - run: | - npm install eslint@8.10.0 - name: Run ESLint - run: npx eslint . --ext .js --config .eslintrc.js + run: npm run lint From a181f5557688fb87df722e5bf81c794fb9a3ee2f Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:07:51 +0200 Subject: [PATCH 47/56] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 21662f8..fe2bde2 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "echo \"Error: configure and run homebridge to start\" && exit 1", - "lint:js": "eslint resources/*.js", + "lint:js": "eslint *.js", "lint": "npm run lint:js" }, "engines": { From e766ceedbcf083026b08f0e80a3ec7c9017c6ea4 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:08:44 +0200 Subject: [PATCH 48/56] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index debcafe..6b86e0d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [20.x, 21.x] + node-version: [18.x, 20.x, 21.x] steps: - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} From e997bc73f9cba905461c17aefbe3d5490342d230 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:08:58 +0200 Subject: [PATCH 49/56] Delete .github/linters/.eslintrc.js --- .github/linters/.eslintrc.js | 249 ----------------------------------- 1 file changed, 249 deletions(-) delete mode 100644 .github/linters/.eslintrc.js diff --git a/.github/linters/.eslintrc.js b/.github/linters/.eslintrc.js deleted file mode 100644 index bb2ee3d..0000000 --- a/.github/linters/.eslintrc.js +++ /dev/null @@ -1,249 +0,0 @@ -module.exports = { - 'env': { - 'browser': false, - 'commonjs': true, - 'es6': true, - 'jasmine': true, - 'jest': true, - 'mocha': true, - 'node': true - }, - 'extends': 'eslint:recommended', - 'parser': '@babel/eslint-parser', - 'parserOptions': { - 'sourceType': 'module', - 'requireConfigFile': false - }, - 'rules': { - 'arrow-parens': [ - 'error', - 'always' - ], - 'arrow-spacing': 'off', - 'block-scoped-var': 'error', - 'block-spacing': [ - 'off', - 'always' - ], - 'brace-style': [ - 'off', - '1tbs' - ], - 'comma-dangle': [ - 'error', - 'always-multiline' - ], - 'comma-spacing': 'off', - 'comma-style': [ - 'error', - 'last' - ], - 'computed-property-spacing': [ - 'error', - 'never' - ], - 'curly': 'error', - 'dot-notation': 'error', - 'eol-last': 'error', - 'func-call-spacing': [ - 'error', - 'never' - ], - 'implicit-arrow-linebreak': [ - 'error', - 'beside' - ], - 'indent': [ - 'off', - 2, - { - 'ArrayExpression': 'first', - 'CallExpression': { - 'arguments': 'first' - }, - 'FunctionDeclaration': { - 'parameters': 'first' - }, - 'FunctionExpression': { - 'parameters': 'first' - }, - 'ObjectExpression': 'first', - 'SwitchCase': 1 - } - ], - 'key-spacing': [ - 'off', - { - 'afterColon': true, - 'beforeColon': false, - 'mode': 'strict' - } - ], - 'keyword-spacing': [ - 'off', - { - 'after': true, - 'before': true - } - ], - 'linebreak-style': [ - 'error', - 'unix' - ], - 'lines-between-class-members': [ - 'error', - 'always' - ], - 'max-len': [ - 'off', - { - 'code': 80, - 'ignoreTemplateLiterals': true - } - ], - 'multiline-ternary': [ - 'error', - 'always-multiline' - ], - 'no-console': 0, - 'no-duplicate-imports': 'error', - 'no-eval': 'error', - 'no-floating-decimal': 'error', - 'no-implicit-globals': 'error', - 'no-implied-eval': 'error', - 'no-lonely-if': 'error', - 'no-multi-spaces': [ - 'error', - { - 'ignoreEOLComments': true - } - ], - 'no-multiple-empty-lines': 'off', - 'no-prototype-builtins': 'off', - 'no-return-assign': 'error', - 'no-script-url': 'error', - 'no-self-compare': 'error', - 'no-sequences': 'error', - 'no-shadow-restricted-names': 'error', - 'no-tabs': 'off', - 'no-trailing-spaces': 'off', - 'no-undefined': 'off', - 'no-unmodified-loop-condition': 'error', - 'no-unused-vars': [ - 'error', - { - 'argsIgnorePattern': '^_', - 'varsIgnorePattern': '^_' - } - ], - 'no-useless-computed-key': 'error', - 'no-useless-concat': 'error', - 'no-useless-constructor': 'off', - 'no-useless-return': 'error', - 'no-var': 'off', - 'no-void': 'error', - 'no-whitespace-before-property': 'error', - 'object-curly-newline': [ - 'error', - { - 'consistent': true - } - ], - 'object-curly-spacing': [ - 'error', - 'never' - ], - 'object-property-newline': [ - 'error', - { - 'allowMultiplePropertiesPerLine': true - } - ], - 'operator-linebreak': [ - 'error', - 'after' - ], - 'padded-blocks': [ - 'off', - { - 'blocks': 'never' - } - ], - 'prefer-const': 'error', - 'prefer-template': 'off', - 'quote-props': [ - 'off', - 'as-needed' - ], - 'quotes': [ - 'off', - 'single', - { - 'allowTemplateLiterals': true - } - ], - 'semi': [ - 'error', - 'always' - ], - 'semi-spacing': [ - 'off', - { - 'after': true, - 'before': false - } - ], - 'semi-style': [ - 'error', - 'last' - ], - 'space-before-blocks': [ - 'off', - 'always' - ], - 'space-before-function-paren': [ - 'error', - { - 'anonymous': 'never', - 'asyncArrow': 'always', - 'named': 'never' - } - ], - 'space-in-parens': [ - 'off', - 'never' - ], - 'space-infix-ops': 'off', - 'space-unary-ops': [ - 'error', - { - 'nonwords': false, - 'words': true - } - ], - 'spaced-comment': [ - 'error', - 'always', - { - 'block': { - 'balanced': true, - 'exceptions': [ - '*' - ] - } - } - ], - 'switch-colon-spacing': [ - 'off', - { - 'after': true, - 'before': false - } - ], - 'template-curly-spacing': [ - 'error', - 'never' - ], - 'yoda': 'error' - } -}; From b9195fa4a79d5355c1bc7b3e8a746db406f8d05d Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:09:22 +0200 Subject: [PATCH 50/56] Delete .github/workflows/super-linter.yml --- .github/workflows/super-linter.yml | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 .github/workflows/super-linter.yml diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml deleted file mode 100644 index f6830fb..0000000 --- a/.github/workflows/super-linter.yml +++ /dev/null @@ -1,30 +0,0 @@ -# This workflow executes several linters on changed files based on languages used in your code base whenever -# you push a code or open a pull request. -# -# You can adjust the behavior by modifying this file. -# For more information, see: -# https://github.com/github/super-linter -name: Lint Code Base - -on: - push: - branches: [ "beta" ] - pull_request: - branches: [ "beta" ] -jobs: - run-lint: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: Lint Code Base - uses: github/super-linter@v4 - env: - VALIDATE_ALL_CODEBASE: false - DEFAULT_BRANCH: "beta" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - VALIDATE_JAVASCRIPT_STANDARD: false From 8e6335ef3b21ea46046ad7bcff40759aecdf4b9a Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:09:39 +0200 Subject: [PATCH 51/56] Delete .github/workflows/codeql.yml --- .github/workflows/codeql.yml | 56 ------------------------------------ 1 file changed, 56 deletions(-) delete mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index fbdb01f..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [ beta ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ beta ] - schedule: - - cron: '17 9 * * 2' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: [ 'javascript' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹ️ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 From a71ea62062cd189e04520bf6858cfe9a1481767d Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:13:31 +0200 Subject: [PATCH 52/56] Update .eslintrc.js --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4d282f2..bd9f2da 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -32,7 +32,7 @@ module.exports = { ], 'comma-dangle': [ 'error', - 'always-multiline' + 'only-multiline' ], 'comma-spacing': 'off', 'comma-style': [ From 1b74cbb6018600ce4063a57c5764185a22093eec Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:14:53 +0200 Subject: [PATCH 53/56] Update .eslintrc.js --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index bd9f2da..10db6fa 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -32,7 +32,7 @@ module.exports = { ], 'comma-dangle': [ 'error', - 'only-multiline' + 'never' ], 'comma-spacing': 'off', 'comma-style': [ From 7c80ae5d9113f17607341030c1e77742b7c930b5 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:16:00 +0200 Subject: [PATCH 54/56] Delete .eslintignore --- .eslintignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index b9b70d1..0000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -**/.*.js From e0ac1966b3e0c3fecfb55670f8b44fc30050b6a7 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:29:53 +0200 Subject: [PATCH 55/56] Update .eslintrc.js --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 10db6fa..bd9f2da 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -32,7 +32,7 @@ module.exports = { ], 'comma-dangle': [ 'error', - 'never' + 'only-multiline' ], 'comma-spacing': 'off', 'comma-style': [ From a2a381d6476c029c9ae580ee10ff560c1b7183e9 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Tue, 13 Aug 2024 09:35:05 +0200 Subject: [PATCH 56/56] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b86e0d..8cc2f27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,9 +14,9 @@ jobs: matrix: node-version: [18.x, 20.x, 21.x] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3.1.1 + uses: actions/setup-node@v4.0.3 with: node-version: ${{ matrix.node-version }} - name: Install dependencies