dzVents : There is no device with that name

Posez ici vos questions d'utilisation, de configuration de DomoticZ, de bugs, de conseils sur le logiciel lui même dans son utilisation et son paramétrage.
Des forums spécifiques sont ouverts ci-dessous pour regrouper les différents sujets.
bipbip59
Messages : 10
Inscription : 31 juil. 2020, 07:56

dzVents : There is no device with that name

Message par bipbip59 »

Bonjour,

Je débute dans l'utilisation de domoticz, et je rencontre un cas étrange :
dans le code suivant :

Code : Tout sélectionner

return {
	active = true, 
	on = {
		devices =
		{'Arm 1 partition',
		    'Zone:IR Bureau',
	    },
		
	},

	execute = function(domoticz,alarme)
	    

 domoticz.devices().forEach(function(device)
     domoticz.log(device.name)
    end)

	    
			   pirs = 'Arm 1 partition:['..domoticz.devices('Arm 1 partition').state.."] - "; 
			   pirs = pirs..'CLIM Atelier:['..domoticz.devices('CLIM Atelier - Power').state.."] - "; 
			   pirs = pirs..'CLIM Bureau:['..domoticz.devices('CLIM Bureau - Power').state.."] - "; 
			   pirs = pirs..'CLIM Cuisine:['..domoticz.devices('CLIM Cuisine - Power').state.."] - "; 
--			   pirs = pirs..'CLIM SAR:['..domoticz.devices(116).state.."] - "; 
			   pirs = pirs..'CLIM SAR:['..domoticz.devices('CLIM SAR - Power').state.."] - "; 

			   
		 	   domoticz.log("ARRET CLIM "..pirs, LOG_INFO);
		 	   


			if  (domoticz.devices('Arm 1 partition').state=='On') then
		 	   domoticz.log(">>>>>>>>>>>>>>>  CLIM SWITCH OFF <<<<<<<<<<<<<<<<<<<<<< ", LOG_INFO);
			   domoticz.devices('CLIM Atelier - Power').switchOff();
			   domoticz.devices('CLIM Bureau - Power').switchOff();
			   domoticz.devices('CLIM Cuisine - Power').switchOff();
			   domoticz.devices(116).switchOff();
			end
	end
}
La ligne suivante me pose problème:

Code : Tout sélectionner

   pirs = pirs..'CLIM SAR:['..domoticz.devices('CLIM SAR - Power').state.."] - "; 
Le code plante est le Log indique :
2020-07-31 07:55:32.949 Error: dzVents: Error: (3.0.11) There is no device with that name or id: CLIM SAR - Power

hors si on observe les traces précédentes j'ai bien un device qui se nomme de cette façon et cela fonctionne pour les 3 autres clims....
Si je remplace par son index (116) cela fonctionne, c'est une solution mais j'aimerai bien comprendre.

Si vous avez une idée .
Merci à vous

Code : Tout sélectionner


