probleme conso virtuel

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.
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: probleme conso virtuel

Message par thier »

voici la copie des logs
LUA: conso: 0 ; 0
2016-01-18 18:32:00.568 LUA: ########## string.match avec parametres
2016-01-18 18:32:00.568 Error: EventSystem: ...ticz/scripts/lua/script_time_calcul_chauffage_salon5.lua:19: attempt to concatenate global 'energy1' (a nil value)

pour le nom du script c'est bon, script_time_calcul_chauffage_salon5.lua
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
AlexElectro
Messages : 55
Inscription : 18 juil. 2015, 22:13

Re: probleme conso virtuel

Message par AlexElectro »

Tu as bien redémarré ton RPI et domoticz?
Domoticz sur RPi - RfxCom - Sondes oregon DIY - Bus one wire - sondes DS18B20 - BMP085 - Home confort
http://electro.bassignyinformatique.fr/
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: probleme conso virtuel

Message par thier »

j'ai redémarré plusieurs fois sans amélioration.
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: probleme conso virtuel

Message par thier »

je viens de recréer depuis le départ un compteur et voici le log que j'obtiens. ça progresse. je test de nouveau le script de AlexElectro.

1:22:00.418 LUA: conso: 0;0.0
2016-01-18 21:22:00.418 LUA: ########## string.match avec parametres
2016-01-18 21:22:00.418 LUA: energy1=0.0
2016-01-18 21:22:00.418 LUA: npower1=0
2016-01-18 21:22:00.418 LUA: tonumber energy1=0
2016-01-18 21:22:00.419 LUA: tonumber npower1=0
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
thier
Messages : 807
Inscription : 26 sept. 2015, 10:32
Localisation : charente

Re: probleme conso virtuel

Message par thier »

Tout fonctionne...
A force de faire des essais j'ai peut être mis le bazar dans mon compteur.
Merci du coup de main.
PI3+, Buster, Domoticz V2020.2, rflink, zwave, chauffage piloté par qubino, sondes oregon et Vil1d, boite aux lettres détection passage facteur, volets roulants qubino fibaro.
AlexElectro
Messages : 55
Inscription : 18 juil. 2015, 22:13

Re: probleme conso virtuel

Message par AlexElectro »

Super si ça marche!

Bon, on sait pas pourquoi mais c'est pas grave !! :lol:
Domoticz sur RPi - RfxCom - Sondes oregon DIY - Bus one wire - sondes DS18B20 - BMP085 - Home confort
http://electro.bassignyinformatique.fr/
alexbi
Messages : 123
Inscription : 29 nov. 2015, 16:36

Re: probleme conso virtuel

Message par alexbi »

j'ai fais un petit ajout sur mon script avec un compteur TOTAL si ça intéresse quelqu'un je le copie la.

PS : après avoiir créée un nouveau compteur virtuel j'ai du redémarrer Domoticz sinon j'ai eu l'erreur comme tout le monde je pense du bad argument blablabla, mais après redémarrage tout va bien donc pensez y !!!

Code : Tout sélectionner

---------- consommation virtuel radiateurs  -------

-- a editer en script_time_xxxxxxxx.lua


-- radiateur

local radiateurSalon = 'radiateur salon'       -- Nom de l'interrupteur de chauffage
local puissance1 = 1000               -- puissance du chauffage en watt
local conso1 = 'radiateur_salon_conso'            -- nom du capteur virtuel de consommation électrique (type= instant + counter)
local conso_id1 = 130                  -- idx du capteur virtuel de consommation électrique

local radiateurChambre = 'radiateur chambre'       -- Nom de l'interrupteur de chauffage
local puissance2 = 500               -- puissance du chauffage en watt
local conso2 = 'radiateur_chambre_conso'            -- nom du capteur virtuel de consommation électrique (type= instant + counter)
local conso_id2 = 132                  -- idx du capteur virtuel de consommation électrique

local radiateurCuisine = 'radiateur cuisine'       -- Nom de l'interrupteur de chauffage
local puissance3 = 700               -- puissance du chauffage en watt
local conso3 = 'radiateur_cuisine_conso'            -- nom du capteur virtuel de consommation électrique (type= instant + counter)
local conso_id3 = 131                  -- idx du capteur virtuel de consommation électrique

local radiateurSDB = 'radiateur SDB'       -- Nom de l'interrupteur de chauffage
local puissance4 = 1200               -- puissance du chauffage en watt
local conso4 = 'radiateur_SDB'            -- nom du capteur virtuel de consommation électrique (type= instant + counter)
local conso_id4 = 162                  -- idx du capteur virtuel de consommation électrique

local consoTOTAL = 'compteur TOTAL'   -- nom du capteur virtuel de consommation électrique TOTAL (type= instant + counter)
local conso_idTOTAL = 158

commandArray = {}


------- salon --------- 

if (otherdevices[radiateurSalon] == 'On') then
-- envoie de la conso dans le capteur virtuel d'énergie
npower1, energy1 = string.match(otherdevices_svalues[conso1], "(%d+%.*%d*);(%d+%.*%d*)")
energy1 = tonumber(energy1) + (puissance1 / 60)
npower1 = tonumber(npower1)
commandArray[1]={['UpdateDevice'] = conso_id1 .. '|0|' .. puissance1 .. ';' .. energy1}

end

