Initialize a variable?  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Steef
Posts: 14
Joined: Monday 07 January 2019 6:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Initialize a variable?

Post by Steef »

Hello all,

I am using a script to receive weather data from Buienradar (dutch) and Darksky, which worked perfectly for a time, but since a couple of weeks, I receive the following error:

2019-04-25 13:52:00.462 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:96: attempt to index local 'fileStorage' (a boolean value)

This refers to the following DzVents script https://github.com/domoticz/domoticz/bl ... lpers.lua
In a comment near line 96, it says -- obviously this is a var that was added later
-- initialize it

But I literally have no clue what is meant with this comment. Is there anyone who have experienced the same problem, or knows what needs to be changed?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Initialize a variable?

Post by waaren »

Steef wrote: Thursday 25 April 2019 13:57 I am using a script to receive weather data from Buienradar (dutch) and Darksky, which worked perfectly for a time, but since a couple of weeks, I receive the following error:

2019-04-25 13:52:00.462 Error: EventSystem: in /home/pi/domoticz/dzVents/runtime/dzVents.lua: /home/pi/domoticz/dzVents/runtime/EventHelpers.lua:96: attempt to index local 'fileStorage' (a boolean value)
Hi @Steef,

if you could share your script I might be able to help.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Steef
Posts: 14
Joined: Monday 07 January 2019 6:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Initialize a variable?

Post by Steef »

Thank you for your reply!

The dzvents.lua script is displayed below (or do you need an other script?), which is also mentioned in the error.

My Domoticz is installed on a Raspberry 3b, with version V4.10619, and plenty of HDD and RAM space left :)

Code: Select all

local TESTMODE = false
globalvariables['testmode'] = false
--globalvariables['dzVents_log_level'] = 4 --debug

if (_G.TESTMODE) then
	TESTMODE = false
	globalvariables['testmode'] = false
end

local scriptPath = globalvariables['script_path'] -- should be ${szUserDataFolder}/scripts/dzVents/
local runtimePath = globalvariables['runtime_path'] -- should be ${szStartupFolder}/dzVents/runtime/

_G.scriptsFolderPath = scriptPath .. 'scripts' -- global
_G.generatedScriptsFolderPath = scriptPath .. 'generated_scripts' -- global
_G.dataFolderPath = scriptPath .. 'data' -- global

package.path = package.path .. ';' .. scriptPath .. '?.lua'
package.path = package.path .. ';' .. runtimePath .. '?.lua'
package.path = package.path .. ';' .. runtimePath .. 'device-adapters/?.lua'
package.path = package.path .. ';' .. scriptPath .. 'dzVents/?.lua'
package.path = package.path .. ';' .. scriptPath .. 'scripts/?.lua'
package.path = package.path .. ';' .. scriptPath .. '../lua/?.lua'
package.path = package.path .. ';' .. scriptPath .. 'scripts/modules/?.lua'
package.path = package.path .. ';' .. scriptPath .. '?.lua'
package.path = package.path .. ';' .. scriptPath .. 'generated_scripts/?.lua'
package.path = package.path .. ';' .. scriptPath .. 'data/?.lua'
package.path = package.path .. ';' .. scriptPath .. 'modules/?.lua'

local EventHelpers = require('EventHelpers')
local helpers = EventHelpers()
local utils = require('Utils')

if (tonumber(globalvariables['dzVents_log_level']) == utils.LOG_DEBUG or TESTMODE) then
	print('Debug: Dumping domoticz data to ' .. scriptPath .. 'domoticzData.lua')
	local persistence = require('persistence')
	persistence.store(scriptPath .. 'domoticzData.lua', domoticzData)

	local events, length = helpers.getEventSummary()
	if (length > 0) then
		print('Debug: dzVents version: '.. globalvariables.dzVents_version)

		print('Debug: Event triggers:')
		for i, event in pairs(events) do
			print('Debug: ' .. event)
		end
	end

	if (globalvariables['isTimeEvent']) then
		print('Debug: Event triggers:')
		print('Debug: - Timer')
	end
end

commandArray = {}

local isTimeEvent = globalvariables['isTimeEvent']

if (isTimeEvent) then
	commandArray = helpers.dispatchTimerEventsToScripts()
end

