Aller au contenu

flacon030

Membres confirmés
  • Compteur de contenus

    1 318
  • Inscription

  • Dernière visite

  • Jours gagnés

    30

Messages posté(e)s par flacon030

  1. Je me suis inspirer du créateur du qa qui a réaliser plusieurs fichiers et j'en ai créer un "multilevelsensor" dans le quel j'ai mis le code ci dessous en m'inspirant de ceux qu'il avait créer pour "PowerSensor" et "Meter"

    Mais sans être sur de se que je fait

     

    class 'multilevelsensor' (QuickAppChild)
    
    function multilevelsensor:__init(device)
        QuickAppChild.__init(self, device)
        self:updateProperty("unit", "%")
    end
    
    function multilevelsensor:setValue(value)
        self:updateProperty("value", tonumber(value))
    end

     

    class 'Meter' (QuickAppChild)
    
    function Meter:__init(device)
        QuickAppChild.__init(self, device)
        self:updateProperty("unit", "kWh")
    end
    
    function Meter:setValue(value)
        -- print("updating", self.id, "value: ", value)
        self:updateProperty("value", tonumber(value))
    end

     

    class 'PowerSensor' (QuickAppChild)
    
    function PowerSensor:__init(device)
        QuickAppChild.__init(self, device)
        self:updateProperty("unit", "W")
    end
    
    function PowerSensor:setValue(value)
        self:updateProperty("value", tonumber(value))
    end

     

  2. Bon après pas mal d'essai j'arrive a créer mon child mais j'ai un message d'erreur

    Mais cela ne semble pas empêcher le QA de fonctionner

     

    [15.03.2025] [13:43:43] [DEBUG] [QUICKAPP598]: onInit
    [15.03.2025] [13:43:43] [WARNING] [QUICKAPP598]: Class for the child device: 1098, with type: com.fibaro.multilevelSensor not found. Using base class: QuickAppChild

     

    function QuickApp:createChildDevices()
        self:initChildDevices({
            ["com.fibaro.electricMeter"] = Meter,
            ["com.fibaro.energyMeter"] = Meter,
            ["com.fibaro.powerMeter"] = PowerSensor,
            ["com.fibaro.multilevelsensor"] = multilevelsensor, --ajout ligne
        })
        
        -- data from: /solar_api/v1/GetMeterRealtimeData.cgi?Scope=System endpoint
        self.childs.totalEnergyConsumedChild = self:initChildDevice("totalEnergyConsumedChild", "Total energy consumed", "com.fibaro.energyMeter", Meter)
        self.childs.totalEnergyConsumedChild:updateProperty("rateType", "consumption")
    
        -- data from: /solar_api/v1/GetPowerFlowRealtimeData.fcgi endpoint
        -- total energy produced (kWh)
        self.childs.totalEnergyChild = self:initChildDevice("totalEnergyChild", "Index total PV", "com.fibaro.energyMeter", Meter)
        self.childs.totalEnergyChild:updateProperty("rateType", "production")
    
        -- current production (W)
        self.childs.currentPowerChild = self:initChildDevice("currentPowerChild", "Production", "com.fibaro.powerMeter", PowerSensor)
        self.childs.currentPowerChild:updateProperty("rateType", "production")
    
        -- Current Akku power (w)-- ajoute Akku
        self.childs.currentAkkuChild = self:initChildDevice("currentAkkuChild", "Akku", "com.fibaro.powerMeter", PowerSensor)
        self.childs.currentAkkuChild:updateProperty("rateType", "production")   
        
        -- Current Load power (w)-- ajoute Load
        self.childs.currentLoadChild = self:initChildDevice("currentLoadChild", "Load", "com.fibaro.powerMeter", PowerSensor)
    
        -- current grid power (W)
        -- from docs: value is null if no meter is enabled ( + from grid , - to grid ) 
        self.childs.currentGridChild = self:initChildDevice("currentGridChild", "Grid", "com.fibaro.powerMeter", PowerSensor)
    
        -- Current rel_Autonomie (%)-- ajout ligne
     	 self.childs.rel_AutonomyChild = self:initChildDevice("rel_AutonomyChild", "Autonomie", "com.fibaro.multilevelSensor", multilevelsensor)
        self.childs.rel_AutonomyChild:updateProperty("unit", "%")
    
    end

     

    function QuickApp:parseGeneralData(data)
        local fronius = json.decode(data)
        self:trace(data)
    
        self.P_Grid = fronius.Body.Data.Site.P_Grid or 0
        self.P_Load = fronius.Body.Data.Site.P_Load or 0
        self.P_Akku = fronius.Body.Data.Site.P_Akku or 0
        self.P_PV = fronius.Body.Data.Site.P_PV or 0 
        self.E_Total = fronius.Body.Data.Site.E_Total or 0
        self:updateView("mode", "text", "Mode: " .. fronius.Body.Data.Site.Mode)
        self:updateView("Meter_Location", "text", "Meter Location: " .. fronius.Body.Data.Site.Meter_Location) -- ligne en plus
        self.rel_Autonomy = fronius.Body.Data.Site.rel_Autonomy or 0                   -- ligne en plus
        self.rel_SelfConsumption = fronius.Body.Data.Site.rel_SelfConsumption or 0     -- ligne en plus
        self.SOC = fronius.Body.Data.Inverters["1"].SOC or 0                           -- ligne en plus
    
        -- -----P grid -----
        if self.P_Grid ~= json.null() then
            self:setChildVisibility("currentGridChild", true)
            self.childs.currentGridChild:updateProperty("log", "")
    
            local gridValue = string.format("%.0f", self.P_Grid)
            self:updateView("grid", "text", "Linky: - Injection / + Conso: " .. gridValue .. " W")
            self.childs.currentGridChild:setValue(gridValue)
    
            if self.P_Grid < 0 then
                self.childs.currentGridChild:updateProperty("log", "Injection linky")
            else
                self.childs.currentGridChild:updateProperty("log", "Conso linky")
            end
        else
            self.childs.currentGridChild:updateProperty("log", "Meter not connected")
            self:setChildVisibility("currentGridChild", false)                           -- hiding unused device
        end
    
        -- -----P_load--------- ajoute child P_load
        if self.P_Load ~= json.null() then
            self:updateView("load", "text", "Conso maison: " .. string.format("%.3f", self.P_Load * -1) .. " W")                                
            self.childs.currentLoadChild:updateProperty("value", self.P_Load * -1)
        end
    
        -- -----P_Akku------- -- ajouté child Akku
       if self.P_Akku ~= json.null() then 
           self:updateView("akku", "text", "Batterie: - Charge / + Decharge: " .. string.format("%.3f", self.P_Akku) .. " W")
           self.childs.currentAkkuChild:updateProperty("value", self.P_Akku)                                                                
       end
    
        -- -----P_PV------
        if self.P_PV ~= json.null() then
            self:updateView("current", "text", "Fronius PV: " .. string.format("%.3f",self.P_PV) .. " W")
            self.childs.currentPowerChild:updateProperty("value", self.P_PV)
        end
    
        -- ----E_Total Index total---- 
        self:updateView("total", "text", "Index Total: " .. string.format("%.3f",self.E_Total / 1000) .. " kWh")
        self.childs.totalEnergyChild:setValue((self.E_Total) / 1000)
    
        -- -----rel_SelfConsumption--------- ajouté rel_SelfConsumption
       if self.rel_SelfConsumption ~= json.null() then 
           self:updateView("rel_SelfConsumption", "text", "Autoconsommation: " .. string.format("%.3f", self.rel_SelfConsumption) .. " %")
       end
    
        -- -----SOC--------- ajouté SOC
       if self.SOC ~= json.null() then 
           self:updateView("SOC", "text", "SOC: " .. string.format("%.3f", self.SOC) .. " %")                                          
       end 
    
           -- -----rel_Autonomy------- -- ajouté rel_Autonomy
       if self.rel_Autonomy ~= json.null() then 
           self:updateView("rel_Autonomy", "text", "Autonomie: " .. string.format("%.3f", self.rel_Autonomy) .. " %")
           self.childs.rel_AutonomyChild:updateProperty("value", self.rel_Autonomy)
       end
    
    end

     

  3. oui je regarde pour un "multilevelsensor" car les autres child sont soit des "powermeter" soit des "energymeter"

    Le SOC je le gère dans grafana mais c'est vrai que dans domocharts il ne peut y être pour le moment

  4. c'est bon je viens de trouver

    c'était cela le bon code

     self.SOC = fronius.Body.Data.Inverters["1"].SOC or 0

     

    A présent il faut que j'arrive a créer les child pour l'autonomie, l'autoconsommation, et le SOC

    Toutes les autres données du QA on leur childs sauf ces trois la ou je bloque encore

    QA fronius.png

    qa fronius2.png

  5. Merci pour ton aide, mais avec ta suggestion les valeurs ne remontent plus et j'ai ce code erreur dans le debug

    [15.03.2025] [10:26:01] [DEBUG] [QUICKAPP598]: onInit
    [15.03.2025] [10:26:01] [ERROR] [QUICKAPP598]: QuickApp crashed
    [15.03.2025] [10:26:01] [ERROR] [QUICKAPP598]: main.lua:183: attempt to index a nil value (field '?')

     

  6. bonjour je tente toujours de récupérer le SOC de mon onduleur pour ce QA

    Le problème de se que je voie c'est que le .1 (le point est en orange dans le code LUA au lieu d'être en blanc comme tous les autres point?)

    comment définir le bon chemin?

    donc peut être un problème de chemin pour interroger le SOC

    self.SOC = fronius.Body.Data.Inverters.1.SOC or 0

     

    json fronius.png

    lua.png

  7. Suite a la mise a jour du firmware de l'onduleur en version 1.35.8-1 le QA fonctionne a nouveau

     

    Bugfixes
    / Log data upload stabilization - Devices sporadically interrupted the archive data upload

     

    Data	
    Inverters	
    1	
    Battery_Mode	"normal"
    DT	1
    E_Day	null
    E_Total	2238280.7016666667
    E_Year	null
    P	929.51788330078125JS:929.5178833007812
    SOC	68.299999999999997JS:68.3
    SecondaryMeters	{}
    Site	
    BackupMode	false
    BatteryStandby	true
    E_Day	null
    E_Total	2238280.7016666667
    E_Year	null
    Meter_Location	"grid"
    Mode	"bidirectional"
    P_Akku	416.56591796875
    P_Grid	5.1399999999999997JS:5.14
    P_Load	-934.65788330078124JS:-934.6578833007812
    P_PV	577.331298828125
    rel_Autonomy	99.450066158769474JS:99.45006615876947
    rel_SelfConsumption	100.0JS:100
    Smartloads	
    OhmpilotEcos	{}
    Ohmpilots	
    0	
    P_AC_Total	0.0JS:0
    State	"normal"
    Temperature	0.0JS:0
    Version	"13"
    Head	
    RequestArguments	{}
    Status	
    Code	0
    Reason	""
    UserMessage	""
    Timestamp	"2025-03-11T13:17:57+00:00"

     

  8. bon je suis bien ennuyé avec mon QA fronius qui ne fonctionne plus

    j'ai trouvé l'api qui permet d’interrogé mon onduleur

    http://192.168.1.88/solar_api/v1/GetPowerFlowRealtimeData.fcgi

    Les infos remontent bien

    Mais je constate que l'API a un peut changer

    cela peut être la cause pour la quel le QA ne fonctionne plus?

    Si oui comment remédier au problème dans le QA?

     

    Nouvelle API

    Body	
    Data	
    Inverters	
    1	
    Battery_Mode	"normal"
    DT	1
    E_Day	null
    E_Total	1972078.7094444444
    E_Year	null
    P	837.0224609375
    SOC	68.1
    SecondaryMeters	{}
    Site	
    BackupMode	false
    BatteryStandby	true
    E_Day	null
    E_Total	1972078.7094444444
    E_Year	null
    Meter_Location	"grid"
    Mode	"bidirectional"
    P_Akku	-2989.701171875
    P_Grid	4
    P_Load	-841.0224609375
    P_PV	3911.1015625
    rel_Autonomy	99.52438844551891
    rel_SelfConsumption	100
    Smartloads	
    OhmpilotEcos	{}
    Ohmpilots	
    0	
    P_AC_Total	276
    State	"normal"
    Temperature	0
    Version	"13"
    Head	
    RequestArguments	{}
    Status	
    Code	0
    Reason	""
    UserMessage	""
    Timestamp	"2025-02-26T10:49:21+00:00"

     

    json.png

     

    Ancienne API

    Body	
    Data	
    Inverters	
    1	
    Battery_Mode	"normal"
    DT	99
    E_Day	3682
    E_Total	3896556
    E_Year	1760809.25
    P	699
    SOC	48.79999923706055
    Site	
    BatteryStandby	false
    E_Day	3682
    E_Total	3896556
    E_Year	1760809.2000000002
    Meter_Location	"grid"
    Mode	"bidirectional"
    P_Akku	76.86
    P_Grid	10.7
    P_Load	-709.7
    P_PV	670
    rel_Autonomy	98.49232069888684
    rel_SelfConsumption	100
    Version	"12"
    Head	
    RequestArguments	{}
    Status	
    Code	0
    Reason	""
    UserMessage	""
    Timestamp	"2023-05-13T12:04:39+02:00"

     

    après la valeur SOC

    SecondaryMeters	{}

    il a en plus cette variable

     

    En regardant le QA je suis tombé sur ces parametres

    -- data sets for testign purpose
    
    -- can be used in parseGeneralData method
    mockData = [[
        {
       "Body" : {
          "Data" : {
             "Inverters" : {
                "1" : {
                   "DT" : 126,
                   "E_Day" : 2607.300048828125,
                   "E_Total" : 895714,
                   "E_Year" : 895714.5,
                   "P" : 930
                }
             },
             "Site" : {
                "E_Day" : 2607.300048828125,
                "E_Total" : 895714,
                "E_Year" : 895714.5,
                "Meter_Location" : "grid",
                "Mode" : "meter",
                "P_Akku" : null,
                "P_Grid" : -612.5,
                "P_Load" : -317.5,
                "P_PV" : 930,
                "rel_Autonomy" : 100,
                "rel_SelfConsumption" : 34.13978494623656
             },
             "Version" : "12"
          }
       },
       "Head" : {
          "RequestArguments" : {},
          "Status" : {
             "Code" : 0,
             "Reason" : "",
             "UserMessage" : ""
          },
          "Timestamp" : "2021-06-24T10:32:49+02:00"
       }
    }
    ]]
    
    -- can be used in parseMeterData method
    mockMeterData = [[
    {
       "Body" : {
          "Data" : {
             "0" : {
                "Current_AC_Phase_1" : -0.85599999999999998,
                "Current_AC_Phase_2" : -1.306,
                "Current_AC_Phase_3" : -1.0880000000000001,
                "Current_AC_Sum" : -3.25,
                "Details" : {
                   "Manufacturer" : "Fronius",
                   "Model" : "Smart Meter TS 65A-3",
                   "Serial" : "4028826078"
                },
                "Enable" : 1,
                "EnergyReactive_VArAC_Sum_Consumed" : 43664,
                "EnergyReactive_VArAC_Sum_Produced" : 246988,
                "EnergyReal_WAC_Minus_Absolute" : 640054,
                "EnergyReal_WAC_Plus_Absolute" : 254214,
                "EnergyReal_WAC_Sum_Consumed" : 254214,
                "EnergyReal_WAC_Sum_Produced" : 640054,
                "Frequency_Phase_Average" : 50,
                "Meter_Location_Current" : 0,
                "PowerApparent_S_Phase_1" : 96.700000000000003,
                "PowerApparent_S_Phase_2" : 287,
                "PowerApparent_S_Phase_3" : 232.69999999999999,
                "PowerApparent_S_Sum" : 616.5,
                "PowerFactor_Phase_1" : 0.96699999999999997,
                "PowerFactor_Phase_2" : -0.97299999999999998,
                "PowerFactor_Phase_3" : -0.95699999999999996,
                "PowerFactor_Sum" : -0.98399999999999999,
                "PowerReactive_Q_Phase_1" : 24.699999999999999,
                "PowerReactive_Q_Phase_2" : -65.700000000000003,
                "PowerReactive_Q_Phase_3" : -67.200000000000003,
                "PowerReactive_Q_Sum" : -108.2,
                "PowerReal_P_Phase_1" : -93.5,
                "PowerReal_P_Phase_2" : -279.39999999999998,
                "PowerReal_P_Phase_3" : -222.69999999999999,
                "PowerReal_P_Sum" : -595.70000000000005,
                "TimeStamp" : 1624523524,
                "Visible" : 1,
                "Voltage_AC_PhaseToPhase_12" : 389.10000000000002,
                "Voltage_AC_PhaseToPhase_23" : 382.10000000000002,
                "Voltage_AC_PhaseToPhase_31" : 388.60000000000002,
                "Voltage_AC_Phase_1" : 223.90000000000001,
                "Voltage_AC_Phase_2" : 223.19999999999999,
                "Voltage_AC_Phase_3" : 222.59999999999999
             }
          }
       },
       "Head" : {
          "RequestArguments" : {
             "DeviceClass" : "Meter",
             "Scope" : "System"
          },
          "Status" : {
             "Code" : 0,
             "Reason" : "",
             "UserMessage" : ""
          },
          "Timestamp" : "2021-06-24T10:32:05+02:00"
       }
    }
    ]]

    Je me demande si ce n'est pas ici qu'il faut que je modifie le code pour qu'il soit comme le json de mon onduleur

  9. petite mise a jour de mon grafana

    je viens enfin de réussir a mettre en place un graph journalier et mensuelle pour certaines de mes valeur

    celui de la pluie m'a donné un peut de mal

    si non j'ai mis en place des graph pour mes productions / consommations, conso d'eau chaude / froide, et donc la pluie

     

    grafana pluie.png

    grafana conso mensuel.png

    grafana pluie conso eaux.png

    • Like 3
  10. bonjour

    Pour ceux qui manipule grafana

    J'ai réussi a faire une vue de mes consommation journalière

    avec le "group by" time(1d)

    je voudrais faire le même graphique en mensuel

    par quoi il faut remplacer time (1d) ? si c'est bien la que je peut faire quelques chose

    time (1m) ne fonctionne pas car c'est a la minute

    Merci

     

    grafana conso mensuel.png

  11. Bonjour a tous

     

    Depuis la mise a jour du firmware 1.35.4-1 de mon onduleur GEN24 je n'arrive plus a communiqué avec ce dernier

    Je suis le seul dans cette situation?

    il semble toute fois bien connecté a ce dernier

    [20.02.2025] [23:35:20] [DEBUG] [QUICKAPP598]: onInit

     

  12. Bonjour

    cela fait longtemps que je n'avais pas eu de probleme avec domochart

    j'ai ce message d'erreur

    [13.02.2025] [00:27:33] [DEBUG] [QA_DOMOCHARTS_54]: Using tools library v2.20
    [13.02.2025] [00:27:33] [DEBUG] [QA_DOMOCHARTS_54]: Using DomoCharts library v7.10
    [13.02.2025] [00:27:33] [DEBUG] [QA_DOMOCHARTS_54]: DomoCharts library successfully initialized
    [13.02.2025] [00:27:33] [DEBUG] [QA_DOMOCHARTS_54]: Refresh interval : 60 seconds
    [13.02.2025] [00:27:33] [DEBUG] [QA_DOMOCHARTS_54]: NAS URL : http://192.168.1.8:80/domocharts 
    [13.02.2025] [00:27:33] [DEBUG] [QA_DOMOCHARTS_54]: Maximum memory : 10000 measures
    [13.02.2025] [00:27:33] [DEBUG] [QA_DOMOCHARTS_54]: Battery query time : 23:00
    [13.02.2025] [00:27:33] [DEBUG] [QA_DOMOCHARTS_54]: Time is 00:27:33, first loop at 00:28:00 in 27 seconds...
    [13.02.2025] [00:28:02] [ERROR] [QA_DOMOCHARTS_54]: http://192.168.1.8:80/domocharts/data.php => Error #HY000 => SQLSTATE[HY000]: General error: 130 Incorrect file format 'domocharts_temperature'
    [13.02.2025] [00:28:02] [WARNING] [QA_DOMOCHARTS_54]: Memorize 192 sensors data

    et j'ai cela dans mysql qui ne me semble pas correct

     

     

    sql.png

×
×
  • Créer...