dzVents/runtime/EventHelpers.lua:108: attempt to index a boolean value

Forum dédié aux questions concernant la configuration de votre serveur sous Linux
Doudy
Messages : 457
Inscription : 07 mai 2016, 17:23

Re: dzVents/runtime/EventHelpers.lua:108: attempt to index a boolean value

Message par Doudy »

Merci Keros pour les infos. :)
Keros a écrit : 23 oct. 2021, 13:38 @Doudy, boum parle d'un fichier qui se trouverait dans le dossier dzvents/data/ et qui contiendrait le nom de ton script.
Voici mon fichier /dzvents/data/
Capture.PNG
Capture.PNG (11.71 Kio) Consulté 1282 fois
J'ai remis le script en place.
Voici maintenant le fichier "__data_darksky_probabilite_pluie.lua" qu'il me sort :

Code : Tout sélectionner

-- Persistent Data
local multiRefObjects = {

} -- multiRefObjects
local obj1 = {
        ["rainForecast"] = {
                ["hourly"] = {
                        ["summary"] = "Clear throughout the day.";
                        ["data"] = {
                                [1] = {
                                        ["icon"] = "clear-day";
                                        ["precipProbability"] = 0;
                                        ["windGust"] = 14.24;
                                        ["precipIntensity"] = 0;
                                        ["temperature"] = 13.84;
                                        ["pressure"] = 1027.5;
                                        ["windSpeed"] = 10.97;
                                        ["summary"] = "Clear";
                                        ["time"] = 1634990400;
                                        ["cloudCover"] = 0.28;
                                        ["humidity"] = 0.71;
                                        ["apparentTemperature"] = 13.84;
                                        ["ozone"] = 270.3;
                                        ["uvIndex"] = 2;
                                        ["visibility"] = 16.093;
                                        ["dewPoint"] = 8.73;
                                        ["windBearing"] = 213;
                                };
                                [2] = {
                                        ["icon"] = "partly-cloudy-day";
                                        ["precipProbability"] = 0;
                                        ["windGust"] = 14.19;
                                        ["precipIntensity"] = 0;
                                        ["temperature"] = 14.62;
                                        ["pressure"] = 1027.1;
                                        ["windSpeed"] = 10.98;
                                        ["summary"] = "Partly Cloudy";
                                        ["time"] = 1634994000;
                                        ["cloudCover"] = 0.33;
                                        ["humidity"] = 0.66;
                                        ["apparentTemperature"] = 14.62;
                                        ["ozone"] = 270.3;
                                        ["uvIndex"] = 2;
                                        ["visibility"] = 16.093;
                                        ["dewPoint"] = 8.41;
                                        ["windBearing"] = 214;
                                };
                                [3] = {
                                        ["icon"] = "partly-cloudy-day";
                                        ["precipProbability"] = 0;
                                        ["windGust"] = 13.51;
                                        ["precipIntensity"] = 0;
                                        ["temperature"] = 14.88;
                                        ["pressure"] = 1026.9;
                                        ["windSpeed"] = 10.55;
                                        ["summary"] = "Partly Cloudy";
                                        ["time"] = 1634997600;
                                        ["cloudCover"] = 0.32;
                                        ["humidity"] = 0.64;
                                        ["apparentTemperature"] = 14.88;
                                        ["ozone"] = 269.5;
                                        ["uvIndex"] = 1;
                                        ["visibility"] = 16.093;
                                        ["dewPoint"] = 8.09;
                                        ["windBearing"] = 212;
                                };
                                [4] = {
                                        ["icon"] = "partly-cloudy-day";
                                        ["precipProbability"] = 0.02;
                                        ["windGust"] = 14.34;
                                        ["precipIntensity"] = 0.0056;
                                        ["temperature"] = 14.42;
                                        ["pressure"] = 1026.7;
                                        ["windSpeed"] = 10.13;
                                        ["precipType"] = "rain";
                                        ["summary"] = "Partly Cloudy";
                                        ["time"] = 1635001200;
                                        ["cloudCover"] = 0.37;
                                        ["humidity"] = 0.66;
                                        ["apparentTemperature"] = 14.42;
                                        ["ozone"] = 269.2;
                                        ["uvIndex"] = 0;
                                        ["visibility"] = 16.093;
                                        ["dewPoint"] = 8.09;
                                        ["windBearing"] = 201;
                                };
                                [5] = {
                                        ["icon"] = "clear-day";
                                        ["precipProbability"] = 0;
                                        ["windGust"] = 15.56;
                                        ["precipIntensity"] = 0;
                                        ["temperature"] = 12.85;
                                        ["pressure"] = 1026.6;
                                        ["windSpeed"] = 10.01;
                                        ["summary"] = "Clear";
                                        ["time"] = 1635004800;
                                        ["cloudCover"] = 0.25;
                                        ["humidity"] = 0.71;
                                        ["apparentTemperature"] = 12.85;
                                        ["ozone"] = 267.5;
                                        ["uvIndex"] = 0;
                                        ["visibility"] = 16.093;
                                        ["dewPoint"] = 7.63;
                                        ["windBearing"] = 186;
                                };
                                [6] = {
                                        ["icon"] = "clear-night";
                                        ["precipProbability"] = 0;
                                        ["windGust"] = 16.07;
                                        ["precipIntensity"] = 0;
                                        ["temperature"] = 10.55;
                                        ["pressure"] = 1026.2;
                                        ["windSpeed"] = 9.76;
                                        ["summary"] = "Clear";
                                        ["time"] = 1635008400;
                                        ["cloudCover"] = 0.26;
                                        ["humidity"] = 0.77;
                                        ["apparentTemperature"] = 10.55;
                                        ["ozone"] = 265.8;
                                        ["uvIndex"] = 0;
                                        ["visibility"] = 16.093;
                                        ["dewPoint"] = 6.77;
                                        ["windBearing"] = 174;
                                };
                                [7] = {
                                        ["icon"] = "clear-night";
                                        ["precipProbability"] = 0;
                                        ["windGust"] = 13.17;
                                        ["precipIntensity"] = 0;
                                        ["temperature"] = 9.48;
                                        ["pressure"] = 1026.6;
etc...
etc...
très long fichier...

Plus de message d'erreur.
Mais il me semble que ce fichier n'existait pas/plus quand les erreurs ont commencées ! :(

Voilà tout semble en ordre.
Merci pour votre aide.
;)
RaspberryPi - RFLink - Zwave - WH2600
Domoticz : 2020.2 | Dashticz : V3.12 Master | dzvents : 3.0.2 | Python : 3.7.3
Keros
Messages : 6638
Inscription : 23 juil. 2019, 20:57

Re: dzVents/runtime/EventHelpers.lua:108: attempt to index a boolean value

Message par Keros »

C'est bien des persistants data :oops: Bien vu boum

Mais pourquoi y en a-t-il ? Je ne vois pas la création / utilisation dans le script :roll:
Comment bien utiliser le forum : Poser une question, Mettre un script, un fichier, une image ou des logs
Mes petits guides : Débuter en programmation, Le débogage, Le choix de matériel, Les sauvegardes
Ma présentation - Mes Tutos
boum
Messages : 233
Inscription : 18 janv. 2019, 11:34
Localisation : France

Re: dzVents/runtime/EventHelpers.lua:108: attempt to index a boolean value

Message par boum »

C'est utilisé là :

Code : Tout sélectionner

            if #item.data > 0 then
                domoticz.data.rainForecast    = domoticz.utils.fromJSON(item.data)
                rt = domoticz.utils.fromJSON(item.data)
            else
                domoticz.log("Problem with response from DarkSky (no data) using data from earlier run",domoticz.LOG_ERROR)
                rt  = domoticz.data.rainForecast                        -- json empty. Get last valid from domoticz.data
                if #rt < 1 then                                         -- No valid data in domoticz.data either
                    domoticz.log("No previous data. are DarkSkyAPIkey and geolocalisation ok?",domoticz.LOG_ERROR)
                    return false
                end
            end    
Domoticz v2022.2 sur linux-mint / Z-Wave-JS / RFXCom / Zigbee2MQTT
Keros
Messages : 6638
Inscription : 23 juil. 2019, 20:57

Re: dzVents/runtime/EventHelpers.lua:108: attempt to index a boolean value

Message par Keros »

Ah ok, j'ai compris. Merci boum

Je me disais que le fichier data ressemblait à un Json : en fait, c'est le Json qui est sauvegardé et utilisé la fois suivante s'il y a une erreur pour récupérer les données.

Je vais m'en inspirer pour éviter les quelques erreurs que j'ai lorsque le Json ne peut pas être récupéré.


Je viens de voir que j'étais complètement passer à coté de :

Code : Tout sélectionner

 data    =   {   rainForecast     = {initial = {} },             -- Keep a copy of last json just in case
J'ai l'habitude de rien avoir derrière Logging que je n’ai pas vu la déclaration des persistant data. Désolé :oops:
Comment bien utiliser le forum : Poser une question, Mettre un script, un fichier, une image ou des logs
Mes petits guides : Débuter en programmation, Le débogage, Le choix de matériel, Les sauvegardes
Ma présentation - Mes Tutos
Répondre