helpers.dispatchDeviceEventsToScripts()
helpers.dispatchVariableEventsToScripts()
helpers.dispatchSecurityEventsToScripts()
helpers.dispatchSceneGroupEventsToScripts()
helpers.dispatchHTTPResponseEventsToScripts()
commandArray = helpers.domoticz.commandArray

return commandArray
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Initialize a variable?

Post by waaren »

Steef wrote: Friday 26 April 2019 9:20 The dzvents.lua script is displayed below (or do you need an other script?), which is also mentioned in the error.
Hi @Steef,

This dzvents.lua script you shared is a standard part of dzVents and is the same for all dzVents users. What I need to investigate your issue is the user script that you saved using the event editor or stored in /home/pi/domoticz/scripts/dzVents/scripts.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Steef
Posts: 14
Joined: Monday 07 January 2019 6:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Initialize a variable?

Post by Steef »

Hello Waaren,

My apologies, and thanks for the explanation. I really have no clue what the error can be :)

In the 'scripts' folder, I have the "Update Weather Sensors.lua" script (I think it will look familiar to you :))

I cannot upload it here, because my post will contain too much characters, but it is the standard .lua script, from your latest update.

The only changes I made are in the "wusSettings.lua", which I copied here below :) The names are different, but they match with Domoticz, and the IDX numbers.

Code: Select all

--[[    use in conjunction with updateWeatherSensors.lua Version 0.20180512
        this settings file must be saved as/at "domoticz dir"/scripts/dzVents/scripts/modules/wusSettings.lua

       Name of Weatherstation is no longer required as the script is able to get the nearest weatherstation based on the location entered in domoticz, 
       but when used use the weatherstation name and not the city/location  as this is not unique
       All valid weatherstation names are listed in the main file
       
First rows are your weather devices as defined in domoticz identified by their device number

(Note: You only have to define the sensors / switches you want to use and can comment the other ones by typing 
-- in front of the line )

If you already defined devices for previous versions of this script and you don't need them any longer
you can also comment them with the two -- in front an delete them in domoticz
        
 ]]-- 

