Paramétrage pompe à chaleur Caliente

Sous forum dédié au plugin MQTTMAPPER de FlyingDomotic
Merci de poster vous questions concernant ce plugin ici et non pas dans le forum MQTT directement
Flying Domotic
Messages : 772
Inscription : 10 mars 2020, 15:26

Re: Plugin MQTT de FlyingDomotic

Message par Flying Domotic »

knasson a écrit : 04 juin 2024, 16:23
Si ça ne fonctionne toujours pas, faire une modif sur la pompe depuis Domoticz et m'envoyer la partie du log qui tourne autour de la modif.
bon j'ai essayé mais ca ne fonctionne pas.
les logs la j'ai activé le niveau
voici ce que je peux relever dans l'onglet erreur:

Code : Tout sélectionner

2024-06-04 09:57:07.383 Error: dzVents: Error: (3.1.8) ...oticz/scripts/dzVents/generated_scripts/PAC config 4.lua:81: attempt to call a nil value (global 'changeSwitch')
2024-06-04 09:57:21.826 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler PAC config 4
2024-06-04 09:57:21.826 Error: dzVents: Error: (3.1.8) ...oticz/scripts/dzVents/generated_scripts/PAC config 4.lua:81: attempt to call a nil value (global 'changeSwitch')
2024-06-04 09:58:04.391 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler PAC config 4
2024-06-04 09:58:04.391 Error: dzVents: Error: (3.1.8) ...oticz/scripts/dzVents/generated_scripts/PAC config 4.lua:81: attempt to call a nil value (global 'changeSwitch')
2024-06-04 09:58:17.132 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler PAC config 4
2024-06-04 09:58:17.132 Error: dzVents: Error: (3.1.8) ...oticz/scripts/dzVents/generated_scripts/PAC config 4.lua:81: attempt to call a nil value (global 'changeSwitch')
2024-06-04 09:58:33.607 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler PAC config 4
2024-06-04 09:58:33.607 Error: dzVents: Error: (3.1.8) ...oticz/scripts/dzVents/generated_scripts/PAC config 4.lua:81: attempt to call a nil value (global 'changeSwitch')
2024-06-04 09:58:45.241 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler PAC config 4
2024-06-04 09:58:45.241 Error: dzVents: Error: (3.1.8) ...oticz/scripts/dzVents/generated_scripts/PAC config 4.lua:81: attempt to call a nil value (global 'changeSwitch')
2024-06-04 09:59:01.435 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler PAC config 4
2024-06-04 09:59:01.435 Error: dzVents: Error: (3.1.8) ...oticz/scripts/dzVents/generated_scripts/PAC config 4.lua:81: attempt to call a nil value (global 'changeSwitch')
2024-06-04 13:39:36.612 Error: dzVents: Error: (3.1.8) An error occurred when calling event handler PAC config 4
2024-06-04 13:39:36.612 Error: dzVents: Error: (3.1.8) ...oticz/scripts/dzVents/generated_scripts/PAC config 4.lua:64: attempt to compare number with string
la j'ai activé l'onglet "auto" du "PAC modes" mais ca revient sur "chauffage"
sinon je vois ça

Code : Tout sélectionner

2024-06-04 16:31:40.358 Status: dzVents: Debug: Processing device-adapter for Clim config 4: Custom sensor device adapter
2024-06-04 16:31:40.360 Status: dzVents: Debug: - Device: Clim config 4
2024-06-04 16:31:40.371 Status: dzVents: Info: Handling events for: "Clim config 4", value: "25"
2024-06-04 16:31:40.371 Status: dzVents: Info: ------ Start internal script: PAC config 4: Device: "Clim config 4 (PAC Calient)", Index: 1228
2024-06-04 16:31:40.372 Status: dzVents: Clim config 4: Reçu 25, pompe=false, horloge=false, mode=20
2024-06-04 16:31:40.374 Status: dzVents: Info: ------ Finished PAC config 4
dis moi si ca te parle...
Du coup, je veux bien aussi le script, ainsi que les noms réels des switchs/sélecteurs.
Flying Domotic
Messages : 772
Inscription : 10 mars 2020, 15:26