2020-07-31 07:55:32.738 Status: dzVents: Info: Relais 5 (Volet Down)
2020-07-31 07:55:32.744 Status: dzVents: Info: Relais 6 (Volet Up)
2020-07-31 07:55:32.750 Status: dzVents: Info: Relais 7 (IPX800)
2020-07-31 07:55:32.756 Status: dzVents: Info: Relais 8 (IPX800)
2020-07-31 07:55:32.762 Status: dzVents: Info: Entrée 1 Detecteur
2020-07-31 07:55:32.768 Status: dzVents: Info: Entrée 2 Gache
2020-07-31 07:55:32.773 Status: dzVents: Info: Entrée 3 Blocage Portail
2020-07-31 07:55:32.779 Status: dzVents: Info: Entrée 4 IPX800
2020-07-31 07:55:32.786 Status: dzVents: Info: Entrée 5 IPX800
2020-07-31 07:55:32.792 Status: dzVents: Info: Entrée 6 IPX800
2020-07-31 07:55:32.798 Status: dzVents: Info: Entrée 7 IPX800
2020-07-31 07:55:32.804 Status: dzVents: Info: Entrée 8 IPX800
2020-07-31 07:55:32.810 Status: dzVents: Info: CLIM Cuisine - Power
2020-07-31 07:55:32.815 Status: dzVents: Info: CLIM Cuisine - Temp IN
2020-07-31 07:55:32.821 Status: dzVents: Info: CLIM Cuisine - Temp OUT
2020-07-31 07:55:32.827 Status: dzVents: Info: CLIM Cuisine - Mode
2020-07-31 07:55:32.834 Status: dzVents: Info: CLIM Cuisine - Fan Rate
2020-07-31 07:55:32.840 Status: dzVents: Info: CLIM Cuisine - Temp TARGET
2020-07-31 07:55:32.846 Status: dzVents: Info: CLIM Atelier - Power
2020-07-31 07:55:32.851 Status: dzVents: Info: CLIM Atelier - Temp IN
2020-07-31 07:55:32.857 Status: dzVents: Info: CLIM Atelier - Temp OUT
2020-07-31 07:55:32.864 Status: dzVents: Info: CLIM Atelier - Mode
2020-07-31 07:55:32.870 Status: dzVents: Info: CLIM Atelier - Fan Rate
2020-07-31 07:55:32.876 Status: dzVents: Info: CLIM Atelier - Temp TARGET
2020-07-31 07:55:32.882 Status: dzVents: Info: CLIM SAR - Power
2020-07-31 07:55:32.888 Status: dzVents: Info: CLIM SAR - Temp IN
2020-07-31 07:55:32.894 Status: dzVents: Info: CLIM SAR - Temp OUT
2020-07-31 07:55:32.900 Status: dzVents: Info: CLIM SAR - Mode
2020-07-31 07:55:32.906 Status: dzVents: Info: CLIM SAR - Fan Rate
2020-07-31 07:55:32.912 Status: dzVents: Info: CLIM SAR - Temp TARGET
2020-07-31 07:55:32.918 Status: dzVents: Info: CLIM Bureau - Power
2020-07-31 07:55:32.924 Status: dzVents: Info: CLIM Bureau - Temp IN
2020-07-31 07:55:32.930 Status: dzVents: Info: CLIM Bureau - Temp OUT
2020-07-31 07:55:32.936 Status: dzVents: Info: CLIM Bureau - Mode
2020-07-31 07:55:32.942 Status: dzVents: Info: CLIM Bureau - Fan Rate
2020-07-31 07:55:32.948 Status: dzVents: Info: CLIM Bureau - Temp TARGET
2020-07-31 07:55:32.951 Status: dzVents: Info: ------ Finished Arret CLIM
2020-07-31 07:55:32.951 Status: dzVents: Info: ------ Start internal script: CAM Entrée: Device: "Zone:IR Bureau (Satel Integra)", Index: 32
2020-07-31 07:55:32.951 Status: dzVents: Info: ------ Finished CAM Entrée
2020-07-31 07:55:32.949 Error: dzVents: Error: (3.0.11) There is no device with that name or id: CLIM SAR - Power
2020-07-31 07:55:32.950 Error: dzVents: Error: (3.0.11) An error occurred when calling event handler Arret CLIM
2020-07-31 07:55:32.950 Error: dzVents: Error: (3.0.11) ...omoticz/scripts/dzVents/generated_scripts/Arret CLIM.lua:24: attempt to index a nil value
2020-07-31 07:55:33.198 (CLIM Bureau) onMessage called
2020-07-31 07:55:46.047 (CLIM Cuisine) onMessage called
2020-07-31 07:55:46.221 (CLIM Cuisine) onMessage called
boum
Messages : 233
Inscription : 18 janv. 2019, 11:34
Localisation : France

Re: dzVents : There is no device with that name

Message par boum »

Une des raisons peut être que le nom passé n'est pas identique. Le plus probable est qu'il y ait une espace supplémentaire au bout du nom du dispositif. Sinon, un caractère Unicode non affichable ou subtilement différent I/l, '/’ … s'est peut-être glissé là.
Dans le doute, fais un essai en renommant le dispositif avec un nom court et sans ambiguïté et vérifie son utilisation dans le script.
Domoticz v2022.2 sur linux-mint / Z-Wave-JS / RFXCom / Zigbee2MQTT
Répondre