settings =
{
        -- Start devices                                                        
        Luchtdruk                 = 36;                         -- your weather devices in domoticz
        Wind, temperatuur en gevoelstemperatuur                      = 37;                         -- can only be entered as numbers (your device ID's)
        Wind                  = 38;                         -- if you choose to separate windchill temperature device from wind
        Zicht                     = 39;                         -- visibility
        Zonnestraling                  = 40;                         -- solar
        Lux-waarde                       = 41;                         -- lux based on SolarPower.time
        Regengegevens                  = 42;                         -- rain rate
        Temperatuur en lv              = 43;                         -- Temperature + Humidity
        Gevoelstemperatuur                 = 35;                         -- if you choose to separate windchill temperature device from wind
        Weersverwachting (lang)       = 44;                         -- Long weather forecast text
        Weersverwachting (kort)      = 45;                         -- Short weather forecast text
        Regen in mm/h komend uur       = 46;                         -- x-as in mm/h
        Regen in mm/h komende 2 uren      = 47;                         -- x-as in mm/h
        Regenalarm als text sensor             = 48;                         -- rain forecastAlarm text
        Regenalarm als alert sensor                 = 49;                         -- rain forecastAlert device
        Voor zonneschermen           = 50;                         -- rain forecast Switch
        Weersverwachting (dag 1 t/m 5)   = 51;                         -- weather 5 day forecast text
        Weersverwachting (dag 6 t/m 10)   = 52;                         -- weather 14 day forecast text
        -- End Devices
        
        -- Start Other settings
        useDomoticzLocation       = true;                       -- Use location set in domoticz for nearby weatherStation and rain forecast 
        myWeatherStation          = "Rotterdam";                -- This is NOT used when useDomoticzLocation is set to true !! 
        googleAPIkey              = false;                      -- Get one at https://cloud.google.com/maps-platform/user-guide/account-changes/
                                                                -- and change false to "your API key"
        rainAlertTime             = 0;                          -- Check rain in the next rainAlertTime minutes (between 20 and 120)
        rainAlertAmount           = 0.02;                       -- mm Rain to take serious
        forcedUpdateMinutes       = 360;                        -- Update sensors even when no change after nnn minutes (0 ===> never)
        signDecimalsBaroDatabase  = 2;                          -- Use significant decimals in barometer value (in database)
        signDecimalsBaroDisplay   = 0;                          -- Use significant decimals in barometer display 
        displayInfoLogMinutes     = 99;                         -- Show info in domoticz logfile every nnn minutes (0 ===> never, 99 ==> always)
        startDaytimeHour          = 7;                          -- After this hour until NighttimeHour, DaytimeFrequency will be used
        startNighttimeHour        = 22;                         -- After this hour until DaytimeHour, NighttimeFrequency will be used
        daytimeFrequencyMinutes   = 12;                         -- Execute every nn minutes during daytime
        nighttimeFrequencyMinutes = 24;                         -- Execute every nn minutes during nightime
        useNearestWeatherStation  = true;                       -- when the initial weatherstation does not provide required data
        maxDistanceFromHome       = 75;                         -- Only try weatherStations within this range in Km from home location
        displayLanguage           = "Nederlands";               -- Choose one of the languages available below
        -- displayLanguage           = "Deutsch";               -- Choose one of the languages available below
        -- displayLanguage           = "Yoruba";                -- Choose one of the languages available below
        -- displayLanguage           = "English";               -- Choose one of the languages available below
        -- End Other Settings                                                       -- Dutch, UK_English, German, Yoruba
       
       -- For development / problem solving only
        testSetDirectory          = "./scripts/dzVents/data/";  -- Location of the testSets
        forceWrite2Files          = false;                      -- This will write the result of the URL's write to files in scripts/dzVents/data/                                                      
        useTestSet                = false;                      -- when true this will trigger a dummy URL and get the data from files created by forceWrite2Files 
        logLevel                  = dzW.LOG_INFO;              -- DEBUG,INFO, ERROR
 }

 --[[ 
    Below are all relevant strings used in log info (INF_), in Debug mode (DBG_), in updating domoticz devices (DEV_), 
    in functions (TXT_)or in multiple of these areas (MUL_) listed in Nederlands and in English.
    Also a couple of these strings are in for other languages. If a string is missing in any language the main script will 
    use the default (which is English).
    The choice which language to use is set by the displayLanguage variable that can be found a couple of lines above this one.
]]--

languages = 
{ 
   Nederlands    = 
   {       
        DBG_AIRPRESSURE                   = "luchtdruk",
        DBG_CURLEMESSAGESLOADED           = "Debug modus geactiveerd en (C)URL(e) meldingen geladen",
        DBG_CURLEMESSAGESNOTLOADED        = "Debug modus geactiveerd maar (C)URL(e) meldingen werden niet geladen",
        DBG_DESCFACTOR                    = "Weer omschrijving / Weer factor: ",
        DBG_FOUND                         = "gevonden",
        DBG_ISTYPE                        = "van het type:",
        DBG_LOCATIONPROBLEM               = "Er is een probleem bij het verkrijgen van de locatiewaarden uit de domoticz settings",
        DBG_NO_WEATHERSTATION             = "Er lijkt iets niet (goed) ingevuld. Ik gebruik daarom weerstation Rotterdam",
        DBG_NOAPIKEY                      = "Nog geen apiKey. Lees hoe op https://cloud.google.com/maps-platform/user-guide/account-changes/",
        DBG_NOEXECUTION                   = "minuten na laatste uitvoering. Wordt nu niet uitgevoerd.",
        DBG_NORAINEXPEXTED1HOUR           = "Nog steeds geen regen voorspelt voor komend uur",    
        DBG_NORAINEXPEXTED2HOURS          = "Nog steeds geen regen voorspelt voor komende 2 uur",    
        DBG_NOUSERSETTING                 = "Gebruikers instellingen bestand is niet aanwezig of kan niet worden gebruikt",
        DBG_NOW                           = "moeten uitvoeren ?",
        DBG_RAINRATESAME                  = "Hoeveelheid regen is niet veranderd: ",
        DBG_SHOULDITRIGGER                = "Zou ik",
        ERR_ADDRESSNOTFOUND               = "[0001] Adres nil / 0; Problem bij het ophalen van het adres bij Google",
        ERR_CONVERSIONPROBLEM             = "[0002] Er is een probleem ontstaan bij het omzetten van de gegevens naar een tabel; graag controleren.",
        ERR_LOCATIONNOTFOUND              = "[0003] Lokatie nil/0; Probleem bij het ophalen van de locatie gegevens van domoticz",
        ERR_LOOKUPFAILED                  = "[0004] Er is iets mis gegaan bij het opzoeken van het weerstation",
        ERR_NOTFOUND                      = ")[0005] niet gevonden; graag controleren.",
        ERR_TRIGGERERROR                  = "[0006] Er is een probleem met inlezen van de data; controleer wat er fout is gegaan.",
        ERR_UNKNOWNEVENT                  = "[0007] Het dzVents programma is gestart door een onbekende gebeurtenis. Dit zou niet moeten kunnen.",
        ERR_WEATHERSTATIONPROBLEM         = "[0008] Er is iets mis met uw gekozen weerstation. (",
        ERR_WRONGPORTORIP                 = "[0009] Is er niet werkend poort nummer of IP adres gebruikt ?",
        INF_ALERTLEVEL                    = "waarschuwings niveau",
        INF_BAROCLOUDY                    = "bewolkt",
        INF_BAROCLOUDYRAIN                = "bewolkt/regen",
        INF_BAROFORECAST                  = "Voorspelling:",
        INF_BAROSTABLE                    = "stabiel",
        INF_BAROSUNNY                     = "zonnig",
        INF_BAROTHUNDERSTORM              = "onweer", 
        INF_BAROUNSTABLE                  = "wisselvallig",
        INF_CALCLUX                       = "Berekende lux", 
        INF_CANNOTCALCULATE               = "Niet kunnen berekenen",
        INF_CELSIUS                       = "°C",
        INF_CURRENT                       = "Huidig weer",
        INF_DEGREES                       = "graden",
        INF_DEVICE                        = "apparaat",
        INF_DEWPOINT                      = "Dauwpunt:",
        INF_FIVEDAYS                      = "komende 5 dagen",
        INF_FORECAST                      = "Weersvoorspelling",
        INF_GUST                          = "Windstoten:",
        INF_HUMCOMFORTABLE                = "comfortabel",    
        INF_HUMDRY                        = "droog",        
        INF_HUMIDITY                      = "Vochtigheid:",
        INF_HUMNORMAL                     = "normaal",
        INF_HUMWET                        = "nat",    
        INF_MMH                           = "mm/u",   
        INF_NEXT2HOURS                    = "volgende 2 uur",
        INF_NEXTHOUR                      = "volgende 60 minuten",
        INF_NODEVICE                      = "geen apparaat",
        INF_NODEVICESDEFINED              = "Nog geen apparaten in domoticz voor dit script is dat OK ?",
        INF_NOMEASUREDVALUE               = "Geen waarde ontvangen",
        INF_NONE                          = "Geen",
        INF_NOWEATHERSTATIONS             = "Er zijn geen weerstations gevonden. Dit gebeurt regelmatig rond middernacht",
        INF_PRESSURE                      = "Luchtdruk",
        INF_RAIN                          = "Regen nu/totaal",
        INF_RAINALARM                     = "Regen alarm",
        INF_RAINALERT                     = "Regen waarschuwing",
        INF_RAINFORECAST                  = "Voorspelling regen",
        INF_RAINTOTAL                     = "Hoeveelheid vandaag:",
        INF_SHORT                         = "Kort:",
        INF_SOLARPOWER                    = "Zonkracht",
        INF_SUMMARY                       = "Samengevat:",
        INF_SWITCH                        = "schakelaar",
        INF_TEMPERATURE                   = "Temperatuur:",
        INF_TESTSETWARNING                = "WAARSCHUWING: Er wordt Test data gebruikt !!",
        INF_TWOWEEKS                      = "volgende 6 tot 10 dagen",
        INF_VISIBILITY                    = "Zichtmeters",
        INF_WEATHERFORECASTPHRASE         = "Weersvoorspelling",   
        INF_WEATHERFORECASTSUMMARY        = "Samengevat:",
        INF_WIND                          = "Wind",
        INF_WINDCHILL                     = "Gevoelstemperatuur",
        INF_WINDSPEED                     = "Kracht:",
        MUL_MINUTES                       = ") minuten",
        MUL_MMRAIN                        = "mm regen verwacht (",
        MUL_NORAINEXPECTED                = "Geen regen verwacht (",
        MUL_THEREWILLBE                   = "Er wordt",
        TXT_GREEN                         = "GROEN",
        TXT_GREY                          = "GRIJS",
        TXT_ORANGE                        = "ORANJE",
        TXT_RED                           = "ROOD", 
        TXT_WEATHERSTION_PROBLEM          = "Er is iets fout met uw gekozen weerstation. (",
        TXT_YELLOW                        = "GEEL",
    },                                                                                  -- End of languageset Nederlands
                
    English                       = 
    {  
        DBG_AIRPRESSURE                   = "air pressure",
        DBG_DESCFACTOR                    = "weatherDescription / weatherFactor:",
        DBG_CURLEMESSAGESLOADED           = "Debug mode is on with (C)URL(e) messages loaded",
        DBG_CURLEMESSAGESNOTLOADED        = "Debug mode is on without (C)URL(e) messages loaded",
        DBG_FOUND                         = "found",
        DBG_ISTYPE                        = "is of type: ",
        DBG_LOCATIONPROBLEM               = "Problem getting the location from domoticz",
        DBG_NO_WEATHERSTATION             = "Something wrong with your weather station. (Not entered yet ?); I will set it to Rotterdam",
        DBG_NOAPIKEY                      = "No apiKey set. Get one from https://cloud.google.com/maps-platform/user-guide/account-changes/",
        DBG_NOEXECUTION                   = "minutes past since last execution. No execution now",
        DBG_NORAINEXPEXTED1HOUR           = "Still no rain expected in the next hour",    
        DBG_NORAINEXPEXTED2HOURS          = "Still no rain expected in the next 2 hours",    
        DBG_NOUSERSETTING                 = "User settings file unusable or not present",
        DBG_NOW                           = "now ?",
        DBG_RAINRATESAME                  = "rainRate has not changed: ",
        DBG_SHOULDITRIGGER                = "Should I trigger ",
        ERR_ADDRESSNOTFOUND               = "[0001] Address nil / 0; Problem getting the address from Google",
        ERR_CONVERSIONPROBLEM             = "[0002] Problem with conversion of data to table. Check it out",
        ERR_LOCATIONNOTFOUND              = "[0003] Location nil / 0; Problem getting the location from domoticz",
        ERR_LOOKUPFAILED                  = "[0004] This should not happen: Something went wrong with lookup of weatherStation based on lon,lat: ", 
        ERR_NOTFOUND                      = ")[0005]) is not found. Go Check it  ",
        ERR_TRIGGERERROR                  = "[0006] Problem with trigger (not OK). Check it out",
        ERR_UNKNOWNEVENT                  = "[0007] Script triggered by unknown event. This should not happen",
        ERR_WEATHERSTATIONPROBLEM         = "[0008] Something wrong with your weather station. (",
        ERR_WRONGPORTORIP                 = "[0009] Wrong Port and or IP for domoticz ?",
        INF_ARROW                         = " ===>> ",
        INF_ALERTLEVEL                    = "alert level",
        INF_BAROCLOUDY                    = "cloudy",
        INF_BAROCLOUDYRAIN                = "cloudy/rain",
        INF_BAROFORECAST                  = "Forecast:",
        INF_BAROSTABLE                    = "stable",    
        INF_BAROSUNNY                     = "sunny",
        INF_BAROTHUNDERSTORM              = "thunderstorm", 
        INF_BAROUNSTABLE                  = "unstable",
        INF_CALCLUX                       = "Calculated lux", 
        INF_CANNOTCALCULATE               = "Could not calculate",
        INF_CELSIUS                       = "°C",
        INF_CURRENT                       = "Current weather",
        INF_DEGREES                       = "degrees",
        INF_DEVICE                        = "device",
        INF_DEVICE                        = "device",
        INF_DEWPOINT                      = "Dewpoint:",
        INF_FIVEDAYS                      = "next 5 days",
        INF_FORECAST                      = "Weather forecast",
        INF_GUST                          = "Gust:",
        INF_HUMCOMFORTABLE                = "comfortable",    
        INF_HUMDRY                        = "dry",        
        INF_HUMIDITY                      =  "Humidity:",
        INF_HUMNORMAL                     = "normal",
        INF_HUMWET                        = "wet",    
        INF_MMH                           = "mm/h",
        INF_NEXT2HOURS                    = "next two hours:",
        INF_NEXTHOUR                      = "next hour:",
        INF_NODEVICE                      = "device None",
        INF_NODEVICESDEFINED              = "No weatherlike devices defined in domoticz (yet) is that OK ?",
        INF_NOMEASUREDVALUE               = "No value(s) received",
        INF_NONE                          = "None",
        INF_NOWEATHERSTATIONS             = "No weatherstations found. This happen frequently around midnight",
        INF_PRESSURE                      = "Air pressure",
        INF_RAIN                          = "Rain current/total",
        INF_RAINALARM                     = "Rain alarm",
        INF_RAINALERT                     = "Rain alert",
        INF_RAINFORECAST                  = "Rain forecast",
        INF_RAINTOTAL                     = "Amount today:",
        INF_SHORT                         = "Short:",
        INF_SOLARPOWER                    = "Solar radiation",
        INF_SUMMARY                       = "Summary:",
        INF_SWITCH                        = "switch",
        INF_TEMPERATURE                   = "Temperature:",
        INF_TESTSETWARNING                = "PLEASE note: Test data is being used !!!",
        INF_TWOWEEKS                      = "next 6-10 days",    
        INF_VISIBILITY                    = "Visibility",
        INF_WEATHERFORECASTPHRASE         = "Weather forecast",
        INF_WEATHERFORECASTSUMMARY        = "Summarized",
        INF_WIND                          = "Wind:",
        INF_WINDCHILL                     = "Windchill",
        INF_WINDSPEED                     = "speed",        
        MUL_MINUTES                       = ") minutes",
        MUL_MM_RAIN                       = "mm rain  (",
        MUL_NORAINEXPECTED                = "No rain  (",
        MUL_THEREWILLBE                   = "Expect",
        TXT_GREEN                         = "GREEN",
        TXT_GREY                          = "GREY",
        TXT_ORANGE                        = "ORANGE",
        TXT_RED                           = "RED",
        TXT_YELLOW                        = "YELLOW",
    },                                                                                        -- End of languageset English
    
        Deutsch  = 
    {       
        INF_CANNOTCALCULATE               = "Kann nicht berechnen",
        INF_DEVICE                        = "Gerät",
        INF_NEXTHOUR                      = "Nachstes uhr",
        INF_NOMEASUREDVALUE               = "Kein Wert erhalten",
        INF_UNDSOWEITER_UNDSOWEITER       = "Und so Weiter......",
    },
      
    Yoruba = 
    { 
        INF_NOMEASUREDVALUE               = "Ko si iye ti a gba",
        INF_CANNOTCALCULATE               = "Ko le se isiro",
        INF_DEVICE                        = "ohun-èlò",

    },
}                                                                                              -- End of languages
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Initialize a variable?

Post by waaren »

Steef wrote: Friday 26 April 2019 10:35 The only changes I made are in the "wusSettings.lua", which I copied here below :) The names are different, but they match with Domoticz, and the IDX numbers.
@Steef, I see that you changed the devicename strings in wusSettings.lua
If you are using the original script from this forum then that should not be done. Only idx are to be changed in that file.
But most likely that is not the problem you are facing here as it would generate a different error. The error that you see points more in the direction of a problem with accessing the modules and/or data all together.

