Toon bijdragen

Deze sectie stelt je in staat om alle bijdragen van dit lid te bekijken. Je kunt alleen de bijdragen zien waar je op dit moment toegang toe hebt.

Topics - Joost

61
Neo Coolcam Z-wave EU Smart Power Plug (NAS-WR01ZE)

Klik HIER voor de beste prijs!

Features:


ON/OFF control
Compatible with 300 series and 500 series
Measuring voltage,current,instant power,accumulated power.
Input voltage:110-250V AC,50/60HZ
Max current:13A
Operation temperature:0-40 degree
Storage temperature: -20-60 degree
US plug:43mm x 43mm x 45mm

Radio Frequency:

EU version:868.4MHz


What It Does


       
  • Instant Wireless Control: Control lamps and small appliances wirelessly with your smart phone or laptop.
  • Energy Efficient: Monitor energy consumption in live mode or over time. Save on bills and enjoy a more efficient home.
  • Complete Customization: Build your own schedules and events designed around your needs. Use advanced configurations to allow or disable manual control of the plug. Set the timer to turn appliances off automatically.
  • Simplest Set Up: Installation is virtually instant, and a compact size gives full access to the second outlet in a standard receptacle.
  • Stronger Connectivity: Z-Wave Plus provides faster and safer wireless connectivity. The built-in range extender guarantees a stronger network.
62
dzVents / Buitenlamp aanzetten bij zonsondergang
27 oktober 2019, 07:56:30
Onderstaand dzVents-script zorgt ervoor dat een buitenlamp automatisch aangezet wordt bij zonsondergang en weer uitgezet wordt, zodra de zon opkomt. Ideaal voor bijvoorbeeld een lamp bij de voordeur.


-- External light
-- turn lights on at sunset and back off at sunrise

return {
    active = true,
    on = {
        timer = {
        'at sunset',
        'at sunrise'
        }
    },
    execute = function(domoticz, timer)
    -- external light switch name
    local external_light = domoticz.devices('External light')

        if (timer.trigger == 'at sunset') then
        external_light.switchOn()
        else
        external_light.switchOff()
        end
    end
}

63
Onderstaand dzVents-script zorgt ervoor dat een lamp rondom zonsondergang wordt aangezet en rondom 01:00 uur weer wordt uitgezet. Om ervoor te zorgen dat de lamp niet telkens op hetzelfde tijdstip aan en uit gaat zit er een random vertraging van maximaal 30 minuten ingebouwd.


local RANDOM_DELAY_MINS = 30
return {
active = true,
on = {
['timer'] = {
'at sunset',
'at 01:00'
}
},
execute = function(domoticz)

if (domoticz.security ~= domoticz.SECURITY_DISARMED) then

local light = domoticz.devices('Window light')

if (not light.bState) then -- i.e. state == 'On'
light.switchOn().withinMin(RANDOM_DELAY_MINS)
else
light.switchOff().withinMin(RANDOM_DELAY_MINS)
end

end
end
}

64
Onderstaand dzVents-script zorgt ervoor dat de vijverpomp op werkdagen om 8.30 uur aangezet worden en om 17.30 uur uitgezet wordt. In het weekend zijn de schakeltijden zonsopkomst en zonsondergang.


return {
active = true,
on = {
['timer'] = {
'at 8:30 on mon,tue,wed,thu,fri',
'at 17:30 on mon,tue,wed,thu,fri',

-- weeekends are different
'at sunset on sat, sun',
'at sunrise on sat, sun'
}
},

execute = function(domoticz)

local pump = domoticz.devices('Pond')
pump.toggleSwitch()

end
}

65
dzVents / Kamer verwarmen met een boiler
27 oktober 2019, 07:40:25

-- assumptions:
-- the setpoint is set by a selector dummy device where the values are numeric temperatures
-- but you can easily change it to a setpoint device

local BOILER_DEVICE = 'Boiler' -- switch device
local SETPOINT_DEVICE = 'Setpoint' -- selector dummy device
local TEMPERATURE_SENSOR = 'Temperature'
local HYSTERESIS = 0.5 -- temp has to drop this value below setpoint before boiler is on again
local SMOOTH_FACTOR = 3
local LOGGING = true

return {
on = {
['timer'] = {
'every minute',
},
devices = {
TEMPERATURE_SENSOR,
SETPOINT_DEVICE
}
},
data = {
temperatureReadings = { history = true, maxItems = SMOOTH_FACTOR }
},
active = true,
execute = function(domoticz, item)

local avgTemp
local temperatureReadings = domoticz.data.temperatureReadings
local sensor = domoticz.devices(TEMPERATURE_SENSOR)
local current = sensor.temperature
local boiler = domoticz.devices(BOILER_DEVICE)
local setpoint = domoticz.devices(SETPOINT_DEVICE)

-- first check if the sensor got a new reading or the setpoint was changed:
if (item.isDevice) then

if (sensor.changed) then
-- sensor just reported a new reading
-- add it to the readings table

if (current ~= 0 and current ~= nil) then
temperatureReadings.add(current)
else
-- no need to be here, weird state detected
domoticz.log('Strange sensor reading.. skiping', domoticz.LOG_ERROR)
return
end

elseif (domoticz.devices(SETPOINT_DEVICE).changed) then
-- a new setpoint was set
if LOGGING then domoticz.log('Setpoint was set to ' .. item.state) end
else
-- no business here, bail out...
return
end
end

-- now determine what to do
if (setpoint.state == nil or setpoint.state == 'Off') then
boiler.switchOff()
return -- we're done here
end

local setpointValue = tonumber(setpoint.state)

-- determine at which temperature the boiler should be
-- switched on
local switchOnTemp = setpointValue - HYSTERESIS

-- don't use the current reading but average it out over
-- the past <SMOOTH_FACTOR> readings (data smoothing) to get rid of noise, wrong readings etc
local avgTemp = temperatureReadings.avg(1, SMOOTH_FACTOR, current) -- fallback to current when history is empty

if LOGGING then
domoticz.log('Average: ' .. avgTemp, domoticz.LOG_INFO)
domoticz.log('Setpoint: ' .. setpointValue, domoticz.LOG_INFO)
domoticz.log('Current boiler state: ' .. boiler.state, domoticz.LOG_INFO)
domoticz.log('Switch-on temperature: ' .. switchOnTemp, domoticz.LOG_INFO)
end

if (avgTemp >= setpointValue and boiler.state == 'On') then
if LOGGING then domoticz.log('Target temperature reached, boiler off') end
boiler.switchOff()
end

if (avgTemp < setpointValue and boiler.state == 'Off') then
if (avgTemp < switchOnTemp) then
if LOGGING then domoticz.log('Heating is required, boiler switched on') end
boiler.switchOn()
else
if LOGGING then domoticz.log('Average temperature below setpoint but within hysteresis range, waiting for temperature to drop to ' .. switchOnTemp) end
end
end
end
}

66
Onderstaand dzVents-script kun je gebruiken om je zonwering automatisch open en dicht te laten gaan op basis van:

       
  • temperatuur
  • windkracht
  • windstoten
  • regen
  • regen
  • UV
  • LUX
Na zonsondergang zal de zonwering altijd open gezet worden en uiteraard is het ook mogelijk om de regels handmatig te overrulen.


-- Define all the sensors which needs to be considered for the sunscreen to close
local sensors = {
    temperature = {
        active = true,
        device = 'Temperature',
        closeRule = function(device)
            return device.temperature <= 15
        end
    },
    wind = {
        active = true,
        device = 'Wind',
        closeRule = function(device)
            return device.speed >= 50 or device.gust >= 150
        end
    },
    rain = {
        active = true,
        device = 'Rain',
        closeRule = function(device)
            return device.rainRate > 0
        end
    },
    rainExpected = {
        active = false,
        device = 'Rain expected', -- This needs to be a virtual sensor of type 'percentage'
        closeRule = function(device)
            return device.percentage > 15
        end
    },
    uv = {
        active = true,
        device = 'UV',
        closeRule = function(device)
            return device.uv <= 3
        end
    },
    lux = {
        active = false,
        device = 'Lux',
        closeRule = function(device)
            return device.lux <= 500
        end
    }
}

-- Define the name of your sunscreen device
local sunscreenDevice = 'Sunscreen'

-- Enable dry run mode to test the sunscreen script without actually activating the sunscreen
local dryRun = false

-- Define the name of a virtual switch which you can use to disable the sunscreen automation script
-- Set to false to disable this feature
local manualOverrideSwitch = false

-- Minutes to wait after a sunscreen close before opening it again.
local timeBetweenOpens = 10