Re: Plugin MQTT de FlyingDomotic

Message par Flying Domotic »

knasson a écrit : 04 juin 2024, 16:47 bonjour,

voila ma representation du fonctionnement de la PAC tel que je souhaiterai que ca fonctionne.
A priori, l'implémentation proposée doit faire un peu ça. En fait, il suffit de changer les switchs/sélecteurs pour que la commande envoyée sur config/4 soit correcte.
knasson
Messages : 245
Inscription : 26 mars 2021, 08:59

Re: Plugin MQTT de FlyingDomotic

Message par knasson »

fichier MqttMapper.json

Code : Tout sélectionner

 "tempIN": {
        "topic": "/home/alsavo/status/16",
        "type": "80", "subtype": "5", "switchtype": "0",
        "mapping": {"item": "value", "multiplier": 1}
    },
    "tempOUT": {
        "topic": "/home/alsavo/status/17",
        "type": "80", "subtype": "5", "switchtype": "0",
        "mapping": {"item": "value", "multiplier": 1}
    },
    "tempAmbient": {
        "topic": "/home/alsavo/status/18",
        "type": "80", "subtype": "5", "switchtype": "0",
        "mapping": {"item": "value", "multiplier": 1}
    },
    "Amperes  Compresseur": {
        "topic": "/home/alsavo/status/26",
        "type": "243", "subtype": "23", "switchtype": "0",
        "mapping": {"item": "value"}
    },
    "Etat pompe a chaleur":{"topic": "/home/alsavo/status/53",
        "type": "244", "subtype":"62", "switchtype":"18",
        "options":{"SelectorStyle":"0","LevelOffHidden":"false", "LevelNames":"Arret|Chauffage|Cooling"},
        "mapping":{"item": "value", "default": "0","values": {"0":"0","3":"10","1":"20"}}
    },
    "temp target heating":{"topic": "/home/alsavo/config/1",
        "type": "242", "subtype":"1","switchtype": "0",
        "mapping":{"item":"value",  "multiplier":0.1},
        "set": {"command": "plugins/MqttMapper/alsavoSet.sh 1 # "}
    },
    "temp target cooling":{"topic": "/home/alsavo/config/2",
        "type": "242", "subtype":"1","switchtype": "0",
        "mapping":{"item":"value",  "multiplier":0.1},
        "set": {"command": "plugins/MqttMapper/alsavoSet.sh 2 # "}
     },
   "temp target autoMode":{"topic": "/home/alsavo/config/3",
        "type": "242", "subtype":"1","switchtype": "0",
        "mapping":{"item":"value",  "multiplier":0.1},
        "set": {"command": "plugins/MqttMapper/alsavoSet.sh 3 # "}
     },
   "Fan Speed":{"topic": "/home/alsavo/status/22",
        "type": "243","subtype":"31","switchtype": "0",
        "options":{"Custom":"1;RPM"},
        "mapping":{"item":"value"}
            },
   "Clim config 4": {"topic": "/home/alsavo/config/4",
        "type": "243", "subtype": "31", "switchtype": "0",
        "options": {"Custom":"1;Bitmap"},
        "visible":"false",
        "mapping":{"item":"value"},
        "set": {"command":"plugins/MqttMapper/alsavoSetNum.sh 4 #"}
    },

   "PAC Regime de Marche": {"topic": "/home/alsavo/config/16",
        "type": "244", "subtype":"62", "switchtype":"18",
        "options":{"SelectorStyle":"0","LevelOffHidden":"false", "LevelNames":"Silencieux|Smart|Powerful"},
        "mapping":{"item":"value","default":"0","values": {"0":"0","1":"10","2":"20"}},
        "set": {"command":"plugins/MqttMapper/alsavoSetNum.sh 16 # "}
    }

}

les noms reels des devices
Pièces jointes
PACCaliente.png
PACCaliente.png (53.42 Kio) Consulté 1780 fois
Flying Domotic
Messages : 772
Inscription : 10 mars 2020, 15:26

Re: Plugin MQTT de FlyingDomotic

Message par Flying Domotic »