Can you therefore please show the output of the following Command Line Interface (CLI) commands ?

Code: Select all

sudo find /home/pi/domoticz/scripts/dz* -type d -ls
sudo ls -Rla /home/pi/domoticz/scripts/dzVents/
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Steef
Posts: 14
Joined: Monday 07 January 2019 6:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Initialize a variable?

Post by Steef »

I came by the scripts by the site I mentioned in the other topic, and they have worked for a while, but all of a sudden, they stopped working.

The strange thing is that the Darksky part is working, and also the extended weather prediction, although somehow I putted them under different hardware dummy's in Domoticz.. Guess that is the downside of following tutorials.. that you don't have the knowledge of the underlaying logic

Of course I can show the output! It is displayed here below:

pi@raspberrypi:~ $ sudo find /home/pi/domoticz/dz* -type d -ls
32424 4 drwxrwxrwx 5 pi pi 4096 Apr 2 2018 /home/pi/domoticz/dzVents
32522 4 drwxrwxrwx 3 pi pi 4096 Apr 26 15:05 /home/pi/domoticz/dzVents/scripts
32523 4 drwxrwxrwx 2 pi pi 4096 Apr 26 15:06 /home/pi/domoticz/dzVents/scripts/modules
32425 4 drwxrwxrwx 2 pi pi 4096 Apr 15 10:05 /home/pi/domoticz/dzVents/documentation
32426 4 drwxrwxrwx 6 pi pi 4096 Apr 15 10:05 /home/pi/domoticz/dzVents/runtime
32430 4 drwxrwxrwx 6 pi pi 4096 Apr 15 10:05 /home/pi/domoticz/dzVents/runtime/tests
32434 4 drwxrwxrwx 2 pi pi 4096 Oct 8 2017 /home/pi/domoticz/dzVents/runtime/tests/data
32433 4 drwxrwxrwx 2 pi pi 4096 Jan 23 2018 /home/pi/domoticz/dzVents/runtime/tests/scripts
32432 4 drwxrwxrwx 2 pi pi 4096 Jan 23 2018 /home/pi/domoticz/dzVents/runtime/tests/generated_scripts
32431 4 drwxrwxrwx 2 pi pi 4096 Oct 8 2017 /home/pi/domoticz/dzVents/runtime/tests/scandir
32427 4 drwxrwxrwx 2 pi pi 4096 Apr 15 10:05 /home/pi/domoticz/dzVents/runtime/integration-tests
32428 4 drwxrwxrwx 2 pi pi 4096 Apr 15 10:05 /home/pi/domoticz/dzVents/runtime/misc
32429 4 drwxrwxrwx 2 pi pi 4096 Apr 4 21:05 /home/pi/domoticz/dzVents/runtime/device-adapters