return {
    active = true,
    on = {
        timer = {'every minute'}
    },
    logging = {
        level = domoticz.LOG_DEBUG,
        marker = 'Sunscreen'
    },
    execute = function(domoticz)

        local function switchOn(sunscreen, message)
            if (sunscreen.state == 'Closed') then
                if (not dryRun) then
                    sunscreen.switchOn()
                    domoticz.notify('Sunscreen', message)
                end
                domoticz.log(message, domoticz.LOG_INFO)
            end
        end

        local function switchOff(sunscreen, message)
            if (sunscreen.state == 'Open') then
                if (not dryRun) then
                    sunscreen.switchOff()
                    domoticz.notify('Sunscreen', message)
                end
                domoticz.log(message, domoticz.LOG_INFO)
            end
        end

        if (manualOverrideSwitch and domoticz.devices(manualOverrideSwitch).state == 'On') then
            domoticz.log('Automatic sunscreen script is manually disabled', domoticz.LOG_DEBUG)
            return
        end

        local sunscreen = domoticz.devices(sunscreenDevice)

        -- Sunscreen must always be up during nighttime
        if (domoticz.time.isNightTime) then
            switchOff(sunscreen, 'Closing sunscreen, It is night')
            return
        end

        -- Check all sensor tresholds and if any exeeded close sunscreen
        for sensorType, sensor in pairs(sensors) do

            if (sensor['active'] == true) then

                local device = domoticz.devices(sensor['device'])
                local closeRule = sensor['closeRule']

                domoticz.log('Checking sensor: ' .. sensorType, domoticz.LOG_DEBUG)

                if (closeRule(device)) then

                    switchOff(sunscreen, sensorType .. ' treshold exceeded, Sunscreen up')

                    domoticz.log(sensorType .. ' treshold exceeded', domoticz.LOG_DEBUG)
                    -- Return early when we exeed any tresholds
                    return
                end
            else
                domoticz.log('Sensor not active skipping: ' .. sensorType, domoticz.LOG_DEBUG)
            end
        end

        -- All tresholds OK, sunscreen may be lowered
        if (sunscreen.lastUpdate.minutesAgo > timeBetweenOpens) then
            switchOn(sunscreen, 'Sun is shining, all thresholds OK, lowering sunscreen')
        end
    end
}

67
Onderstaand dzVents-script zorgt ervoor dat de rolgordijnen automatisch open en dicht gaan indien:

       
  • open om 7.49 uur: indien het een werkdag is en de zonsopkomst voor 7.49 uur is
  • open bij zonsopkomst: indien het een werkdag en de zon na 7.49 uur opkomt
  • open om 9.30 uur: indien het een weekend-dag is
  • dicht: bij zonsondergang op alle dagen

return {
   on = {
      devices = {
         'Donker buiten',
      },
       timer = {
            'at 07:49 on mon, tue, wed, thu, fri',
            'at 09:30 on sat, sun',
        },
       logging = {
            level = domoticz.LOG_INFO,
            marker = "Rolgordijnen"
        },
   },

   execute = function(domoticz, device)
        local RollerblindFront  = domoticz.devices(389)
        local RollerblindBack   = domoticz.devices(390)
      local DarkOutside      = domoticz.devices(94)

        if (domoticz.time.matchesRule('at 07:49 on mon,tue,wed,thu,fri') and DarkOutside.state == 'Off') or (DarkOutside.state == 'Off' and domoticz.time.matchesRule('at 7:50-9:00 on mon,tue,wed,thu,fri')) then
            RollerblindFront.switchOff().forSec(1.9)
            RollerblindBack.switchOff().forSec(2)
            domoticz.notify('Rolgordijn info', 'Rolgordijn voor open gezet')
            domoticz.notify('Rolgordijn info', 'Rolgordijn achter open gezet')
        end
           
        if domoticz.time.matchesRule('at 09:30 on sat,sun') and DarkOutside.state == 'Off' then
            RollerblindFront.switchOff().forSec(1.9)
            RollerblindBack.switchOff().forSec(2)
            domoticz.notify('Rolgordijn info', 'Rolgordijn voor open gezet')
            domoticz.notify('Rolgordijn info', 'Rolgordijn achter open gezet')
        end

        if DarkOutside.state == 'On' and (RollerblindFront.state == 'Stopped' or RollerblindBack.state == 'Stopped') then
            RollerblindFront.switchOn().checkFirst()
            RollerblindBack.switchOn().checkFirst()
            domoticz.notify('Rolgordijn info', 'Rolgordijnen dicht gezet')
        end
end
}
68
LUA / Maak van je Raspberry Pi een weerstation
26 oktober 2019, 09:14:57
Onderstaand LUA-script maakt van je Raspberry Pi een weerstation. Iedere vijf minuten worden de weer-sensoren geüpdatet, behalve de weer-alerts (deze worden iedere 3 uur ververst). Indien er een weer-waarschuwing (code geel/oranje/rood) is dan zal je op jouw smartphone hier een notificatie van ontvangen.

Voorbereidingen:

       
  • Installeer PHP op je Raspberry Pi (bij voorkeur versie 7.3)
  • Installeer nl_NL-UTF-8 op je Raspiberry Pi met commando raspi-config
  • Vul in Domoticz bij Setup > Settings > Location de gps van jouw locatie in.
  • Download Meteo Alarm Weather Warnings en upload alle .php and .json bestanden in de map meteo-alarm-weather-warnings/src naar de map /var/www/html/meteo-alarm-weather-warnings-1.1/src/ op de Raspberry Pi. Wijzig vervolgens de naam van het warnings.json bestand naar warnings.php (je hebt nu dus 2 bestanden met dezelfde naam, 1x beginnend met een kleine letter en 1x beginnend met een hoofdletter). Open nu het bestand Period.php (in de subfolder /src). Op regel 31 wijzig je 'from' naar 'starttime' en wijzig je 'until' naar 'endtime'. Vergeet niet om de wijziging op te slaan!
  • Onder Settings vul je jouw gegevens in.
  • Op regel 408 zie je 013 staan. Dit cijfer is Noord-Brabant voor weer-waarschuwingen. Het cijfer kun je wijzigen naar jouw eigen provincie/kustgebied.
  • Op regel 537 moet je het getal 25 vervangen door het IDX van device "Waarschuwing vandaag".
  • Maak in Domoticz virtuele devices aan met de namen, zoals ze op regel 47 t/m 69 staan

--[[

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

REGIO'S VOOR ALERTS:

007=Groningen      011=Noord-Holland   015=Utrecht
008=Flevoland      012=Limburg         016=Overijssel
009=Zuid-Holland   013=Noord-Brabant   017=Friesland
010=Zeeland         014=Gelderland      018=Drenthe

801=Vlissingen         805=Rottum
802=Hoek van Holland   806=Waddenzee
803=IJmuiden         807=IJsselmeer
804=Texel
--]]

----------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------ SETTINGS ------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------
local domo_ip          = "192.168.2.63:8080"               -- IP adres van Domoticz, inclusief poort
local webserver_ip      = "192.168.2.63"                  -- IP adres van webserver
local weerstation      = 7                                    -- Kies je weerstation naar keuze
local api_key          = "153854f6c0a1bd5237a2f28464ca8de5"   -- Darksky secret key
local debug            = 0                                     -- 0=geen debug, 1=debug Darksy, 2=debug Buienradar 3=debug Alerts, 4=debug functies, 5=debug alles
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 DayOfWeek = {"Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag"}
--Darksky API
local dev_CloudCover_Now            = "Bewolkingsgraad"         -- Percentage sensor
local dev_UV_Now                  = "UV"                  -- UV sensor
local dev_Ozone_Now                  = "Ozone"               -- Custom sensor (DU)
local dev_DewPoint_Now               = "Temperatuur Dauwpunt"   -- Temperature sensor
local dev_TempOutside_Now            = "Temperatuur Buiten"      -- Temperature sensor
local dev_TempApparent_Now            = "Temperatuur Gevoel"      -- Temperature sensor
local dev_Humidity_Now               = "Luchtvochtigheid"      -- Humidity sensor
local dev_Pressure_Now               = "Luchtdruk"            -- Barometer sensor
local dev_Visibility_Now            = "Zicht"               -- Visibility sensor
local dev_Wind_Now                  = "Wind"               -- Wind sensor
local dev_PrecipIntensity_Now         = "Neerslag hoeveelheid nu" -- Custom sensor (mm/u)
local dev_PrecipProbability_Now         = "Kans op neerslag nu"      -- Percentage sensor
local dev_WeatherPredictionWeekShort   = "Weerbericht week kort"   -- Text sensor
--Buienradar 2.0 API
local dev_WeatherPredictionLong         = "Verwachting uitgebreid"   -- Text sensor
local dev_WeatherPredictionShort      = "Verwachting kort"      -- Text sensor
local dev_WeatherPrediction24H         = "Komende 24 uur"         -- Text sensor
local dev_WeatherPrediction1_5D         = "Verwachting 1-5 dagen"   -- Text sensor
local dev_WeatherPrediction6_10D      = "Verwachting 6-10 dagen"   -- Text sensor
local dev_TempGround               = "Temperatuur Grond"      -- Temperature sensor
local dev_SolarRadiation            = "Zonkracht"            -- Solar Radiation sensor
local dev_AlertToday               = "Waarschuwing vandaag"   -- Alert sensor
local dev_AlertToday1               = "Waarschuwing morgen"      -- Alert sensor