Et le script dsVents ?
knasson
Messages : 245
Inscription : 26 mars 2021, 08:59

Re: Plugin MQTT de FlyingDomotic

Message par knasson »

Code : Tout sélectionner

local config4Device = "Clim config 4"
local pompeDevice = "Pompe PAC"
local horlogeDevice = "Horloge PAC"
local modeDevice = "PAC modes"

return {
	on = {devices = {config4Device, pompeDevice, horlogeDevice, modeDevice}},
	execute = function(domoticz, device)

        -- Fonction de changement d'un switch depuis config4
        function changeSwitch(setDevice, newState)
            if setDevice.active ~= newState then                                      -- Doit on changer le switch ?
                print(config4Device..": Mets "..setDevice.name.." à "..tostring(newState))
                if newState then
                    setDevice.switchOn()
                else
                    setDevice.switchOff()
                end
            end
        end

        -- Fonction de changement d'un sélecteur depuis config4
        function changeSelector(setDevice, newLevel)
            if setDevice.levelVal ~= newLevel then                              -- Doit on changer la valeur ?
                print(config4Device..": Mets "..setDevice.name.." à "..tostring(newLevel))
                setDevice.setLevel(newLevel)
            end
        end

        -- Fonction de changement de config4 depuis un switch
        function changeConfigSwitch(changedDevice, oldState)
            if changedDevice.active ~= oldState then                             -- Doit on changer le switch
                print(config4Device..": Config4 modifié par "..changedDevice.name.." à "..tostring(changedDevice.active))
            end
            return changedDevice.active
        end

        -- Fonction de changement de config4 depuis un sélecteur
        function changeConfigSelector(changedDevice, oldLevel)
            if changedDevice.levelVal ~= oldLevel then                          -- Doit on changer la valeur ?
                print(config4Device..": Config4 modifié par "..changedDevice.name.." à "..tostring(changedDevice.levelVal))
            end
            return changedDevice.levelVal
        end

        -- Fonction de chargement de config4
        function setConfig4(pompe, horloge, mode)
            local setValue = (mode / 10) + 23                                   -- Mode 10 = 24, 20 = 25, 30 = 26
            if (pompe ~= 0) then
                setValue = setValue + 32                                        -- Pompe + 32
            end
            if (horloge ~= 0) then                              
                setValue = setValue + 132                                       -- Horloge + 132
            end
            if domoticz.devices(config4Device).levelVal ~= setValue then        -- Doit on changer config4?
                print(config4Device..": Défini config4="..tostring(setValue))   -- Oui
                domoticz.devices(config4Device).updateCustomSensor(setValue)
            end
        end

	    -- Décoder config4. Si le contenu n'est pas comme attendu, ne rien faire
	    local config4 = domoticz.devices(config4Device).sensorValue             -- Lit la valeur de config4
		local horloge = false   
		if config4 >= 132 then                                                  -- Horloge = 132
            horloge = true
            config4 = config4 - 132
		end
		local pompe = false
		if config4 >= 32 then                                                   -- Pompe = 32
		    pompe = true
		    config4 = config4 - 32
		end
		if config4 < 24 or  config4 > 26 then                                   -- Mode = 24 (Froid), 25 (Chaud) ou 26 (Auto)
		    print(config4Device..": ?? Ne sait pas décoder config4="..tostring(domoticz.devices(config4Device).sensorValue))
		else
		    mode = (config4 - 23) * 10                                          -- Mode 24 = froid (10), 25 = chaud (20), 26 = auto (30)
            -- Ici, config4 semble correct, voir ce qui a changé et agir en conséquence
            if device == domoticz.devices(config4Device) then
                -- C'est config4 qui a été modifié
                print(config4Device..": Reçu "..tostring(domoticz.devices(config4Device).sensorValue)..", pompe="..tostring(pompe)..", horloge="..tostring(horloge)..", mode="..tostring(mode)) 
                changeSwitch(domoticz.devices(pompeDevice), pompe)              -- Aligner les valeurs
                changeSwitch(domoticz.devices(horlogeDevice), horloge)
                changeSelector(domoticz.devices(modeDevice), mode)
            elseif device == domoticz.devices(pompeDevice) then
                -- C'est la pompe qui a changé
                changeConfigSwitch(domoticz.devices(pompeDevice), pompe)         -- Aligner les valeurs
            elseif device == domoticz.devices(horlogeDevice) then
                -- C'est l'horloge qui a changé
                changeConfigSwitch(domoticz.devices(horlogeDevice), horloge)
            elseif device == domoticz.devices(modeDevice) then
                -- C'est le mode qui a changé
                changeConfigSelector(domoticz.devices(modeDevice), mode)
            else
                -- On a été activé par un device inconnu. Bug de Domoticz?
                print(config4Device..": ?? Je ne comprends pas le changement de "..device.name..", idx="..device.id)       
            end
        end
end
}
Flying Domotic
Messages : 772
Inscription : 10 mars 2020, 15:26