pi@raspberrypi:~ $ sudo ls -Rla /home/pi/domoticz/scripts/dzVents/
/home/pi/domoticz/scripts/dzVents/:
total 84
drwxrwxrwx 6 pi pi 4096 Apr 25 10:22 .
drwxr-xr-x 8 pi pi 4096 Mar 25 13:05 ..
drwxrwxrwx 2 pi pi 4096 Aug 29 2017 data
-rw-r----- 1 root root 55421 Apr 25 10:40 domoticzData.lua
drwxrwxrwx 3 pi pi 4096 May 13 2018 examples
drwxrwxrwx 2 pi pi 4096 Apr 26 10:43 generated_scripts
-rw-rw-rw- 1 pi pi 227 Jul 16 2017 .gitignore
drwxrwxrwx 3 pi pi 4096 Apr 26 14:38 scripts

/home/pi/domoticz/scripts/dzVents/data:
total 12
drwxrwxrwx 2 pi pi 4096 Aug 29 2017 .
drwxrwxrwx 6 pi pi 4096 Apr 25 10:22 ..
-rw-r----- 1 root root 0 Mar 1 01:01 __data_updateWeatherSensors.lua
-rw-rw-rw- 1 pi pi 278 Aug 29 2017 README.md

/home/pi/domoticz/scripts/dzVents/examples:
total 84
drwxrwxrwx 3 pi pi 4096 May 13 2018 .
drwxrwxrwx 6 pi pi 4096 Apr 25 10:22 ..
-rw-rw-rw- 1 pi pi 649 Jan 9 2018 calc temp delta.lua
-rw-rw-rw- 1 pi pi 821 Aug 29 2017 check battery levels.lua
-rw-rw-rw- 1 pi pi 1272 Aug 29 2017 check dead devices by desc.lua
-rw-rw-rw- 1 pi pi 868 Oct 8 2017 check dead devices.lua
-rw-rw-rw- 1 pi pi 481 Jan 23 2018 external_light.lua
-rw-rw-rw- 1 pi pi 533 Jan 23 2018 fake presence.lua
-rw-rw-rw- 1 pi pi 541 Aug 29 2017 garage door.lua
-rw-rw-rw- 1 pi pi 332 Aug 29 2017 get sensor values.lua
-rw-rw-rw- 1 pi pi 448 Aug 29 2017 intruder alert.lua
-rw-rw-rw- 1 pi pi 2516 Aug 29 2017 leak_detection.lua
-rw-rw-rw- 1 pi pi 1621 Jan 23 2018 notify for dead system-alive check devices.lua
-rw-rw-rw- 1 pi pi 558 Aug 29 2017 only run script when button pressed.lua
-rw-rw-rw- 1 pi pi 3461 May 13 2018 plant watering notification.lua
-rw-rw-rw- 1 pi pi 441 Aug 29 2017 random night light.lua
-rw-rw-rw- 1 pi pi 224 Aug 29 2017 respond to switch.lua
-rw-rw-rw- 1 pi pi 321 Aug 29 2017 schedule fish pond pump.lua
-rw-rw-rw- 1 pi pi 3118 Jan 23 2018 simple room heating with hysteresis control.lua
-rw-rw-rw- 1 pi pi 4080 Jan 23 2018 sunscreen.lua
drwxrwxrwx 2 pi pi 4096 Jul 15 2018 templates