if (otherdevices[radiateurSalon] == 'Off') then 
-- envoie de la conso dans le capteur virtuel d'énergie
npower1, energy1 = string.match(otherdevices_svalues[conso1], "(%d+%.*%d*);(%d+%.*%d*)")
energy1 = tonumber(energy1)
npower1 = tonumber(npower1)
commandArray[2]={['UpdateDevice'] = conso_id1 .. '|0|' .. 0 .. ';' .. energy1}

end  



------- Chambre --------

if (otherdevices[radiateurChambre] == 'On') then
-- envoie de la conso dans le capteur virtuel d'énergie
npower2, energy2 = string.match(otherdevices_svalues[conso2], "(%d+%.*%d*);(%d+%.*%d*)")
energy2 = tonumber(energy2) + (puissance2 / 60)
npower2 = tonumber(npower2)
commandArray[3]={['UpdateDevice'] = conso_id2 .. '|0|' .. puissance2 .. ';' .. energy2}

end

if (otherdevices[radiateurChambre] == 'Off') then 
-- envoie de la conso dans le capteur virtuel d'énergie
npower2, energy2 = string.match(otherdevices_svalues[conso2], "(%d+%.*%d*);(%d+%.*%d*)")
energy2 = tonumber(energy2)
npower2 = tonumber(npower2)
commandArray[4]={['UpdateDevice'] = conso_id2 .. '|0|' .. 0 .. ';' .. energy2}

end  



------- Cuisine --------

if (otherdevices[radiateurCuisine] == 'On') then
-- envoie de la conso dans le capteur virtuel d'énergie
npower3, energy3 = string.match(otherdevices_svalues[conso3], "(%d+%.*%d*);(%d+%.*%d*)")
energy3 = tonumber(energy3) + (puissance3 / 60)
npower3 = tonumber(npower3)
commandArray[5]={['UpdateDevice'] = conso_id3 .. '|0|' .. puissance3 .. ';' .. energy3}

end

if (otherdevices[radiateurCuisine] == 'Off') then 
-- envoie de la conso dans le capteur virtuel d'énergie
npower3, energy3 = string.match(otherdevices_svalues[conso3], "(%d+%.*%d*);(%d+%.*%d*)")
energy3 = tonumber(energy3)
npower3 = tonumber(npower3)
commandArray[6]={['UpdateDevice'] = conso_id3 .. '|0|' .. 0 .. ';' .. energy3}

end  

-------- Salle de Bain -----

if (otherdevices[radiateurSDB] == 'On') then
-- envoie de la conso dans le capteur virtuel d'énergie
npower4, energy4 = string.match(otherdevices_svalues[conso4], "(%d+%.*%d*);(%d+%.*%d*)")
energy4 = tonumber(energy4) + (puissance4 / 60)
npower4 = tonumber(npower4)
commandArray[7]={['UpdateDevice'] = conso_id4 .. '|0|' .. puissance4 .. ';' .. energy4}

end

if (otherdevices[radiateurSDB] == 'Off') then 
-- envoie de la conso dans le capteur virtuel d'énergie
npower4, energy4 = string.match(otherdevices_svalues[conso4], "(%d+%.*%d*);(%d+%.*%d*)")
energy4 = tonumber(energy4)
npower4 = tonumber(npower4)
commandArray[8]={['UpdateDevice'] = conso_id4 .. '|0|' .. 0 .. ';' .. energy4}

end  


------ Conso Wall Plug -------
instant1, total1 = otherdevices_svalues['chauffe eau kWh Meter']:match("([^;]+);([^;]+)")
conso_chauffe_eau_instant = tonumber(instant1)



------ Conso chauffe eau -----
instant2, total2 = otherdevices_svalues['wall plug kWh Meter']:match("([^;]+);([^;]+)")
conso_wall_plug_instant = tonumber(instant2)


------ virtuel conso salon ----
instant3, total3 = otherdevices_svalues[conso1]:match("([^;]+);([^;]+)")
conso_virtuel_salon = tonumber(instant3)

------ virtuel conso chambre ----
instant4, total4 = otherdevices_svalues[conso2]:match("([^;]+);([^;]+)")
conso_virtuel_chambre = tonumber(instant4)


------ virtuel conso cusine ----
instant5, total5 = otherdevices_svalues[conso3]:match("([^;]+);([^;]+)")
conso_virtuel_cusisne = tonumber(instant5)

------ virtuel conso SDB ----
instant6, total6 = otherdevices_svalues[conso4]:match("([^;]+);([^;]+)")
conso_virtuel_SDB = tonumber(instant6)



------ Conso TOTAL -------
npowerTOTAL, energyTOTAL = string.match(otherdevices_svalues[consoTOTAL], "(%d+%.*%d*);(%d+%.*%d*)")
conso_instant_TOTAL = (conso_virtuel_SDB + conso_virtuel_salon + conso_virtuel_cusisne + conso_virtuel_chambre + conso_chauffe_eau_instant + conso_wall_plug_instant)
energyTOTAL = tonumber(energyTOTAL) + (conso_instant_TOTAL / 60)
npowerTOTAL = tonumber(npowerTOTAL)
commandArray[9]={['UpdateDevice'] = conso_idTOTAL .. '|0|' .. conso_instant_TOTAL .. ';' .. energyTOTAL}


return commandArray
Répondre