commandArray = {}
----------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------######## FUNCTIES ######## ----------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------
print("Weer script is afgetrapt")
--Functie devices updaten
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
-- Get System Time/Date
time = os.date("*t")
weekday = os.date("%A")
minutes = time.min + time.hour * 60
daynumber = os.date("*t").wday
DayOfWeek = {"Zo", "Ma", "Di", "Wo", "Do", "Vr", "Za"}

vandaag = daynumber      -- vandaag
vandaag1 = daynumber+1   -- morgen
vandaag2 = daynumber+2   -- overmorgen
vandaag3 = daynumber+3   -- etc.
vandaag4 = daynumber+4
vandaag5 = daynumber+5
vandaag6 = daynumber+6

if vandaag1 > 7 then vandaag1 = vandaag1 - 7 end
if vandaag2 > 7 then vandaag2 = vandaag2 - 7 end
if vandaag3 > 7 then vandaag3 = vandaag3 - 7 end
if vandaag4 > 7 then vandaag4 = vandaag4 - 7 end
if vandaag5 > 7 then vandaag5 = vandaag5 - 7 end
if vandaag6 > 7 then vandaag6 = vandaag6 - 7 end

if debug==4 or debug==5 then
print ("Vandaag :"..DayOfWeek[ (vandaag)+0 ] )
print ("Morgen :"..DayOfWeek[ (vandaag1)+0 ] )
print ("Overmorgen :"..DayOfWeek[ (vandaag2)+0 ] )
print ("Vandaag+3 :"..DayOfWeek[ (vandaag3)+0 ] )
print ("Vandaag+4 :"..DayOfWeek[ (vandaag4)+0 ] )
print ("Vandaag+5 :"..DayOfWeek[ (vandaag5)+0 ] )
end

-- Script draait iedere zoveel minuten:
if  ((time.min-0)%5)==0  then -- Script loopt iedere 5 minuten (bv. 11.05, 11.10, 11.15, 11.15, etc.
----------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------ ######## Darksy API call ######## -----------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------

    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)
-- Coördinaten locatie
    lat   = jsonData.Location.Latitude
    lon   = jsonData.Location.Longitude
   local coord = lat..","..lon

-- JSON omzetten naar een LUA table
    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)

      if jsonData ~= nil then  -- dit gebeurt soms rond middernacht
         val_UV_Now               = jsonData.currently.uvIndex
         val_Ozone_Now            = jsonData.currently.ozone
         val_DewPoint_Now         = round(jsonData.currently.dewPoint,1)
         val_CloudCover_Now         = jsonData.currently.cloudCover*100
         val_TempOutside_Now         = round(jsonData.currently.temperature,1)
         val_TempApparent_Now      = round(jsonData.currently.apparentTemperature,1)
         val_Humidity_Now         = jsonData.currently.humidity*100
         val_Pressure_Now         = jsonData.currently.pressure
         val_Visibility_Now         = round(jsonData.currently.visibility,1)
         val_WindBearing_Now         = jsonData.currently.windBearing
         val_WindGust_Now         = jsonData.currently.windGust*10
         val_WindSpeed_Now         = jsonData.currently.windSpeed*10
         val_PrecipIntensity_Now      = round(jsonData.currently.precipIntensity,1)
         val_PrecipProbability_Now    = round((jsonData.currently.precipProbability*100),1)
         val_TempOutsideMax_Today   = round(jsonData.daily.data[1].temperatureMax,0)
         val_TempOutsideMax_Today1   = round(jsonData.daily.data[2].temperatureMax,0)
         val_TempOutsideMax_Today2   = round(jsonData.daily.data[3].temperatureMax,0)
         val_TempOutsideMax_Today3   = round(jsonData.daily.data[4].temperatureMax,0)
         val_TempOutsideMax_Today4   = round(jsonData.daily.data[5].temperatureMax,0)
         val_TempOutsideMax_Today5   = round(jsonData.daily.data[6].temperatureMax,0)
         val_TempOutsideMin_Today   = round(jsonData.daily.data[1].temperatureMin,0)
         val_TempOutsideMin_Today1   = round(jsonData.daily.data[2].temperatureMin,0)
         val_TempOutsideMin_Today2   = round(jsonData.daily.data[3].temperatureMin,0)
         val_TempOutsideMin_Today3   = round(jsonData.daily.data[4].temperatureMin,0)
         val_TempOutsideMin_Today4   = round(jsonData.daily.data[5].temperatureMin,0)
         val_TempOutsideMin_Today5   = round(jsonData.daily.data[6].temperatureMin,0)
end

--hum_stat can be one of 0=Normal , 1=Comfortable, 2=Dry, 3=Wet
  if val_DewPoint_Now >= 20     then val_HS_Now = "3"     -- wet
  elseif val_DewPoint_Now >= 10 then val_HS_Now = "1"     -- confortable
  else val_HS_Now = "2"     -- dry
  end

--function BarometerForecast
    if val_Pressure_Now == nil          then BaroVS_Now = 5          -- 5 = unknown
        elseif val_Pressure_Now < 966   then BaroVS_Now = 4          -- 4 = thunderstorm
        elseif val_Pressure_Now < 993   then BaroVS_Now = 6          -- 6 = cloudy/rain
        elseif val_Pressure_Now < 1007  then BaroVS_Now = 2          -- 2 = cloudy
        elseif val_Pressure_Now < 1013  then BaroVS_Now = 3          -- 3 = unstable
        elseif val_Pressure_Now < 1033  then BaroVS_Now = 0          -- 0 = stable
        elseif val_Pressure_Now < 1050  then BaroVS_Now = 1          -- 1 = sunny
    end