/home/pi/domoticz/scripts/dzVents/examples/templates:
total 48
drwxrwxrwx 2 pi pi 4096 Jul 15 2018 .
drwxrwxrwx 3 pi pi 4096 May 13 2018 ..
-rw-rw-rw- 1 pi pi 216 Jan 23 2018 bare.lua
-rw-rw-rw- 1 pi pi 2491 Jan 23 2018 complete.lua
-rw-rw-rw- 1 pi pi 176 Jan 23 2018 device.lua
-rw-rw-rw- 1 pi pi 385 Jan 23 2018 global_data.lua
-rw-rw-rw- 1 pi pi 170 Jan 23 2018 group.lua
-rw-rw-rw- 1 pi pi 839 Jan 23 2018 HTTPRequest.lua
-rw-rw-rw- 1 pi pi 170 Jan 23 2018 scene.lua
-rw-rw-rw- 1 pi pi 209 Jan 23 2018 security.lua
-rw-rw-rw- 1 pi pi 2476 Jul 15 2018 timer.lua
-rw-rw-rw- 1 pi pi 200 Jan 23 2018 variable.lua

/home/pi/domoticz/scripts/dzVents/generated_scripts:
total 12
drwxrwxrwx 2 pi pi 4096 Apr 26 10:43 .
drwxrwxrwx 6 pi pi 4096 Apr 25 10:22 ..
-rw-rw-rw- 1 pi pi 189 Aug 29 2017 README.md