Re: Plugin MQTT de FlyingDomotic

Message par Flying Domotic »

J'ai copié/collé le code ci-dessous chez moi, et il fonctionne bien. J'ai vérifié les noms, et n'ai rien trouvé.

A bien y regarder, les erreurs (9h57 à 13h39) sont toutes bien avant les messages de changement de 16h31. Il est difficile de faire un parallèle ... d'autant que je n'arrive pas à reproduire chez moi avec une 2024.4.

Il pourrait être également habile de purger le log, soit en le détruisant, soit en le renommant avant les manips.

Si la seule erreur décrite est le problème de changement d'état du mode de la pompe, il serait habile de vérifier que les valeurs sont bien en phase avec les textes sur le sélecteur "PAC modes" (0 = Off, 10 = Froid, 20 = Chaud, 30 = Auto).

S'il y a des erreurs et ou incohérences, datées d'après les modifs du jour, je suis intéressé.
knasson
Messages : 245
Inscription : 26 mars 2021, 08:59

Re: Plugin MQTT de FlyingDomotic

Message par knasson »

En attendant j'avais créé ça dans le fichier .json

Code : Tout sélectionner

 "PAC Modes":{"topic":"/home/alsavo/config/4",
        "type":"244", "subtype":"62", "switchtype":"18",
        "options":{"SelectrorStyle":"0","LevelOffHidden":"false", "LevelNames":"Arret|Cooling|Chauffage|Auto"},
        "mapping":{"item":"value","default":"0","values": {"24":"0","56":"10","57":"20","58":"30"}},
        "set": {"command":"plugins/MqttMapper/alsavoSetNum.sh 4 #"}
        }