-- Wind direction calculation
-- local function windDirection_calc(val_WindBearing_Now)
      if (val_WindBearing_Now < 11.25) then val_WindDirection_Now = 'N'
         elseif (val_WindBearing_Now >= 11.25 and val_WindBearing_Now < 33.75) then val_WindDirection_Now = 'NNE'
         elseif (val_WindBearing_Now >= 33.75 and val_WindBearing_Now < 56.25) then val_WindDirection_Now = 'NE'
         elseif (val_WindBearing_Now >= 56.25 and val_WindBearing_Now < 78.75) then val_WindDirection_Now = 'ENE'
         elseif (val_WindBearing_Now >= 78.75 and val_WindBearing_Now < 101.25) then val_WindDirection_Now = 'E'
         elseif (val_WindBearing_Now >= 101.25 and val_WindBearing_Now < 123.75) then val_WindDirection_Now = 'ESE'
         elseif (val_WindBearing_Now >= 123.75 and val_WindBearing_Now < 146.25) then val_WindDirection_Now = 'SE'
         elseif (val_WindBearing_Now >= 146.25 and val_WindBearing_Now < 168.75) then val_WindDirection_Now = 'SSE'
         elseif (val_WindBearing_Now >= 168.75 and val_WindBearing_Now < 191.25) then val_WindDirection_Now = 'S'
         elseif (val_WindBearing_Now >= 191.25 and val_WindBearing_Now < 213.75) then val_WindDirection_Now = 'SSW'
         elseif (val_WindBearing_Now >= 213.75 and val_WindBearing_Now < 236.25) then val_WindDirection_Now = 'SW'
         elseif (val_WindBearing_Now >= 236.25 and val_WindBearing_Now < 258.75) then val_WindDirection_Now = 'WSW'
         elseif (val_WindBearing_Now >= 258.75 and val_WindBearing_Now < 281.25) then val_WindDirection_Now = 'W'
         elseif (val_WindBearing_Now >= 281.25 and val_WindBearing_Now < 303.75) then val_WindDirection_Now = 'WNW'
         elseif (val_WindBearing_Now >= 303.75 and val_WindBearing_Now < 326.25) then val_WindDirection_Now = 'NW'
         elseif (val_WindBearing_Now >= 326.25 and val_WindBearing_Now < 348.75) then val_WindDirection_Now = 'NNW'
         else val_WindDirection_Now = 'N'
      end


      if debug==1 or debug==5 then
         print ("Dauwpunt nu: "..val_DewPoint_Now.." °C")
         print ("Temperatuur buiten nu: "..val_TempOutside_Now.." °C")
         print ("Temperatuur gevoel nu: "..val_TempApparent_Now.." °C")
         print ("Bewolkingsgraad nu: "..val_CloudCover_Now.." %")
         print ("UV-Index nu: "..val_UV_Now)
         print ("Ozone nu: "..val_Ozone_Now)
         print ("Luchtvochtigheid nu: "..val_Humidity_Now.." %")
         print ("Luchtdruk nu: "..val_Pressure_Now.." hPa")
         print ("Zicht nu: "..val_Visibility_Now.." km")
         print ("Windkracht nu: "..(val_WindSpeed_Now/10).. " m/s")
         print ("Windstoten nu: "..(val_WindGust_Now/10).. " m/s")
         print ("Windgraden nu: "..val_WindBearing_Now.. " graden")
         print ("Windrichting nu: "..val_WindDirection_Now)
         print ("Neerslaghoeveelheid nu: "..val_PrecipIntensity_Now.. " mm/u")
         print ("Neerslagkans nu: "..val_PrecipProbability_Now.. " %")
         print ("Temperatuur Max "..DayOfWeek[ (vandaag)+0 ].." : "..val_TempOutsideMax_Today.." °C")
         print ("Temperatuur Max "..DayOfWeek[ (vandaag1) ].." : "..val_TempOutsideMax_Today1.." °C")
         print ("Temperatuur Max "..DayOfWeek[ (vandaag2) ].." : "..val_TempOutsideMax_Today2.." °C")
         print ("Temperatuur Max "..DayOfWeek[ (vandaag3) ].." : "..val_TempOutsideMax_Today3.." °C")
         print ("Temperatuur Max "..DayOfWeek[ (vandaag4) ].." : "..val_TempOutsideMax_Today4.." °C")
         print ("Temperatuur Max "..DayOfWeek[ (vandaag5) ].." : "..val_TempOutsideMax_Today5.." °C")
         print ("Temperatuur Min "..DayOfWeek[ (vandaag)+0 ].." : "..val_TempOutsideMin_Today.." °C")
         print ("Temperatuur Min "..DayOfWeek[ (vandaag1) ].." : "..val_TempOutsideMin_Today1.." °C")
         print ("Temperatuur Min "..DayOfWeek[ (vandaag2) ].." : "..val_TempOutsideMin_Today2.." °C")
         print ("Temperatuur Min "..DayOfWeek[ (vandaag3) ].." : "..val_TempOutsideMin_Today3.." °C")
         print ("Temperatuur Min "..DayOfWeek[ (vandaag4) ].." : "..val_TempOutsideMin_Today4.." °C")
         print ("Temperatuur Min "..DayOfWeek[ (vandaag5) ].." : "..val_TempOutsideMin_Today5.." °C")
      end

----------------------------------------------------------------------------------------------------------------------------------------------
-- ######## Buienradar Verwachting API call (Lang weerbericht ######## --
----------------------------------------------------------------------------------------------------------------------------------------------
    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
   val_WeatherPrediction1_5D   = jsonData.forecast.shortterm.forecast
   val_WeatherPrediction1_5D1   = string.sub(jsonData.forecast.shortterm.startdate,1,10)
   val_WeatherPrediction1_5D2   = string.sub(jsonData.forecast.shortterm.enddate,1,10)
   val_WeatherPrediction6_10D   = jsonData.forecast.longterm.forecast
   val_WeatherPrediction6_10D1   = string.sub(jsonData.forecast.longterm.startdate,1,10)
   val_WeatherPrediction6_10D2   = string.sub(jsonData.forecast.longterm.enddate,1,10)
   val_WeatherPredictionShort   = jsonData.forecast.weatherreport.title .."\n " .."\n ".. jsonData.forecast.weatherreport.summary .."\n " .."\n"
    val_WeatherPredictionLong   = jsonData.forecast.weatherreport.title .."\n " .."\n ".. jsonData.forecast.weatherreport.text .."\n " .."\n"
   val_WeatherPredictionLong   = string.gsub(val_WeatherPredictionLong, "&nbsp;", " ")
   val_WeatherPredictionLong   = string.gsub(val_WeatherPredictionLong, "&rsquo;", "'")
   val_WeatherPredictionLong   = string.gsub(val_WeatherPredictionLong, "&lsquo;", "'")
   val_WeatherPredictionLong   = string.gsub(val_WeatherPredictionLong, "&euml;", "ë")
    val_WeatherPredictionLong   = string.gsub(val_WeatherPredictionLong, "&egrave;", "è")
    val_WeatherPredictionLong   = string.gsub(val_WeatherPredictionLong, "&eacute;", "é")
    val_WeatherPredictionLong   = string.gsub(val_WeatherPredictionLong, "&ecirc;", "ê")
    val_WeatherPredictionLong   = string.gsub(val_WeatherPredictionLong, "&semi;", ";")
    val_WeatherPredictionLong   = string.gsub(val_WeatherPredictionLong, "&ordm;", "º")
   val_WeatherPredictionLong   = string.gsub(val_WeatherPredictionLong, "&iuml;", "ï")
   val_RainChance_Today1      = jsonData.forecast.fivedayforecast[1].rainChance
   val_RainChance_Today2      = jsonData.forecast.fivedayforecast[2].rainChance
   val_RainChance_Today3      = jsonData.forecast.fivedayforecast[3].rainChance
   val_RainChance_Today4      = jsonData.forecast.fivedayforecast[4].rainChance
   val_RainChance_Today5      = jsonData.forecast.fivedayforecast[5].rainChance     
   val_RainIntensityMin_Today1   = jsonData.forecast.fivedayforecast[1].mmRainMin
   val_RainIntensityMin_Today2   = jsonData.forecast.fivedayforecast[2].mmRainMin
   val_RainIntensityMin_Today3   = jsonData.forecast.fivedayforecast[3].mmRainMin
   val_RainIntensityMin_Today4   = jsonData.forecast.fivedayforecast[4].mmRainMin
   val_RainIntensityMin_Today5   = jsonData.forecast.fivedayforecast[5].mmRainMin
   val_RainIntensityMax_Today1   = jsonData.forecast.fivedayforecast[1].mmRainMax
   val_RainIntensityMax_Today2   = jsonData.forecast.fivedayforecast[2].mmRainMax
   val_RainIntensityMax_Today3   = jsonData.forecast.fivedayforecast[3].mmRainMax
   val_RainIntensityMax_Today4   = jsonData.forecast.fivedayforecast[4].mmRainMax
   val_RainIntensityMax_Today5   = jsonData.forecast.fivedayforecast[5].mmRainMax

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_RainMinimumTomorrow     = jsonData.forecast.fivedayforecast[1].mmRainMin
    val_RainMaximumTomorrow     = jsonData.forecast.fivedayforecast[1].mmRainMax
    val_WindDirectionToday      = jsonData.actual.stationmeasurements[ weerstation ].winddirection
    val_WindDirectionToday1      = string.upper(jsonData.forecast.fivedayforecast[1].windDirection)
    val_WindDirectionToday2      = string.upper(jsonData.forecast.fivedayforecast[3].windDirection)
    val_WindDirectionToday3      = string.upper(jsonData.forecast.fivedayforecast[3].windDirection)
    val_WindDirectionToday4      = string.upper(jsonData.forecast.fivedayforecast[4].windDirection)
    val_WindDirectionToday5      = string.upper(jsonData.forecast.fivedayforecast[5].windDirection)
   val_SolarRadiation         = jsonData.actual.stationmeasurements[ weerstation ].sunpower
    val_WindSpeedToday         = jsonData.actual.stationmeasurements[ weerstation ].windspeedBft       
   val_WindSpeedToday1         = jsonData.forecast.fivedayforecast[1].wind
   val_WindSpeedToday2         = jsonData.forecast.fivedayforecast[2].wind
   val_WindSpeedToday3         = jsonData.forecast.fivedayforecast[3].wind
   val_WindSpeedToday4         = jsonData.forecast.fivedayforecast[4].wind
   val_WindSpeedToday5         = jsonData.forecast.fivedayforecast[5].wind
   val_SunChanceToday1         = jsonData.forecast.fivedayforecast[1].sunChance
   val_SunChanceToday2         = jsonData.forecast.fivedayforecast[2].sunChance
   val_SunChanceToday3         = jsonData.forecast.fivedayforecast[3].sunChance
   val_SunChanceToday4         = jsonData.forecast.fivedayforecast[4].sunChance
   val_SunChanceToday5         = jsonData.forecast.fivedayforecast[5].sunChance
end

--Regenhoeveeldheid bepalen
if val_RainIntensityMin_Today1 == val_RainIntensityMax_Today1 then val_RainIntensity_Today1 = val_RainIntensityMin_Today1
    else val_RainIntensity_Today1 = val_RainIntensityMin_Today1.."-"..val_RainIntensityMax_Today1
end

if val_RainIntensityMin_Today2 == val_RainIntensityMax_Today2 then val_RainIntensity_Today2 = val_RainIntensityMin_Today2
    else val_RainIntensity_Today2 = val_RainIntensityMin_Today2.."-"..val_RainIntensityMax_Today2
end

if val_RainIntensityMin_Today3 == val_RainIntensityMax_Today3 then val_RainIntensity_Today3 = val_RainIntensityMin_Today3
    else val_RainIntensity_Today3 = val_RainIntensityMin_Today3.."-"..val_RainIntensityMax_Today3
end

if val_RainIntensityMin_Today4 == val_RainIntensityMax_Today4 then val_RainIntensity_Today4 = val_RainIntensityMin_Today4
    else val_RainIntensity_Today4 = val_RainIntensityMin_Today4.."-"..val_RainIntensityMax_Today4
end

if val_RainIntensityMin_Today5 == val_RainIntensityMax_Today5 then val_RainIntensity_Today5 = val_RainIntensityMin_Today5
    else val_RainIntensity_Today5 = val_RainIntensityMin_Today5.."-"..val_RainIntensityMax_Today5
end

   if debug==2 or debug==5 then
      print ("Uitgebreid weerbericht: "..val_WeatherPredictionLong)
   end

   if debug==2 or debug==5 then
      print ("Temperatuur grond :"..val_TempGround.." °C")
      print ("Weer morgen :"..val_WeatherTomorrow)
      print ("Kans op zon morgen :"..val_SunChanceToday1.." %")
      print ("Kans op regen morgen :"..val_RainChance_Today1.." %")
      print ("Minimum hoeveelheid regen morgen :"..val_RainMinimumTomorrow.." mm")
      print ("Maximum hoeveelheid regen morgen :"..val_RainMaximumTomorrow.." mm")
   end   

-- Windrichting tekst bepalen
if val_WindDirectionToday == "Z" then val_WindDirection_Today = " het zuiden"
    elseif val_WindDirectionToday == "ZW" then val_WindDirection_Today = "het zuidwesten"
    elseif val_WindDirectionToday == "ZO" then val_WindDirection_Today = "het zuidoosten"
    elseif val_WindDirectionToday == "W" then val_WindDirection_Today = "het westen"
    elseif val_WindDirectionToday == "NW" then val_WindDirection_Today = "het noordwesten"
    elseif val_WindDirectionToday == "N" then val_WindDirection_Today = "het noorden"
    elseif val_WindDirectionToday == "NO" then val_WindDirection_Today = " het noordoosten"
    elseif val_WindDirectionToday == "O" then val_WindDirection_Today = "het oosten"
    else val_WindDirection_Today = "variabele richtingen" end

if val_WindDirectionToday1 == "Z" then val_WindDirection_Today1 = " het zuiden"
    elseif val_WindDirectionToday1 == "ZW" then val_WindDirection_Today1 = "het zuidwesten"
    elseif val_WindDirectionToday1 == "ZO" then val_WindDirection_Today1 = "het zuidoosten"
    elseif val_WindDirectionToday1 == "W" then val_WindDirection_Today1 = "het westen"
    elseif val_WindDirectionToday1 == "NW" then val_WindDirection_Today1 = "het noordwesten"
    elseif val_WindDirectionToday1 == "N" then val_WindDirection_Today1 = "het noorden"
    elseif val_WindDirectionToday1 == "NO" then val_WindDirection_Today1 = " het noordoosten"
    elseif val_WindDirectionToday1 == "O" then val_WindDirection_Today1 = "het oosten"
    else val_WindDirection_Today1 = "variabele richtingen" end

if val_WindDirectionToday2 == "Z" then val_WindDirection_Today2 = " het zuiden"
    elseif val_WindDirectionToday2 == "ZW" then val_WindDirection_Today2 = "het zuidwesten"
    elseif val_WindDirectionToday2 == "ZO" then val_WindDirection_Today2 = "het zuidoosten"
    elseif val_WindDirectionToday2 == "W" then val_WindDirection_Today2 = "het westen"
    elseif val_WindDirectionToday2 == "NW" then val_WindDirection_Today2 = "het noordwesten"
    elseif val_WindDirectionToday2 == "N" then val_WindDirection_Today2 = "het noorden"
    elseif val_WindDirectionToday2 == "NO" then val_WindDirection_Today2 = " het noordoosten"
    elseif val_WindDirectionToday2 == "O" then val_WindDirection_Today2 = "het oosten"
    else val_WindDirection_Today2 = "variabele richtingen" end

if val_WindDirectionToday3 == "Z" then val_WindDirection_Today3 = " het zuiden"
    elseif val_WindDirectionToday3 == "ZW" then val_WindDirection_Today3 = "het zuidwesten"
    elseif val_WindDirectionToday3 == "ZO" then val_WindDirection_Today3 = "het zuidoosten"
    elseif val_WindDirectionToday3 == "W" then val_WindDirection_Today3 = "het westen"
    elseif val_WindDirectionToday3 == "NW" then val_WindDirection_Today3 = "het noordwesten"
    elseif val_WindDirectionToday3 == "N" then val_WindDirection_Today3 = "het noorden"
    elseif val_WindDirectionToday3 == "NO" then val_WindDirection_Today3 = " het noordoosten"
    elseif val_WindDirectionToday3 == "O" then val_WindDirection_Today3 = "het oosten"
    else val_WindDirection_Today3 = "variabele richtingen" end

if val_WindDirectionToday4 == "Z" then val_WindDirection_Today4 = " het zuiden"
    elseif val_WindDirectionToday4 == "ZW" then val_WindDirection_Today4 = "het zuidwesten"
    elseif val_WindDirectionToday4 == "ZO" then val_WindDirection_Today4 = "het zuidoosten"
    elseif val_WindDirectionToday4 == "W" then val_WindDirection_Today4 = "het westen"
    elseif val_WindDirectionToday4 == "NW" then val_WindDirection_Today4 = "het noordwesten"
    elseif val_WindDirectionToday4 == "N" then val_WindDirection_Today4 = "het noorden"
    elseif val_WindDirectionToday4 == "NO" then val_WindDirection_Today4 = " het noordoosten"
    elseif val_WindDirectionToday4 == "O" then val_WindDirection_Today4 = "het oosten"
    else val_WindDirection_Today4 = "variabele richtingen" end

if val_WindDirectionToday5 == "Z" then val_WindDirection_Today5 = " het zuiden"
    elseif val_WindDirectionToday5 == "ZW" then val_WindDirection_Today5 = "het zuidwesten"
    elseif val_WindDirectionToday5 == "ZO" then val_WindDirection_Today5 = "het zuidoosten"
    elseif val_WindDirectionToday5 == "W" then val_WindDirection_Today5 = "het westen"
    elseif val_WindDirectionToday5 == "NW" then val_WindDirection_Today5 = "het noordwesten"
    elseif val_WindDirectionToday5 == "N" then val_WindDirection_Today5 = "het noorden"
    elseif val_WindDirectionToday5 == "NO" then val_WindDirection_Today5 = " het noordoosten"
    elseif val_WindDirectionToday5 == "O" then val_WindDirection_Today5 = "het oosten"
    else val_WindDirection_Today5 = "variabele richtingen" end

----------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------ ######## WEER ALERTS ######## -----------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------
if time.min == 0 then  -- script draait ieder uur
    json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux
    local config=assert(io.popen('curl "http://'..webserver_ip..'/meteo-alarm-weather-warnings-1.1/src/warnings.php?country=NL&region=013&time_zone=Europe/Amsterdam"'))
    local Stringjson = config:read('*all')
    config:close()
    local jsonData1 = json:decode(Stringjson)


   if jsonData1.warnings ~= nil then
   -- Convert the json to a LUA table
      val_AlertType_Today            = jsonData1.warnings.regions[1].today[1].awareness.awareness_type.type
      val_AlertLevel_Today         = jsonData1.warnings.regions[1].today[1].awareness.awareness_level.level
      val_AlertColour_Today         = jsonData1.warnings.regions[1].today[1].awareness.awareness_level.colour
      val_AlertColour_Today         = val_AlertColour_Today:gsub("%S+", {["Yellow"] = "GEEL", ["Amber"] = "ORANJE!", ["Red"] = "ROOD!!!", ["Green"] = "groen", ["White"] = "onbekend"})

      if val_AlertLevel_Today ~= 1 then
         val_AlertStarttime_Today   = string.gsub(jsonData1.warnings.regions[1].today[1].period.starttime, "CET", "")
         val_AlertStart_Today      = val_AlertStarttime_Today:gsub("%S+", {["Sunday"] = "zondag", ["Monday"] = "maandag", ["Tuesday"] = "dinsdag", ["Wednesday"] = "woensdag", ["Thursday"] = "donderdag", ["Friday"] = "vrijdag", ["Saturday"] = "zaterdag"})
         val_AlertEndtime_Today      = string.gsub(jsonData1.warnings.regions[1].today[1].period.endtime, "CET", "")
         val_AlertEnd_Today         = val_AlertEndtime_Today:gsub("%S+", {["Sunday"] = "zondag", ["Monday"] = "maandag", ["Tuesday"] = "dinsdag", ["Wednesday"] = "woensdag", ["Thursday"] = "donderdag", ["Friday"] = "vrijdag", ["Saturday"] = "zaterdag"})
         val_AlertText_Today         = string.gsub(jsonData1.warnings.regions[1].today[1].description, "nederlands: ", "")
          val_AlertText_Today         = string.gsub(val_AlertText_Today, "&deg;", "°")
      end

      val_AlertType_Today1         = jsonData1.warnings.regions[1].tomorrow[1].awareness.awareness_type.type
      val_AlertLevel_Today1         = jsonData1.warnings.regions[1].tomorrow[1].awareness.awareness_level.level
      val_AlertColour_Today1         = jsonData1.warnings.regions[1].tomorrow[1].awareness.awareness_level.colour
      val_AlertColour_Today1         = val_AlertColour_Today1:gsub("%S+", {["Yellow"] = "GEEL", ["Amber"] = "ORANJE!", ["Red"] = "ROOD!!!", ["Green"] = "groen", ["White"] = "onbekend"})
      if val_AlertLevel_Today1 ~= 1 then
         val_AlertStarttime_Today1   = string.gsub(jsonData1.warnings.regions[1].tomorrow[1].period.starttime, "CET", "")
         val_AlertStart_Today1       = val_AlertStarttime_Today1:gsub("%S+", {["Sunday"] = "zondag", ["Monday"] = "maandag", ["Tuesday"] = "dinsdag", ["Wednesday"] = "woensdag", ["Thursday"] = "donderdag", ["Friday"] = "vrijdag", ["Saturday"] = "zaterdag"})
         val_AlertEndtime_Today1      = string.gsub(jsonData1.warnings.regions[1].tomorrow[1].period.endtime, "CET", "")
         val_AlertEnd_Today1       = val_AlertEndtime_Today1:gsub("%S+", {["Sunday"] = "zondag", ["Monday"] = "maandag", ["Tuesday"] = "dinsdag", ["Wednesday"] = "woensdag", ["Thursday"] = "donderdag", ["Friday"] = "vrijdag", ["Saturday"] = "zaterdag"})
         val_AlertText_Today1      = string.gsub(jsonData1.warnings.regions[1].tomorrow[1].description, "nederlands: ", "")
          val_AlertText_Today1      = string.gsub(val_AlertText_Today1, "&deg;", "°")
      end
   
      function split(string, delimiter)
         local result = { }
         local from = 1
         local delim_from, delim_to = string.find( string, delimiter, from )
         while delim_from do
         table.insert( result, string.sub( string, from , delim_from-1 ) )
            from = delim_to + 1
            delim_from, delim_to = string.find( string, delimiter, from )
         end
      table.insert( result, string.sub( string, from ) )
      return result
      end

      if val_AlertLevel_Today ~= 1 then
         local myStr = val_AlertText_Today
         val_AlertText_Today = split(myStr, "english")
      end

      if val_AlertLevel_Today1 ~= 1 then
         local myStr = val_AlertText_Today1
         val_AlertText_Today1 = split(myStr, "english")
      end

      if debug==3 or debug==5 then
         print("Alert type vandaag :"..val_AlertType_Today)
         print("Alert level vandaag :"..val_AlertLevel_Today)
         print("Alert kleur vandaag :"..val_AlertColour_Today)
         print("Alert starttijd vandaag :"..val_AlertStart_Today)
         print("Alert eindtijd vandaag :"..val_AlertEnd_Today)
         print("Alert type morgen :"..val_AlertType_Today1)
         print("Alert level morgen :"..val_AlertLevel_Today1)
         print("Alert kleur morgen :"..val_AlertColour_Today1)
         print("Alert starttijd morgen :"..val_AlertStart_Today1)
         print("Alert eindtijd morgen :"..val_AlertEnd_Today1)
      end

      if val_AlertType_Today == 0 then val_AlertTitle_Today = "Geen waarschuwingen"
         elseif val_AlertType_Today == 1 then val_AlertTitle_Today = "Wind waarschuwing"
         elseif val_AlertType_Today == 2 then val_AlertTitle_Today = "Sneeuw/IJzel waarschuwing"
         elseif val_AlertType_Today == 3 then val_AlertTitle_Today = "Onweer waarschuwing"
         elseif val_AlertType_Today == 4 then val_AlertTitle_Today = "Mist waarschuwing"
         elseif val_AlertType_Today == 5 then val_AlertTitle_Today = "Extreem hoge temperatuur waarschuwing"
         elseif val_AlertType_Today == 6 then val_AlertTitle_Today = "Extreem lage temperatuur waarschuwing"
         elseif val_AlertType_Today == 7 then val_AlertTitle_Today = "Kust waarschuwing"
         elseif val_AlertType_Today == 8 then val_AlertTitle_Today = "Bosbrand waarschuwing"
         elseif val_AlertType_Today == 9 then val_AlertTitle_Today = "Lawine waarschuwing"
         elseif val_AlertType_Today == 10 then val_AlertTitle_Today = "Regen waarschuwing"
         elseif val_AlertType_Today == 11 then val_AlertTitle_Today = "Niet beschikbaar"
         elseif val_AlertType_Today == 12 then val_AlertTitle_Today = "Overstroming waarschuwing"
         elseif val_AlertType_Today == 13 then val_AlertTitle_Today = "Regen/Overstroming waarschuwing"   
      end

      if val_AlertType_Today1 == 0 then val_AlertTitle_Today1 = "Geen waarschuwingen"
         elseif val_AlertType_Today1 == 1 then val_AlertTitle_Today1 = "Wind waarschuwing"
         elseif val_AlertType_Today1 == 2 then val_AlertTitle_Today1 = "Sneeuw/IJzel waarschuwing"
         elseif val_AlertType_Today1 == 3 then val_AlertTitle_Today1 = "Onweer waarschuwing"
         elseif val_AlertType_Today1 == 4 then val_AlertTitle_Today1 = "Mist waarschuwing"
         elseif val_AlertType_Today1 == 5 then val_AlertTitle_Today1 = "Extreem hoge temperatuur waarschuwing"
         elseif val_AlertType_Today1 == 6 then val_AlertTitle_Today1 = "Extreem lage temperatuur waarschuwing"
         elseif val_AlertType_Today1 == 7 then val_AlertTitle_Today1 = "Kust waarschuwing"
         elseif val_AlertType_Today1 == 8 then val_AlertTitle_Today1 = "Bosbrand waarschuwing"
         elseif val_AlertType_Today1 == 9 then val_AlertTitle_Today1 = "Lawine waarschuwing"
         elseif val_AlertType_Today1 == 10 then val_AlertTitle_Today1 = "Regen waarschuwing"
         elseif val_AlertType_Today1 == 11 then val_AlertTitle_Today1 = "Niet beschikbaar"
         elseif val_AlertType_Today1 == 12 then val_AlertTitle_Today1 = "Overstroming waarschuwing"
         elseif val_AlertType_Today1 == 13 then val_AlertTitle_Today1 = "Regen/Overstroming waarschuwing"   
      -- 0=White/Unknown, 1=Green/No Warnings, 2=Yellow, 3=Amber, 4=Red
      end
   
   --Weerswaarschuwing
      if val_AlertLevel_Today ~= 1 then
         val_AlertToday = val_AlertTitle_Today.."\n " .."\n"..val_AlertStart_Today.." uur t/m "..val_AlertEnd_Today.." uur \n " .."\n"..val_AlertText_Today[1].."\n "
      else
         val_AlertToday = val_AlertTitle_Today.."\n " .."\nEr zijn vandaag geen waarschuwingen \n\n\n "
      end

      if val_AlertLevel_Today1 ~= 1 then
         val_AlertToday1 = val_AlertTitle_Today1.."\n " .."\n"..val_AlertStart_Today1.." uur t/m "..val_AlertEnd_Today1.." uur \n " .."\n"..val_AlertText_Today1[1].."\n "
      else
         val_AlertToday1 = val_AlertTitle_Today1.."\n " .."\nEr zijn morgen geen waarschuwingen \n\n\n "
      end

      if otherdevices_svalues[dev_AlertToday] ~= val_AlertToday then
         UpdateDev(dev_AlertToday,val_AlertLevel_Today,val_AlertToday)
      end
      if otherdevices_svalues[dev_AlertToday1] ~= val_AlertToday1 then
         UpdateDev(dev_AlertToday1,val_AlertLevel_Today1,val_AlertToday1)
      end
      if debug == 3 or debug==5 then
         print ("Alert volledig vandaag :"..val_AlertToday)
         print ("Alert volledig morgen :"..val_AlertToday1)
      end     

      json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")()  -- For Linux
      local config=assert(io.popen('curl "http://'..domo_ip..'/json.htm?type=devices&rid=25"'))
      local Stringjson = config:read('*all')
      config:close()
      local jsonData = json:decode(Stringjson)

      val_AlertLevelNow = jsonData.result[1].Level
      print(val_AlertLevelNow)

      if val_AlertLevelNow ~= val_AlertLevel_Today then
         commandArray['SendNotification'] = "Code "..val_AlertColour_Today.."\n " .."\n"..val_AlertToday
      end
   
   else print('METEO-ALARM is NIET BEREIKBAAR!!!')
   end
end
----------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------ ######## DOMOTICZ DEVICES UPDATEN ######## -----------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------

-- Komende 24 uur
val_WeatherPrediction24H = val_WeatherTomorrow..  "\n " .."\n".. "Komende nacht daalt de temperatuur naar "..val_TempOutsideMin_Today1.." °C. Morgen overdag wordt morgen maximaal "..val_TempOutsideMax_Today1.. " °C. Er is morgen "..val_SunChanceToday1.." % kans op zon en "..val_RainChance_Today1.." % kans op neerslag ("..val_RainIntensity_Today1.." mm). De wind komt uit "..val_WindDirection_Today1.." en zal kracht "..val_WindSpeedToday1.." Bft hebben." .."\n " .."\n "

stamp1 = val_WeatherPrediction1_5D1
stamp2 = val_WeatherPrediction1_5D2
stamp3 = val_WeatherPrediction6_10D1
stamp4 = val_WeatherPrediction6_10D2
local y1,m1,d1=stamp1:match("(%d+)%-(%d+)%-(%d+)")
local y2,m2,d2=stamp2:match("(%d+)%-(%d+)%-(%d+)")
local y3,m3,d3=stamp3:match("(%d+)%-(%d+)%-(%d+)")
local y4,m4,d4=stamp4:match("(%d+)%-(%d+)%-(%d+)")
local t1={year=y1, month=m1, day=d1}
local t2={year=y2, month=m2, day=d2}
local t3={year=y3, month=m3, day=d3}
local t4={year=y4, month=m4, day=d4}
assert(os.setlocale('nl_NL.UTF-8'))

val_WeatherPrediction1_5D = os.date("%A %d %B",os.time(t1)).." t/m "..os.date("%A %d %B",os.time(t2)).."\n " .."\n"..val_WeatherPrediction1_5D
val_WeatherPrediction6_10D = os.date("%A %d %B",os.time(t3)).." t/m "..os.date("%A %d %B",os.time(t4)).."\n " .."\n"..val_WeatherPrediction6_10D
assert(os.setlocale('en_GB.UTF-8'))

-- 5 Dagen overzicht
val_WeatherPredictionWeekShort1 = DayOfWeek[ (vandaag1) ]..": "..val_TempOutsideMin_Today1.."/"..val_TempOutsideMax_Today1.."°C, "..val_WindDirectionToday1..val_WindSpeedToday1..", ☀️:"..val_SunChanceToday1.."%, ️:"..val_RainChance_Today1.."% ("..val_RainIntensity_Today1.." mm)"
val_WeatherPredictionWeekShort2 = DayOfWeek[ (vandaag2) ]..": "..val_TempOutsideMin_Today2.."/"..val_TempOutsideMax_Today2.."°C, "..val_WindDirectionToday2..val_WindSpeedToday2..", ☀️:"..val_SunChanceToday2.."%, ️:"..val_RainChance_Today2.."% ("..val_RainIntensity_Today2.." mm)"
val_WeatherPredictionWeekShort3 = DayOfWeek[ (vandaag3) ]..": "..val_TempOutsideMin_Today3.."/"..val_TempOutsideMax_Today3.."°C, "..val_WindDirectionToday3..val_WindSpeedToday3..", ☀️:"..val_SunChanceToday3.."%, ️:"..val_RainChance_Today3.."% ("..val_RainIntensity_Today3.." mm)"
val_WeatherPredictionWeekShort4 = DayOfWeek[ (vandaag4) ]..": "..val_TempOutsideMin_Today4.."/"..val_TempOutsideMax_Today4.."°C, "..val_WindDirectionToday4..val_WindSpeedToday4..", ☀️:"..val_SunChanceToday4.."%, ️:"..val_RainChance_Today4.."% ("..val_RainIntensity_Today4.." mm)"
val_WeatherPredictionWeekShort5 = DayOfWeek[ (vandaag5) ]..": "..val_TempOutsideMin_Today5.."/"..val_TempOutsideMax_Today5.."°C, "..val_WindDirectionToday5..val_WindSpeedToday5..", ☀️:"..val_SunChanceToday5.."%, ️:"..val_RainChance_Today5.."% ("..val_RainIntensity_Today5.." mm)"

-- Domoticz devices updaten
    UpdateDev(dev_TempGround,0,val_TempGround)
    UpdateDev(dev_CloudCover_Now,0,val_CloudCover_Now)
    UpdateDev(dev_DewPoint_Now,0,val_DewPoint_Now)
    UpdateDev(dev_UV_Now,0,val_UV_Now..";0")
    UpdateDev(dev_Ozone_Now,0,val_Ozone_Now)
    UpdateDev(dev_TempOutside_Now,0,val_TempOutside_Now)
    UpdateDev(dev_TempApparent_Now,0,val_TempApparent_Now)
    UpdateDev(dev_Humidity_Now,val_Humidity_Now.."|"..val_HS_Now)
   UpdateDev(dev_Pressure_Now,0,val_Pressure_Now..";"..BaroVS_Now)
   UpdateDev(dev_Visibility_Now,0,val_Visibility_Now)
   UpdateDev(dev_SolarRadiation,0,val_SolarRadiation)
   UpdateDev(dev_Wind_Now,0,val_WindBearing_Now..";"..val_WindDirection_Now..";"..val_WindSpeed_Now..";"..val_WindGust_Now..";"..val_TempOutside_Now..";"..val_TempApparent_Now)
   UpdateDev(dev_PrecipIntensity_Now,0,val_PrecipIntensity_Now)
   UpdateDev(dev_PrecipProbability_Now,0,val_PrecipProbability_Now)
   UpdateDev(dev_WeatherPredictionWeekShort,0,'<font face="courier new">'..val_WeatherPredictionWeekShort1.."\n "..val_WeatherPredictionWeekShort2.."\n "..val_WeatherPredictionWeekShort3.."\n "..val_WeatherPredictionWeekShort4.."\n "..val_WeatherPredictionWeekShort5.."</font>")

   if otherdevices_svalues[dev_WeatherPredictionLong] ~= val_WeatherPredictionLong then
      UpdateDev(dev_WeatherPredictionLong,0,val_WeatherPredictionLong)
   end
   if otherdevices_svalues[dev_WeatherPredictionShort] ~= val_WeatherPredictionShort then
      UpdateDev(dev_WeatherPredictionShort,0,val_WeatherPredictionShort)
   end   
   if otherdevices_svalues[dev_WeatherPrediction24H] ~= val_WeatherPrediction24H then
      UpdateDev(dev_WeatherPrediction24H,0,val_WeatherPrediction24H)
   end
   if otherdevices_svalues[dev_WeatherPrediction1_5D] ~= val_WeatherPrediction1_5D then
      UpdateDev(dev_WeatherPrediction1_5D,0,val_WeatherPrediction1_5D)
   end
   if otherdevices_svalues[dev_WeatherPrediction6_10D] ~= val_WeatherPrediction6_10D then
      UpdateDev(dev_WeatherPrediction6_10D,0,val_WeatherPrediction6_10D)
   end
print("Devices zijn geüpdatet")
end
return commandArray
69
In dit artikel leggen we uit hoe je PHP op een Raspberry Pi kunt installeren. Je kunt zelf kiezen uit:

       
  • PHP 7.4
  • PHP 7.3
  • PHP 7.2
  • PHP 7.1
  • PHP 5.6
Geef onderstaande commando's in de terminal in om de huidige packages bij te werken naar de meest recente versie:

sudo apt update
sudo apt upgrade


Voer onderstaande commando's uit om de benodigde packages op de Raspberry Pi te installeren:

sudo apt install ca-certificates apt-transport-https
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list



PHP 7.4 installeren

Geef onderstaande commando's in om PHP 7.4 te installeren:


sudo apt update
sudo apt install php7.4


Installeer ook de benodigde php modules:

sudo apt install php7.4-cli php7.4-common php7.4-curl php7.4-mbstring php7.4-mysql php7.4-xml

Herstart de Raspberry Pi:

sudo reboot



PHP 7.3 installeren

Geef onderstaande commando's in om PHP 7.3 te installeren:

sudo apt update
sudo apt install php7.3


Installeer ook de benodigde php modules:

sudo apt install php7.3-cli php7.3-common php7.3-curl php7.3-mbstring php7.3-mysql php7.3-xml

Herstart de Raspberry Pi:

sudo reboot


PHP 7.2 installeren

Geef onderstaande commando's in om PHP 7.2 te installeren:

sudo apt update
sudo apt install php7.2


Installeer ook de benodigde php modules:

sudo apt install php7.2-cli php7.2-common php7.2-curl php7.2-mbstring php7.2-mysql php7.2-xml

Herstart de Raspberry Pi:

sudo reboot


PHP 7.1 installeren

Geef onderstaande commando's in om PHP 7.1 te installeren:

sudo apt update
sudo apt install php7.1


Installeer ook de benodigde php modules:

sudo apt install php7.1-cli php7.1-common php7.1-curl php7.1-mbstring php7.1-mysql php7.1-xml

Herstart de Raspberry Pi:

sudo reboot


PHP 5.6 installeren

Geef onderstaande commando's in om PHP 5.6 te installeren:

sudo apt update
sudo apt install php5.6


Installeer ook de benodigde php modules:

sudo apt install php5.6-cli php5.6-common php5.6-curl php5.6-mbstring php5.6-mysql php5.6-xml

Herstart de Raspberry Pi:

sudo reboot


PHP.INI aanpassen

Voor alle PHP-versie's is het raadzaam om de execution time en de input time te verhogen:

sudo nano /etc/php/7.3/apache2/php.ini

Wijzig max_execution_time van 30 naar 60 en wijzig max_input_time van 60 naar 120.
70
Software om Domoticz 4.11415 (beta) op een ARM 64-bit machine te installeren, zoals een Cubie or ODroid.
Gebruik voor installatie het commando: curl -sSL install.domoticz.com | sudo bash

Domoticz 4.11415 (ARM 64-bit) - 25-10-2019
71
Software om Domoticz 4.11415 (beta) op een ARM 32-bit machine te installeren, zoals een Raspberry of Cubie.
Gebruik voor installatie het commando: curl -sSL install.domoticz.com | sudo bash

Domoticz 4.11415 (ARM 32-bit) - 25-10-2019
72
Software om Domoticz 4.11414 (beta) op een Windows-machine te installeren.


Domoticz 4.11414 (Windows) - 25-10-2019
73
Domoticz (Linux) / Domoticz 4.11414 (Linux) BETA
25 oktober 2019, 17:16:39
Software om Domoticz 4.11414 (beta) op een Linux-machine te installeren.
Gebruik voor installatie het commando: curl -sSL install.domoticz.com | sudo bash

Domoticz 4.11414 (Linux) - 25-10-2019
74
Onderstaand Bash-script zorgt ervoor dat het gasverbruik, uitgelezen via een P1-meter, wordt geüpload naar MinderGas.nl, zodat je op die website een hele historie (en vergelijking) over jouw gasverbruik kunt bekijken.

Op de 2e regel van het script moet je de API-key invullen, deze kun je zelf aanmaken op https://mindergas.nl/member/api. Op regel 7 moet je het idx-nummer van jouw gasmeter (in Domoticz) zetten (dus 221 vervangen door een ander nummer)


#!/bin/bash

#Token to authenicate with mindergas.nl
TOKEN=xxxxxxxxxxxxxxx

#fetch meterstand (use jq to parse JSON object correctly)
METERSTAND=`curl -s "http://127.0.0.1:8080/json.htm?type=devices&rid=221"  | jq '.result[0].Counter'| tr -d '"'`
 
#Get OS date, and format it corectly.
NOW=$(date +"%Y-%m-%d")

#Build JSON by hand ;-)
JSON='{ "date":"'$NOW'", "reading":"'$METERSTAND'"  }'

#post using curl to API
curl -v -H "Content-Type:application/json" -H "AUTH-TOKEN:$TOKEN" -d "$JSON"  https://www.mindergas.nl/api/gas_meter_readings


Het script sla je op met de naam mindergas.sh en plaats het op de Raspberry. Zorg ervoor dat de bestandsrechten op 755 staan.

Vervolgens maak je met het commando sudo crontab -e een cronjob aan:

58 23 * * * sudo sh /home/pi/domoticz/scriptsjoost/bash/mindergas.sh
75
dzVents / Gasverbruik uploaden naar MinderGas.nl
24 oktober 2019, 19:14:17
Onderstaand dzVents-script zorgt ervoor dat het gasverbruik, uitgelezen via een P1-meter, wordt geüpload naar MinderGas.nl, zodat je op die website een hele historie (en vergelijking) over jouw gasverbruik kunt bekijken.

Op de 2e regel van het script moet je de API-key invullen, deze kun je zelf aanmaken op https://mindergas.nl/member/api. Op regel 24 moet je de naam (of het idx-nummer) van jouw gasmeter (in Domoticz) zetten.


---------------------------------------------------------------------------------------------------------------
local AUTH_TOKEN = 'xxxxxxxxxxxxxx' -- Fill in here your Mindergas authentication token
---------------------------------------------------------------------------------------------------------------

return {
active = true,

on = {
timer = {'at 23:59'},
httpResponses = {'UploadToMindergas'}
},

logging = {
level = domoticz.LOG_DEBUG,
marker = 'Mindergas'
},

execute = function(domoticz, item)

        if item.isTimer then

local GasUsageCounter = domoticz.devices('Gas (P1)').counter
local TodaysDate = tostring(domoticz.time.rawDate)

domoticz.log('The gas usage is ' .. GasUsageCounter, domoticz.LOG_INFO)
domoticz.log('The date is ' .. TodaysDate, domoticz.LOG_INFO )

domoticz.openURL({
url = 'https://www.mindergas.nl/api/gas_meter_readings',
method = 'POST',
headers = {
['Content-Type'] = 'application/json',
['AUTH-TOKEN'] = AUTH_TOKEN
},
callback = 'UploadToMindergas',
postData = {
['date'] = TodaysDate,
['reading'] = GasUsageCounter
},
})

        elseif (item.isHTTPResponse) then
if item.ok then -- self.statusCode >= 200 and self.statusCode <= 299
domoticz.log('Gas usage data is sucessfully upoaded to Mindergas.nl.', domoticz.LOG_INFO)
else
if (item.statusCode == 401) then
domoticz.log('There was an authorisation problem with the Mindergas.nl database.', domoticz.LOG_ERROR)
end
if (item.statusCode == 422) then
domoticz.log('There was an unprocessable enrty while trying to upload the gas usage data to Mindergas.nl', domoticz.LOG_ERROR)
end
domoticz.notify('Domoticz error', 'An error occured while trying to upload the gas usage data to Mindergas.nl', PRIORITY_NORMAL)
end
        end
end
}


Auteur: roblom
76
Software om Domoticz 4.11410 (beta) op een Windows-machine te installeren.


Domoticz 4.11410 (Windows) - 24-10-2019
77
Domoticz (Linux) / Domoticz 4.11410 (Linux) BETA
24 oktober 2019, 18:05:43
Software om Domoticz 4.11410 (beta) op een Linux-machine te installeren.
Gebruik voor installatie het commando: curl -sSL install.domoticz.com | sudo bash

Domoticz 4.11410 (Linux) - 24-10-2019
78
Software om Domoticz 4.11409 (beta) op een ARM 64-bit machine te installeren, zoals een Cubie or ODroid.
Gebruik voor installatie het commando: curl -sSL install.domoticz.com | sudo bash

Domoticz 4.11409 (ARM 64-bit) - 24-10-2019
79
Software om Domoticz 4.11409 (beta) op een ARM 32-bit machine te installeren, zoals een Raspberry of Cubie.
Gebruik voor installatie het commando: curl -sSL install.domoticz.com | sudo bash

Domoticz 4.11409 (ARM 32-bit) - 24-10-2019
80
Software om Domoticz 4.11403 (beta) op een ARM 64-bit machine te installeren, zoals een Cubie or ODroid.
Gebruik voor installatie het commando: curl -sSL install.domoticz.com | sudo bash

Domoticz 4.11403 (ARM 64-bit) - 23-10-2019