/home/pi/domoticz/scripts/dzVents/scripts:
total 96
drwxrwxrwx 3 pi pi 4096 Apr 26 14:38 .
drwxrwxrwx 6 pi pi 4096 Apr 25 10:22 ..
drwxrwxrwx 2 pi pi 4096 Apr 26 14:38 modules
-rw-rw-rw- 1 pi pi 208 Aug 29 2017 README.md
-rw-rw-rw- 1 pi pi 81406 Apr 26 09:43 updateWeatherSensors.lua

/home/pi/domoticz/scripts/dzVents/scripts/modules:
total 64
drwxrwxrwx 2 pi pi 4096 Apr 26 14:38 .
drwxrwxrwx 3 pi pi 4096 Apr 26 14:38 ..
-rw-rw-rw- 1 pi pi 11738 Dec 15 11:48 wusErrors.lua
-rw-rw-rw- 1 pi pi 21989 Dec 15 11:48 wusFunctions.lua
-rw-rw-rw- 1 pi pi 20240 Apr 26 15:49 wusSettings.lua
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Initialize a variable?  [Solved]

Post by waaren »

Steef wrote: Friday 26 April 2019 20:49 I came by the scripts by the site I mentioned in the other topic, and they have worked for a while, but all of a sudden, they stopped working.
The buienradar script cannot have worked with these settings so something must have changed.

First do a

Code: Select all

sudo rm /home/pi/domoticz/scripts/dzVents/data/__data_updateWeatherSensors.lua
and then I suggest that you download and install (overwrite current files) the version from this forum and only change the values in wusSettings.lua after the equal signs between line 21 and 55.
The strange thing is that the Darksky part is working, and also the extended weather prediction, although somehow I putted them under different hardware dummy's in Domoticz..
The Darksky part is using different devices / - different API and is a different script. Unrelated to the buienradar part.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Steef
Posts: 14
Joined: Monday 07 January 2019 6:54
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Initialize a variable?

Post by Steef »

waaren wrote: Friday 26 April 2019 21:40 First do a

Code: Select all

sudo rm /home/pi/domoticz/scripts/dzVents/data/__data_updateWeatherSensors.lua
This did the trick, in one word: wonderful! In more words: many thanks for all the help!

Last week, I removed the virtual hardware, so I replaced the .lua documents, and added each device again, with the names mentioned in the wusSettings.lua document.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest