Problems with Darksky script

Moderator: leecollings

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

Problems with Darksky script

Post by Steef »

Hello Domoticz fanatics,

My name is Steef, and I am exploring the (endless) possibilities of the Domoticz workaround.
I have Domoticz running on a Raspberry Pi 3b, running on Raspbian.

Because I would really like to receive detailed weather information, I am trying to follow a nice how-to I found on the internet: https://ehoco.nl/domoticz-weerstation/ (The how-to is in Dutch).

I followed the how-to, but somehow, I receive an error on the following line:

Code: Select all

commandArray[#commandArray+1] = {['UpdateDevice'] = otherdevices_idx[device]..'|'..tostring(nvalue)..'|'..tostring(svalues)}
The error I receive is: Error: EventSystem: in Darksky weerstation: [string ” –[[ WEERSTATIONS: …”]:36: attempt to concatenate field ‘?’ (a nil value)

The complete script is mentioned below. I am trying to understand the .lua language, but it is new to me, and can not find the error.
Is there anyone who can help me with this problem? many thanks!

Code: Select all

--[[ WEERSTATIONS:				
Amsterdam   = 36  Groningen           = 13  Oost-Groninigen = 31  Vlissingen      = 44				
Arnhem      = 2   Hoek van Holland    = 17  Oost-Overijssel = 12  Voorschoten     = 46				
Berkhout    = 3   Hoogeveen           = 18  Rotterdam       = 33  Wadden          = 19				
Den Helder  = 6   Leeuwarden          = 26  Utrecht         = 5   Weert           = 8				
Eindhoven   = 7   Lelystad            = 27  Terneuzen       = 47  West-Friesland  = 38				
Gilze Rijen = 10  Maastricht          = 29  Twente          = 41  West-Utrecht    = 28				
Goes        = 11  Noord-Groninigen    = 24  Uden            = 45  Woensdrecht     = 50				
Gorinchem   = 16  Noordoostpolder     = 30  Venlo           = 1   Zwolle          = 15				
--]]				
--------------------------------				
---------- SETTINGS ------------				
--------------------------------				
local domo_ip       = "lokaal IP plus poort"          -- IP adres van Domoticz, inclusief poort				
local weerstation   = 15                                    -- Kies je weerstation naar keuze				
local api_key       = "API key"    -- Darksky secret key				
local debug         = 0                                     -- 0 = no debug, 1 = debug				
local language      = "nl"                                  -- ar: Arabic, az: Azerbaijani, be: Belarusian, bg: Bulgarian, bs: Bosnian, ca: Catalan, cs: Czech, da: Danish,				
			-- de: German, el: Greek, en: English, es: Spanish, et: Estonian, fi: Finnish, fr: French, he: Hebrew, hr: Croatian,	
			-- hu: Hungarian, id: Indonesian, is: Icelandic, it: Italian, ja: Japanese, ka: Georgian, ko: Korean, kw: Cornish,	
			-- lv: Latvian, nb: Norwegian Bokmål, nl: Dutch, no: Norwegian Bokmål (alias for nb), pl: Polish, pt: Portuguese,	
			-- ro: Romanian, ru: Russian, sk: Slovak, sl: Slovenian, sr: Serbian, sv: Swedish, tet: Tetum, tr: Turkish,	
			-- uk: Ukrainian, x-pig-latin: Igpay Atinlay, zh: simplified Chinese, zh-tw: traditional Chinese	
local dev_TempGround    = "GrondTemperatuur"       -- Temperature sensor				
local dev_TextTomorrow  = "Verwachting morgen"      -- Text sensor				
local dev_LongText      = "Uitgebreide verwachting"  -- Text sensor				
local dev_DewPoint      = "Dauwpunt"                -- Temperature sensor				
local dev_CloudCover    = "Bewolkingsgraad"         -- Percentage sensor				
local dev_UV            = "UV"                      -- UV sensor				
local dev_Ozone         = "Ozone"                   -- Custom sensor with axis "DU"				
--Functie devices updaten				
				
if commandArray == nil then commandArray = {} end				
				
function UpdateDev(device,nvalue,svalues)				
commandArray[#commandArray+1] = {['UpdateDevice'] = otherdevices_idx[device]..'|'..tostring(nvalue)..'|'..tostring(svalues)}				
end				
-- Functie afronding				
function round(num, dec)				
if num == 0 then				
return 0				
else				
local mult = 10^(dec or 0)				
return math.floor(num * mult + 0.5) / mult				
end				
end				
--------------------------------------------------				
----- ######## Buienradar API Data call ######## -----				
--------------------------------------------------				
time = os.date("*t")				
if  ((time.min+2)%5)==0  then -- Script loopt iedere 5 minuten (bv. 11.03, 11.08, 11.13, 11.18, etc.				
json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux				
local config=assert(io.popen('curl "https://api.buienradar.nl/data/public/2.0/jsonfeed"'))				
local Stringjson = config:read('*all')				
config:close()				
local jsonData = json:decode(Stringjson)				
-- Convert the json to a LUA table				
if jsonData.actual.stationmeasurements[ weerstation ] ~= nil then  -- this sometimes happens around midnight				
val_TempGround              = jsonData.actual.stationmeasurements[ weerstation ].groundtemperature				
val_WeatherTomorrow         = jsonData.forecast.fivedayforecast[1].weatherdescription				
val_SunChanceTomorrow       = jsonData.forecast.fivedayforecast[1].sunChance				
val_RainChanceTomorrow      = jsonData.forecast.fivedayforecast[1].rainChance				
val_RainMinimum             = jsonData.forecast.fivedayforecast[1].mmRainMin				
val_RainMaximum             = jsonData.forecast.fivedayforecast[1].mmRainMax				
val_WindDirectionTomorrow   = jsonData.forecast.fivedayforecast[1].windDirection				
val_WindSpeedTomorrow       = jsonData.forecast.fivedayforecast[1].wind				
val_TempTomorrowMinMin      = jsonData.forecast.fivedayforecast[1].mintemperatureMin --minimale minimumtemperatuur				
val_TempTomorrowMaxMin      = jsonData.forecast.fivedayforecast[1].mintemperatureMax --maximale minimumtemperatuur				
val_TempTomorrowMinMax      = jsonData.forecast.fivedayforecast[1].maxtemperatureMin --minimale maximumtemperatuur				
val_TempTomorrowMaxMax      = jsonData.forecast.fivedayforecast[1].maxtemperatureMax --maximale maximumtemperatuur				
end				
--Min/Max. temperatuur bepalen				
if val_TempTomorrowMinMin == val_TempTomorrowMaxMin then TempMinimum = val_TempTomorrowMinMin				
else TempMinimum = val_TempTomorrowMinMin.." - "..val_TempTomorrowMaxMin end				
if val_TempTomorrowMinMax == val_TempTomorrowMaxMax then TempMaximum = val_TempTomorrowMinMax				
else TempMaximum = val_TempTomorrowMinMax.." - "..val_TempTomorrowMaxMax				
end				
--Regenhoeveeldheid bepalen				
if val_RainMinimum == val_RainMaximum then RainIntensity = val_RainMinimum				
else RainIntensity = val_RainMinimum.." - "..val_RainMaximum end				
-- Windrichting tekst bepalen				
if val_WindDirectionTomorrow == "z" or val_WindDirectionTomorrow == "Z" then WindDirectionTomorrow = " het zuiden"				
elseif val_WindDirectionTomorrow == "zw" or val_WindDirectionTomorrow == "ZW" then WindDirectionTomorrow = "het zuidwesten"				
elseif val_WindDirectionTomorrow == "zo" or val_WindDirectionTomorrow == "ZO" then WindDirectionTomorrow = "het zuidoosten"				
elseif val_WindDirectionTomorrow == "w" or val_WindDirectionTomorrow == "W" then WindDirectionTomorrow = "het westen"				
elseif val_WindDirectionTomorrow == "nw" or val_WindDirectionTomorrow == "NW" then WindDirectionTomorrow = "het noordwesten"				
elseif val_WindDirectionTomorrow == "n" or val_WindDirectionTomorrow == "N" then WindDirectionTomorrow = "het noorden"				
elseif val_WindDirectionTomorrow == "no" or val_WindDirectionTomorrow == "NO" then WindDirectionTomorrow = " het noordoosten"				
elseif val_WindDirectionTomorrow == "o" or val_WindDirectionTomorrow == "O" then WindDirectionTomorrow = "het oosten"				
else WindDirectionTomorrow = "variabele richtingen" end				
--Voorspellingen				
forecast=val_WeatherTomorrow.. "\n " .."\n".. "Komende nacht daalt de temperatuur naar "..TempMinimum.." °C. Morgen overdag wordt morgen maximaal "..TempMaximum.. " °C. Er is morgen "..val_SunChanceTomorrow.." % kans op zon en "..val_RainChanceTomorrow.." % kans op neerslag ("..RainIntensity.." mm). De wind komt uit "..WindDirectionTomorrow.." en zal kracht "..val_WindSpeedTomorrow.." Bft hebben." .."\n " .."\n "				
if otherdevices_svalues[dev_TextTomorrow] ~= forecast then UpdateDev(dev_TextTomorrow,0,forecast) end				
-- Updating domoticz devices				
UpdateDev(dev_TempGround,0,val_TempGround)				
if debug==1 then				
print ("Temperatuur grond: "..val_TempGround.." °C")				
end				
end				
---------------------------------------				
-- ######## Darksy API call ######## --				
---------------------------------------				
if  ((time.min+2)%5)==0  then -- Script loopt iedere 5 minuten (bv. 11.03, 11.08, 11.13, 11.18, etc.				
json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux				
local config=assert(io.popen('curl "http://'..domo_ip..'/json.htm?type=settings"'))				
local Stringjson = config:read('*all')				
config:close()				
local jsonData = json:decode(Stringjson)				
-- Convert the json to a LUA table				
lat          = jsonData.Location.Latitude				
lon          = jsonData.Location.Longitude				
local coord = lat..","..lon				
				
json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux				
local config=assert(io.popen('curl "https://api.darksky.net/forecast/'..api_key..'/'..coord..'?lang='..language..'&units=si&exclude=hourly,flags"'))				
local Stringjson = config:read('*all')				
config:close()				
local jsonData = json:decode(Stringjson)				
-- Convert the json to a LUA table				
if jsonData ~= nil then  -- this sometimes happens around midnight				
val_UV          = jsonData.currently.uvIndex				
val_Ozone       = jsonData.currently.ozone				
val_DewPoint    = round(jsonData.currently.dewPoint,1)				
val_CloudCover  = jsonData.currently.cloudCover*100				
end				
				
if debug==1 then				
print("Bewolkingsgraad : "..val_CloudCover.. " %")				
print("UV-kracht :"..val_UV)				
print("Ozone : De ozone-waarde is "..val_Ozone)				
print("Dauwpunt : "..val_DewPoint.. " °C")				
end				
				
-- Domoticz devices updaten				
UpdateDev(dev_CloudCover,0,val_CloudCover)				
UpdateDev(dev_DewPoint,0,val_DewPoint)				
UpdateDev(dev_UV,0,val_UV..";0")				
UpdateDev(dev_Ozone,0,val_Ozone)				
				
if debug==1 then				
print ("Dauwpunt: "..val_DewPoint.." °C")				
print ("Bewolkingsgraad: "..val_CloudCover.." %")				
print ("UV-Index: "..val_UV)				
print ("Ozone: "..val_Ozone)				
end				
end				
-------------------------------------------------------				
-- ######## Buienradar Verwachting API call ######## --				
-------------------------------------------------------				
if  ((time.min+2)%30)==0  then -- Script loopt iedere 30 minuten (bv. 11.28, 11.58, 12.28, 12.58, etc.				
json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux				
local config=assert(io.popen('curl "https://api.buienradar.nl/data/public/1.1/jsonfeed"'))				
local Stringjson = config:read('*all')				
config:close()				
local jsonData = json:decode(Stringjson)				
-- Convert the json to a LUA table				
val_LongText   = jsonData.buienradarnl.weergegevens.verwachting_vandaag.titel .."\n " .."\n ".. jsonData.buienradarnl.weergegevens.verwachting_vandaag.tekst .."\n " .."\n"				
if debug==1 then				
print ("Uitgebreid: "..val_LongText)				
end				
				
if otherdevices_svalues[dev_LongText] ~= val_LongText then UpdateDev(dev_LongText,0,val_LongText) end				
end				
wallgarden
Posts: 9
Joined: Saturday 14 February 2015 18:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Problems with Darksky script

Post by wallgarden »

I have exactly the same error.
Did you find a solution?
RasPi V4.9700
RFXtrx433E
P1 Smart Meter Lan
Synology DS211j
zicht
Posts: 251
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: Problems with Darksky script

Post by zicht »

wallgarden wrote: Monday 11 March 2019 18:33 I have exactly the same error.
Did you find a solution?
Thanks for pointing me to this script will give it a try next week....

Just a quick reply on the errors you see :
The error says one of the strings in line 36 is empty. Empty value is not possible after .. in lua
You could use the print() command in lua to write something to the log.
like :
print(device)
print(nvalue)
print(svalues)

place it before the error and look in the log when it is executed.
it will give you a clue about what is going on

Do not forget to insert you domoIP !
You also need to have the dummy sensors in place with idx mentioned in the local dev_ section just above...
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
wallgarden
Posts: 9
Joined: Saturday 14 February 2015 18:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Problems with Darksky script

Post by wallgarden »

Thank you "zicht" for your reply.
I solved the problem already.
My solution was found in in the handling of the sensor "Groundtemperature".
The device for the sensor had the discription: "Temperatuur grond", while the script was refering to "Temperature Ground".

Thank you again.

Regards,
Wallgarden
RasPi V4.9700
RFXtrx433E
P1 Smart Meter Lan
Synology DS211j
User avatar
gielie
Posts: 290
Joined: Tuesday 12 January 2016 11:40
Target OS: Raspberry Pi / ODroid
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: Problems with Darksky script

Post by gielie »

I also have some problems with this script, i get this error.

Code: Select all

 2019-04-04 10:54:01.032 Error: EventSystem: Lua script Darksky did not return a commandArray
this is the code i use

Code: Select all

 --[[ WEERSTATIONS:
Amsterdam   = 36  Groningen           = 13  Oost-Groningen  = 31  Vlissingen      = 44
Arnhem      = 2   Hoek van Holland    = 17  Oost-Overijssel = 12  Voorschoten     = 46
Berkhout    = 3   Hoogeveen           = 18  Rotterdam       = 33  Wadden          = 19
Den Helder  = 6   Leeuwarden          = 26  Utrecht         = 5   Weert           = 8
Eindhoven   = 7   Lelystad            = 27  Terneuzen       = 47  West-Friesland  = 38
Gilze Rijen = 10  Maastricht          = 29  Twente          = 41  West-Utrecht    = 28
Goes        = 11  Noord-Groningen     = 24  Uden            = 45  Woensdrecht     = 50
Gorinchem   = 16  Noordoostpolder     = 30  Venlo           = 1   Zwolle          = 15
--]]
--------------------------------
---------- SETTINGS ------------
--------------------------------
local domo_ip       = "***"					-- IP adres van Domoticz, inclusief poort
local weerstation   = 36                                    -- Kies je weerstation naar keuze
local api_key       = "***"    -- Darksky secret key
local debug         = 1                                     -- 0 = no debug, 1 = debug
local language      = "nl"                                  -- ar: Arabic, az: Azerbaijani, be: Belarusian, bg: Bulgarian, bs: Bosnian, ca: Catalan, cs: Czech, da: Danish,
                                                            -- de: German, el: Greek, en: English, es: Spanish, et: Estonian, fi: Finnish, fr: French, he: Hebrew, hr: Croatian,
                                                            -- hu: Hungarian, id: Indonesian, is: Icelandic, it: Italian, ja: Japanese, ka: Georgian, ko: Korean, kw: Cornish,
                                                            -- lv: Latvian, nb: Norwegian Bokmål, nl: Dutch, no: Norwegian Bokmål (alias for nb), pl: Polish, pt: Portuguese,
                                                            -- ro: Romanian, ru: Russian, sk: Slovak, sl: Slovenian, sr: Serbian, sv: Swedish, tet: Tetum, tr: Turkish,
                                                            -- uk: Ukrainian, x-pig-latin: Igpay Atinlay, zh: simplified Chinese, zh-tw: traditional Chinese

local dev_TempGround    = "Temperatuur Grond"       -- Temperature sensor
local dev_TextTomorrow  = "Verwachting morgen"      -- Text sensor
local dev_LongText      = "Verwachting uitgebreid"  -- Text sensor       
local dev_DewPoint      = "Temperatuur Dauwpunt"    -- Temperature sensor 
local dev_CloudCover    = "Bewolkingsgraad"         -- Percentage sensor
local dev_UV            = "UV"                      -- UV sensor
local dev_Ozone         = "Ozone"                   -- Custom sensor with axis "DU"

--Functie devices updaten

function UpdateDev(device,nvalue,svalues)
    if(commandArray == nil) then
        commandArray = {['UpdateDevice'] = otherdevices_idx[device]..'|'..tostring(nvalue)..'|'..tostring(svalues)}
    else 
        commandArray[#commandArray+1] = {['UpdateDevice'] = otherdevices_idx[device]..'|'..tostring(nvalue)..'|'..tostring(svalues)}
    end 
end

-- Functie afronding
function round(num, dec)
    if num == 0 then
        return 0
    else
        local mult = 10^(dec or 0)
        return math.floor(num * mult + 0.5) / mult
    end
end
--------------------------------------------------
----- ######## Buienradar API Data call ######## -----
--------------------------------------------------
time = os.date("*t")
if  ((time.min+2)%5)==0  then -- Script loopt iedere 5 minuten (bv. 11.03, 11.08, 11.13, 11.18, etc.
    json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux
    local config=assert(io.popen('curl "https://data.buienradar.nl/2.0/feed/json"'))   
    local Stringjson = config:read('*all')
    config:close()
    local jsonData = json:decode(Stringjson)
-- Convert the json to a LUA table
if jsonData.actual.stationmeasurements[ weerstation ] ~= nil then  -- this sometimes happens around midnight
    val_TempGround              = jsonData.actual.stationmeasurements[ weerstation ].groundtemperature
    val_WeatherTomorrow         = jsonData.forecast.fivedayforecast[1].weatherdescription        
    val_SunChanceTomorrow       = jsonData.forecast.fivedayforecast[1].sunChance
    val_RainChanceTomorrow      = jsonData.forecast.fivedayforecast[1].rainChance        
    val_RainMinimum             = jsonData.forecast.fivedayforecast[1].mmRainMin
    val_RainMaximum             = jsonData.forecast.fivedayforecast[1].mmRainMax
    val_WindDirectionTomorrow   = jsonData.forecast.fivedayforecast[1].windDirection        
    val_WindSpeedTomorrow       = jsonData.forecast.fivedayforecast[1].wind        
    val_TempTomorrowMinMin      = jsonData.forecast.fivedayforecast[1].mintemperatureMin --minimale minimumtemperatuur
    val_TempTomorrowMaxMin      = jsonData.forecast.fivedayforecast[1].mintemperatureMax --maximale minimumtemperatuur
    val_TempTomorrowMinMax      = jsonData.forecast.fivedayforecast[1].maxtemperatureMin --minimale maximumtemperatuur
    val_TempTomorrowMaxMax      = jsonData.forecast.fivedayforecast[1].maxtemperatureMax --maximale maximumtemperatuur
end

--Min/Max. temperatuur bepalen
if val_TempTomorrowMinMin == val_TempTomorrowMaxMin then TempMinimum = val_TempTomorrowMinMin
    else TempMinimum = val_TempTomorrowMinMin.." - "..val_TempTomorrowMaxMin end
if val_TempTomorrowMinMax == val_TempTomorrowMaxMax then TempMaximum = val_TempTomorrowMinMax
    else TempMaximum = val_TempTomorrowMinMax.." - "..val_TempTomorrowMaxMax
end
--Regenhoeveeldheid bepalen
if val_RainMinimum == val_RainMaximum then RainIntensity = val_RainMinimum
    else RainIntensity = val_RainMinimum.." - "..val_RainMaximum end
-- Windrichting tekst bepalen
if val_WindDirectionTomorrow == "z" or val_WindDirectionTomorrow == "Z" then WindDirectionTomorrow = " het zuiden"
    elseif val_WindDirectionTomorrow == "zw" or val_WindDirectionTomorrow == "ZW" then WindDirectionTomorrow = "het zuidwesten"
    elseif val_WindDirectionTomorrow == "zo" or val_WindDirectionTomorrow == "ZO" then WindDirectionTomorrow = "het zuidoosten"
    elseif val_WindDirectionTomorrow == "w" or val_WindDirectionTomorrow == "W" then WindDirectionTomorrow = "het westen"
    elseif val_WindDirectionTomorrow == "nw" or val_WindDirectionTomorrow == "NW" then WindDirectionTomorrow = "het noordwesten"
    elseif val_WindDirectionTomorrow == "n" or val_WindDirectionTomorrow == "N" then WindDirectionTomorrow = "het noorden"
    elseif val_WindDirectionTomorrow == "no" or val_WindDirectionTomorrow == "NO" then WindDirectionTomorrow = " het noordoosten"
    elseif val_WindDirectionTomorrow == "o" or val_WindDirectionTomorrow == "O" then WindDirectionTomorrow = "het oosten"
    else WindDirectionTomorrow = "variabele richtingen" end
--Voorspellingen
forecast=val_WeatherTomorrow.. "\n" .."\n".. "Komende nacht daalt de temperatuur naar "..TempMinimum.." °C. Morgen overdag wordt morgen maximaal "..TempMaximum.. " °C. Er is morgen "..val_SunChanceTomorrow.." % kans op zon en "..val_RainChanceTomorrow.." % kans op neerslag ("..RainIntensity.." mm). De wind komt uit "..WindDirectionTomorrow.." en zal kracht "..val_WindSpeedTomorrow.." Bft hebben." .."\n " .."\n "
if otherdevices_svalues[dev_TextTomorrow] ~= forecast then UpdateDev(dev_TextTomorrow,0,forecast) end
-- Updating domoticz devices
    UpdateDev(dev_TempGround,0,val_TempGround)     
if debug==1 then
    print ("Temperatuur Grond: "..val_TempGround.." °C") 
end
end
---------------------------------------
-- ######## Darksy API call ######## --
---------------------------------------
if  ((time.min+2)%5)==0  then -- Script loopt iedere 5 minuten (bv. 11.03, 11.08, 11.13, 11.18, etc.

    json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux
    local config=assert(io.popen('curl "http://'..domo_ip..'/json.htm?type=settings"'))
    local Stringjson = config:read('*all')
    config:close()
    local jsonData = json:decode(Stringjson)
-- Convert the json to a LUA table
    lat          = jsonData.Location.Latitude
    lon          = jsonData.Location.Longitude

  local coord = lat..","..lon
 
    json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux
    local config=assert(io.popen('curl "https://api.darksky.net/forecast/'..api_key..'/'..coord..'?lang='..language..'&units=si&exclude=hourly,flags"'))
    local Stringjson = config:read('*all')
    config:close()
    local jsonData = json:decode(Stringjson)
-- Convert the json to a LUA table
   if jsonData ~= nil then  -- this sometimes happens around midnight
        val_UV          = jsonData.currently.uvIndex
        val_Ozone       = jsonData.currently.ozone
        val_DewPoint    = round(jsonData.currently.dewPoint,1)
        val_CloudCover  = jsonData.currently.cloudCover*100
end
    
    if debug==1 then
        print("Bewolkingsgraad : "..val_CloudCover.. " %")
        print("UV-kracht :"..val_UV)
        print("Ozone : De ozone-waarde is "..val_Ozone) 
        print("Dauwpunt : "..val_DewPoint.. " °C")
    end
    
-- Domoticz devices updaten
    UpdateDev(dev_CloudCover,0,val_CloudCover)
    UpdateDev(dev_DewPoint,0,val_DewPoint)
    UpdateDev(dev_UV,0,val_UV..";0")
    UpdateDev(dev_Ozone,0,val_Ozone)
 
if debug==1 then
    print ("Dauwpunt: "..val_DewPoint.." °C")
    print ("Bewolkingsgraad: "..val_CloudCover.." %")
    print ("UV-Index: "..val_UV)
    print ("Ozone: "..val_Ozone)
end
end
-------------------------------------------------------
-- ######## Buienradar Verwachting API call ######## --
-------------------------------------------------------
if  ((time.min+2)%30)==0  then -- Script loopt iedere 30 minuten (bv. 11.28, 11.58, 12.28, 12.58, etc.
    json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux
    local config=assert(io.popen('curl "https://data.buienradar.nl/1.1/feed/json"'))
    local Stringjson = config:read('*all')
    config:close()
    local jsonData = json:decode(Stringjson)
-- Convert the json to a LUA table
    val_LongText 	= jsonData.buienradarnl.weergegevens.verwachting_vandaag.titel .."\n " .."\n ".. jsonData.buienradarnl.weergegevens.verwachting_vandaag.tekst .."\n " .."\n"

  if debug==1 then
    print ("Uitgebreid: "..val_LongText) 
end
  
if otherdevices_svalues[dev_LongText] ~= val_LongText then UpdateDev(dev_LongText,0,val_LongText)end
end

Does anybody know where this error comes from, the sensors are being updated tho.
- Aeon Labs USB Stick met Z-wave plus
- Aeotec MultiSensor 6
- FIBARO FGS223
- FIBARO FGWPE Wall Plug
- Neo CoolCam Power plug
- Popp Smoke Detector
- Toon
- Kodi Media Server
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest