Hier j'ai reçu mes 10 Power Plug (NAS-WR01ZE) de chez neo coolcam.
Tout fonctionne à merveille, inclusion, listing dans le dispositif, etc...
Mais après quelques minutes, je m'aperçois que le compteur kWh est en négatif... pour tous les 10 plugs.
Après investigation,
le plug envoie une valeur
Code : Tout sélectionner
nil (DzVents)Il faut donc rectifier cette valeur par un script DzVentz.
Voici mon script modifié et qui fonctionne, le script original ne faisait pas le check du nil.
source: https://www.domoticz.com/forum/viewtopic.php?t=28987 by akamming
Code : Tout sélectionner
return {
on = {
devices = {
"Spa kWh Meter" -- add your to be corrected neo coolcam kwh meter here
}
},
logging = {
level = domoticz.LOG_DEBUG,
marker = "NEO Coolcam kWh Fix"
},
data = {
["Spa kWh Meter"] = { history = true, maxItems = 10 } -- add your to be corrected neo coolcam kwh meter here
},
execute = function(domoticz,device)
domoticz.log("device["..device.name.."] was changed to ["..device.state.."]",domoticz.LOG_DEBUG);
domoticz.log("total is "..device.WhTotal..", usage="..device.usage,domoticz.LOG_DEBUG)
if (device.WhTotal>0) then
domoticz.log("adding to history",domoticz.LOG_DEBUG)
domoticz.data[device.name].add(device.WhTotal)
else
local CorrectedWhTotal=0
if (domoticz.data[device.name].max()) then
CorrectedWhTotal=domoticz.data[device.name].max()
end
device.updateElectricity(device.usage,CorrectedWhTotal).silent()
domoticz.log("Negative number, correcting WhTotal from "..device.WhTotal.." to "..CorrectedWhTotal,domoticz.LOG_DEBUG)
end
end
}En SSH:
Code : Tout sélectionner
sqlite3 domoticz.db
DELETE FROM Meter WHERE value < 0;

APRES