j'ai,testé ca fonctionne ,
le seul truc est que les codes sont differents si l'Hologe est "On" .
Bon, Je vais reprendre le tout.... (peut être qu'un truc m'a echappé!)
-virer le selecteur "PAC modes " du plugins MqttMapper (que je viens de creer) et le creer dans domoticz.
(Faut il,3 ou 4 niveau? les script a l'air d'etre ecrit pour 3 niveaux.
-recreer le device caché "Clim config 4"
et les 2 switchs "Pompe PAC" et "Horloge PAC"
activer le script dzvents.
Flying Domotic
Messages : 772
Inscription : 10 mars 2020, 15:26

Re: Plugin MQTT de FlyingDomotic

Message par Flying Domotic »

Il n'est possible de n'associer qu'un seul device Domoticz par topic MQTT.

Le principe est donc d'écrire le topic config/4 dans le device "Clim config 4" et de :
  • décortiquer son contenu lorsqu'il change, et copier les valeurs extraites dans les 2 swtichs et le sélecteur.
  • lire chacun des switch et sélecteur quand ils changent, recomposer "Clim config 4" et le charger pour qu'il soit mis à jour par la commande.
Le .JSON de configuration et le scripts fournis font tout le boulot, sans qu'il n'y ait besoin d'ajouter quelque chose d'autre.

J'ai testé chez moi avec une 2024.4, en simulant les changements de la clim par MQTT Explorer, et tout fonctionne bien, dans les 2 sens.

Il serait habile de (re)mettre en place le JSON et le script, puis de relancer le plugin MqttMapper.

Bien vérifier également que les niveaux du sélecteur sont les bons.

Ne pas hésiter à partager le résultat des tests, avec les parties du log de Domoticz qui vont avec, en se basant sur l'heure du log. Tout est tracé pour permettre le debug, si besoin.
Flying Domotic
Messages : 772
Inscription : 10 mars 2020, 15:26

Re: Plugin MQTT de FlyingDomotic

Message par Flying Domotic »

J'ai oublié une partie de la réponse : il faut 4 niveaux pour le sélecteur (Off qui est à zéro par défaut, et 10, 20, 30 pour Froid, chaud, auto.

On peut aussi tenter de ne pas cacher "Clim config 4" en virant "visible":"false", de sa définition.
knasson
Messages : 245
Inscription : 26 mars 2021, 08:59

Re: Plugin MQTT de FlyingDomotic

Message par knasson »

J'ai tout repris voila la config JSON du climconfig 4
JSON1.png
JSON1.png (14.7 Kio) Consulté 1861 fois
et je confirme je n'ai qu'un seul device sur cet item./4

j'affiche les 3 devices simultanement et j'actionne Pompe PAC (-->"On") --> je ne vois rien bouger sur "Clim config 4",
PAC1.png
PAC1.png (113.82 Kio) Consulté 1861 fois
il semble "autiste"
je vois ca dans les logsans action particuliere sur les swicthes.

Code : Tout sélectionner

024-06-06 15:59:18.147 Status: dzVents: Debug: Processing device-adapter for PAC Calient - Fan Speed: Custom sensor device adapter
2024-06-06 15:59:18.148 Status: dzVents: Debug: Processing device-adapter for PAC Regime de Marche: Switch device adapter
2024-06-06 15:59:18.149 Status: dzVents: Debug: - Device: PAC Calient - tempIN
2024-06-06 15:59:18.149 Status: dzVents: Debug: - Device: PAC Calient - tempOUT
2024-06-06 15:59:18.149 Status: dzVents: Debug: - Device: PAC Calient - Amperes Compresseur
2024-06-06 15:59:18.149 Status: dzVents: Debug: - Device: PAC Calient - temp target heating
2024-06-06 15:59:18.149 Status: dzVents: Debug: - Device: PAC Calient - temp target cooling
2024-06-06 15:59:18.149 Status: dzVents: Debug: - Device: PAC Calient - Fan Speed
2024-06-06 15:59:18.149 Status: dzVents: Debug: - Device: PAC Regime de Marche
2024-06-06 15:59:18.161 Status: dzVents: Info: ------ Start internal script: PAC config 4: Device: "Clim config 4 (PAC Calient)", Index: 1237
2024-06-06 15:59:18.161 Status: dzVents: Debug: Processing device-adapter for Pompe PAC: Switch device adapter
2024-06-06 15:59:18.162 Status: dzVents: Debug: Processing device-adapter for Horloge PAC: Switch device adapter
2024-06-06 15:59:18.162 Status: dzVents: Debug: Processing device-adapter for PAC modes: Switch device adapter
2024-06-06 15:59:18.162 Status: dzVents: Info: ------ Finished PAC config 4
si j'actionne "Pompe PAC" --->"On"

Code : Tout sélectionner

06 16:10:50.740 Pompe PAC: Light/Switch (Pompe PAC)
2024-06-06 16:10:50.735 Status: User: knasson (IP: 192.168.1.78) initiated a switch command (1238/Pompe PAC/On)
2024-06-06 16:10:51.964 Status: dzVents: Debug: Processing device-adapter for Pompe PAC: Switch device adapter
2024-06-06 16:10:51.964 Status: dzVents: Debug: - Device: Pompe PAC
[b]2024-06-06 16:10:51.976 Status: dzVents: Info: Handling events for: "Pompe PAC", value: "On"
2024-06-06 16:10:51.976 Status: dzVents: Info: ------ Start internal script: PAC config 4: Device: "Pompe PAC (Pompe PAC)", Index: 1238
2024-06-06 16:10:51.977 Status: dzVents: Clim config 4: Config4 modifié par Pompe PAC à true
2024-06-06 16:10:51.977 Status: dzVents: Info: ------ Finished PAC config 4[/b]
2024-06-06 16:10:54.074 PAC Calient: onMQTTConnected found /home/alsavo/status/16, Device 'PAC Calient - tempIN'
2024-06-06 16:10:54.074 PAC Calient: Setting PAC Calient - tempIN to >25.1<
2024-06-06 16:10:54.083 PAC Calient: onMQTTConnected found /home/alsavo/status/17, Device 'PAC Calient - tempOUT'
2024-06-06 16:10:54.083 PAC Calient: Setting PAC Calient - tempOUT to >25.3<
2024-06-06 16:10:54.095 PAC Calient: onMQTTConnected found /home/alsavo/status/18, Device 'PAC Calient - tempAmbient'
2024-06-06 16:10:54.096 PAC Calient: Setting PAC Calient - tempAmbient to >29.8<
2024-06-06 16:10:54.108 PAC Calient: onMQTTConnected found /home/alsavo/status/22, Device 'PAC Calient - Fan Speed'
2024-06-06 16:10:54.108 PAC Calient: Setting PAC Calient - Fan Speed to 0/0
2024-06-06 16:10:54.118 PAC Calient: onMQTTConnected found /home/alsavo/status/26, Device 'PAC Calient - Amperes Compresseur'
2024-06-06 16:10:54.118 PAC Calient: Setting PAC Calient - Amperes Compresseur to 0/0
2024-06-06 16:10:54.126 PAC Calient: onMQTTConnected found /home/alsavo/status/53, Device 'Etat pompe a chaleur'
2024-06-06 16:10:54.126 PAC Calient: testValue="0" (<class 'str'>), readValue="0" (<class 'str'>)
2024-06-06 16:10:54.126 PAC Calient: testValue="3" (<class 'str'>), readValue="0" (<class 'str'>)
2024-06-06 16:10:54.126 PAC Calient: testValue="1" (<class 'str'>), readValue="0" (<class 'str'>)
2024-06-06 16:10:54.127 PAC Calient: Setting Etat pompe a chaleur to 0/0
2024-06-06 16:10:54.135 PAC Calient: onMQTTConnected found /home/alsavo/config/1, Device 'PAC Calient - temp target heating'
2024-06-06 16:10:54.135 PAC Calient: Setting PAC Calient - temp target heating to >29.0<
2024-06-06 16:10:54.142 PAC Calient: onMQTTConnected found /home/alsavo/config/2, Device 'PAC Calient - temp target cooling'
2024-06-06 16:10:54.143 PAC Calient: Setting PAC Calient - temp target cooling to >29.5<
2024-06-06 16:10:54.150 PAC Calient: onMQTTConnected found /home/alsavo/config/3, Device 'PAC Calient - temp target autoMode'
2024-06-06 16:10:54.150 PAC Calient: Setting PAC Calient - temp target autoMode to >28.0<
2024-06-06 16:10:54.158 PAC Calient: onMQTTConnected found /home/alsavo/config/4, Device 'Clim config 4'
2024-06-06 16:10:54.158 PAC Calient: Setting Clim config 4 to 24/24
2024-06-06 16:10:54.167 PAC Calient: onMQTTConnected found /home/alsavo/config/16, Device 'PAC Regime de Marche'
2024-06-06 16:10:54.167 PAC Calient: testValue="0" (<class 'str'>), readValue="1" (<class 'str'>)
2024-06-06 16:10:54.168 PAC Calient: testValue="1" (<class 'str'>), readValue="1" (<class 'str'>)
2024-06-06 16:10:54.168 PAC Calient: testValue="2" (<class 'str'>), readValue="1" (<class 'str'>)
2024-06-06 16:10:54.168 PAC Calient: Setting PAC Regime de Marche to 10/10
2024-06-06 16:10:54.173 Status: dzVents: Debug: Processing device-adapter for PAC Calient - tempIN: Temperature device adapter
2024-06-06 16:10:54.173 Status: dzVents: Debug: - Device: PAC Calient - tempIN
Dernière modification par knasson le 06 juin 2024, 18:45, modifié 1 fois.
Répondre