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

1
PHP / Buienalarm / Buienradar in Domoticz
26 september 2021, 08:58:45
In dit artikel wordt uitgelegd hoe je gegevens van buienradar in Domoticz kunt krijgen. De alert-sensor (links) geeft de zwaarste neerslag in de komende 2 uren aan. Hierbij wordt onderscheid gemaakt tussen:

Levels:

  • Groen: geen neerslag (0 mm)
  • Groen: lichte neerslag (0.1 – 1 mm)
  • Geel: matige neerslag (1 – 3 mm)
  • Oranje: zware neerslag (3 – 10 mm)
  • Rood: zware buien (> 10 mm)

De intensiteit van de neerslag in mm/h

Het tijdstip van de zwaarste neerslag

De text-sensor (rechts) geeft aan op welke tijden het regent (ongeacht de intensiteit).


Aan te maken virtual devices
  • 1x Alert sensor (naam mag je zelf verzinnen)
  • 1x Text sensor (naam mag je zelf verzinnen)

Aanpassingen script
  • Regel 163: IDX-nummer van je Alert-sensor
  • Regel 168 en 170: IDX-nummer van je Text-sensor

Zelf laat ik het script iedere 5 minuten draaien via een container-script, maar je kunt het natuurlijk ook als cronjob laten draaien.

<?php
include("/home/pi/domoticz/scriptsjoost/php/functions.php");
include(
"/home/pi/domoticz/scriptsjoost/php/settings.php");
 
$time date("H:i");
//set the mm of rain you consider it's raining 
$rainthreshold_minutes "0.1" 
$rainthreshold_hours "0.5" 
// according to buienradar there are 5 levels of rain per hour (mm/h)
// 0-2 
// 2-5
// 5-10
// 10-100
// 100+ 
// these are used in the "severity level" 
 
// $lat = "51.43" ; 
// $lon = "6.04" ; 
 
$json file_get_contents("https://gpsgadget.buienradar.nl/data/raintext?lat=".$lat."&lon=".$lon) ;
$json urlencode($json) ; 
$data explode("%0D%0A",$json) ; 
 
$thishour=$nexthour=$ever 0;
$rainbyminutes =  $bool_rainbyminutes '' 
$first_rain "ik heb geen idee" 
$rain_stops "ik heb geen idee" 
$bool_rainnow $bool_rainthis_hour $bool_rainnext_hour =  'false' 
$rain = array(); 
$maxP 0;
$maxDT '';
for(
$i=0;$i<(count($data)-1);$i++){
$tmp urldecode($data[$i]) ;
    
$tmp2 explode("|",$tmp) ;
$neerslg neerslag($tmp2[0]); 
$bool_neerslg "false" 
 
//check max rain///
if ($neerslg $maxP) {
$maxP $neerslg;
$maxDT $i*5;
}
 
// check if it will rain now
if($i==0){
if($neerslg>=$rainthreshold_minutes){
$bool_rainnow 'true' ;
$bool_neerslg 'true' 
$first_rain 'het regent nu.' ; }
}
else{
if($neerslg>=$rainthreshold_minutes){
$bool_neerslg 'true' ;  
if($first_rain == "ik heb geen idee"){
$first_rain $i*5
}
}
}
$rain[] = $neerslg 
 
if($i<12){ //add the items 0 to 11 together to calculate the total rain for this hour
$thishour+= ($neerslg*10)/10 
$ever += ($neerslg*10)/10 ;} 
else{  //same for the rest to calculate next hour
$nexthour+= ($neerslg*10)/10 
$ever += ($neerslg*10)/10 ; }

$rainbyminutes .= '"'.($i*5).'" : "'.$neerslg.'",' ;
$bool_rainbyminutes .= '"'.($i*5).'" : '.$bool_neerslg.',' ;
 
}
 
$rainbyminutes rtrim($rainbyminutes",") ; 
$bool_rainbyminutes rtrim($bool_rainbyminutes",") ; 
 
if(
$thishour>=$rainthreshold_hours){
$bool_rainthis_hour 'true' 
}
if(
$nexthour>=$rainthreshold_hours){
$bool_rainnext_hour 'true' 
}
//find when it will be dry, first find first occurence of rain
$regen_time '' 
if(
$ever>0){
for($i=0;$i<count($rain);$i++){
$regen $rain[$i]; 
// if found stop
if($regen>0.0){
$regen_time $i ;
break;  }
}
//now find the first occurence after the above one
for($i=$regen_time;$i<count($rain);$i++){
$regen_stop $rain[$i]; 
if($regen_stop==0.0){
$rain_stops $i*5;
break; }
else{
$rain_stops "het duurt minimaal ".($i*5)." minuten, maar dit kan veranderen." ;}
}
}
 
echo 
'"rainnow" : '.$bool_rainnow.','.PHP_EOL
echo 
'"rainthis_hour" : '.$bool_rainthis_hour.','.PHP_EOL
echo 
'"rainnext_hour" : '.$bool_rainnext_hour.','.PHP_EOL
echo 
'"this_hour" : "'.$thishour.'", '.PHP_EOL
echo 
'"next_hour" : "'.$nexthour.'", '.PHP_EOL
echo 
'"severitylevel" : { '.PHP_EOL
echo 
'"this_hour" : "'.calc_rainlevel($thishour).'", '.PHP_EOL
echo 
'"next_hour" : "'.calc_rainlevel($nexthour).'" '.PHP_EOL
echo 
'"whenstart" : "'.$first_rain.'", '.PHP_EOL
echo 
'"whenstop" : "'.$rain_stops.'" '.PHP_EOL
 
function 
neerslag($input){
$tmp = (($input-109)/32)  ; 
$tmp pow(10$tmp)  ; 
$tmp round($tmp,1) ;
 
if($tmp == "0" ){
   return "0.0" ; }
else{
return $tmp
}
}
 
function 
calc_rainlevel($input){
if(($input>=&& $input)){
return ; }
elseif(($input>=&& $input)) {
return ; }
elseif(($input>=&& $input10 )) {
return ; }
elseif(($input>=10 && $input<= 100 )) {
return ; }
else{
return ; }
}
 
//ALERT//
//zware buien > 10
//zware neerslag 3-10 mm
//matige neerslag 1-3 mm
//lichte neerslag 0.1-1 mm
//geen neerslag 0 mm

$maxP round($maxP1);
if (
$maxP 0.1) {
$alertLevel 1;
$alertText 'Geen neerslag komende 2 uur'; }
elseif (
$maxP <= 1) {
$alertLevel 1;
$alertText 'Lichte neerslag ('.$maxP.' mm/h @ '.date('h:i'strtotime($time) + ($maxDT 60)).')';}
elseif (
$maxP <= 3) {
$alertLevel 2;
$alertText 'Matige neerslag ('.$maxP.' mm/h @ '.date('h:i'strtotime($time) + ($maxDT 60)).')';}
elseif (
$maxP <= 10) {
$alertLevel 3;
$alertText 'Zware neerslag ('.$maxP.' mm/h @ '.date('h:i'strtotime($time) + ($maxDT 60)).')';}
elseif (
$maxP 10) {
$alertLevel 4;
$alertText 'Zware buien ('.$maxP.' mm/h @ '.date('h:i'strtotime($time) + ($maxDT 60)).')';
}
UpdateDevice($idx747$alertLevelurlencode($alertText));
 
//TEXT-DEVICE//
if ($maxP 0.1) {
$textdevice $alertText;
Updatedevice($idx7480urlencode($textdevice));}
else { 
$textdevice 'Neerslag begint rond '.date('h:i'strtotime($time) + ($first_rain 60)).' en duurt ongeveer tot '.date('h:i'strtotime($time) + ($rain_stops 60));
Updatedevice($idx7480urlencode($textdevice));
}
echo 
$textdevice;
 
?>

2
PHP / Melding van aardbevingen op je mobiel
24 juli 2021, 08:00:01
Met onderstaand script krijg je op de telefoon meldingen van aardbevingen die door het KNMI geregistreerd zijn.
  • Maak in Domoticz een virtuele text device aan.
  • Pas de regels met "include" aan.
  • Pas de regels tussen BEGIN SETTINGS en END SETTINGS aan.
  • Laat het scripts periodiek via een cronjob draaien.

<?php
include("/home/pi/domoticz/scriptsjoost/php/functions.php");
include(
"/home/pi/domoticz/scriptsjoost/php/settings.php");

// ******* BEGIN SETTINGS *******
$lat '51.447474'// eigen locatie (lattitude)
$lon '5.756383'// eigen locatie (longitude)
$distMax '250'//afstand hemelsbreed in km
$IDX $idx725// idx-nummer gedefinieerd in settings.php
$url $domoticz_url// domoticz_url gedefinieerd in settings.php
$number 5// aantal laatste aardbevingen;
// ******** END SETTINGS ********

$xml 'https://cdn.knmi.nl/knmi/map/page/seismologie/GQuake_KNMI_RSS.xml';
$xml=simplexml_load_file($xml) or die("Error: Cannot create object");

$text ''
for (
$i 0$i <= ($number-1); $i++) {
    
$dist round(distance($lat$lon$xml->channel->item[$i]->children('geo'true)->lat$xml->channel->item[$i]->children('geo'true)->lon),0);
    if (
$dist <= $distMax) {
    
$description $xml->channel->item[$i]->description "<br><br>";
    
$description explode(','$description);
    
$text $text.$description[0].' ('.$description[1].') | '.str_replace('Plaats = ','',$description[6]).' | '.$description[4].' | '.$description[5].' | Afstand: '.$dist' km'.PHP_EOL.PHP_EOL
    }
}

$data $url.'json.htm?type=devices&rid='.$IDX;
if (
false == ($contents file_get_contents($data))) {
      echo 
"Kan geen gegevens ophalen van Domoticz";
} else {
    
$result=json_decode($contents);
$text3=$result->result[0]->Data;
}

if (
$text != $text3) {
Updatedevice($IDX,0,urlencode($text)); // regio
Telegram($text,false,1);
}
?>

3
Onderstaand PHP-script geeft een melding op Telegram indien:

       
  • het zondag 20.00 uur (overzicht van alle Zigbee-devices met batterij
  • een batterij van een Zigbee-devices lager dan 25% is.

<?php
include("/home/pi/domoticz/scriptsjoost/php/functions.php");
include(
"/home/pi/domoticz/scriptsjoost/php/settings.php");

$today date('w');
$time date("H:i");

//PHP cURL GET request
$get_data callAPI('GET''http://127.0.0.1/api/4831A9C634/sensors'false);
$response json_decode($get_datatrue);

// melding batterij < 25%
   
foreach ($response as $device) {
      if (isset(
$device['config']['battery'])) {
         if (((
$device['type']=='ZHAHumidity')) || (($device['type']=='ZHAPresence')) || (($device['type']=='ZHAOpenClose')) || (($device['type']=='ZHALightLevel'))) {   
            
$level $device['config']['battery'];
            if (
$level 25) {
            
Telegram('Batterij van ' $device['name'] . ' is ' $level '%. Tijd voor een nieuwe batterij!',false,1);
            }
         }
      }
   }

// Op zondag 20:00 uur overzicht van alle batterij-percentages
$text1 ''
if ((
$today == 0) && ($time == "20:00")) {
   foreach (
$response as $device) {
      if (isset(
$device['config']['battery'])) {
         if (((
$device['type']=='ZHAHumidity')) || (($device['type']=='ZHAPresence')) || (($device['type']=='ZHAOpenClose')) || (($device['type']=='ZHALightLevel'))) {   

            
$level $device['config']['battery'];
            
$text1 $text1.'battery level ' $device['name'] . ': ' $level '%'.PHP_EOL
            
//Telegram('battery level ' . $device['name'] . ': ' . $level . '%',false,1);
         
}
      }
   }
}
Telegram($text1,false,1);
?>

4
Vergeet je ook wel eens het oud papier op tijd aan de straat te zetten? Met onderstaand PHP-script zal dat niet meer gebeuren.
Bij ons wordt het oud papier op de eerste zaterdag van de maand opgehaald. Is dat bij jou op een andere dag? Vervang dan "first saturday", door iets anders, bijvoorbeeld "third wednesday",  "last monday", "fourth friday", etc.

Het script kun je uit laten voeren door een cronjob, maar ik gebruik zelf een container-script via Domoticz.


<?php
include("/home/pi/domoticz/scripts/php/functions.php");
include(
"/home/pi/domoticz/scripts/php/settings.php");

// Saturday this month
$thisMonthStart mktime(0,0,0,date('m')+0,0,date('Y'));
$saturday date("d.m.Y",strtotime("first saturday"$thisMonthStart ));

//Saturday next month
$nextMonthStart mktime(0,0,0,date('m')+1,1,date('Y'));
$first_saturday date("d.m.Y",strtotime("first saturday"$nextMonthStart));

$tomorrow date("d.m.Y",strtotime("+1 day")); 

if ((
$tomorrow == $saturday) || ($tomorrow == $first_saturday)) {
Telegram("Papier wordt morgenochtend opgehaald!",false,1);
}
?>

5
PHP / Overzicht van alle devices in Domoticz
14 maart 2021, 09:09:55

<?php
include("/home/pi/domoticz/scripts/php/functions.php");
include(
"/home/pi/domoticz/scripts/php/settings.php");

unlink"/home/pi/domoticz/scripts/php/alldevices.txt");

$url $domoticz_url.'json.htm?type=devices';
$contents file_get_contents($url);
$contents=json_decode($contents);

foreach (
$contents->result as $item) {
$naam $item->Name;
$id $item->idx;

$myfile fopen("/home/pi/domoticz/scripts/php/alldevices.txt""a") or die("Unable to open file!");
fwrite($myfile$id.' // '.$naam.PHP_EOL);
fclose($myfile);

}
?>

6

<?php
$domoticz_url
='http://192.168.2.62:8080/'//URL met poortnummer
$toon_ip '192.168.2.59';
$telegrambot1 '645272674:AAGsNuR5l4KHgKcYu60-gY-7O73Z2LFx2A8'; //Telegram Bot 1
$telegrambot2 '1439630098:AAF_5cIii8yqy1g-tyNkiksA3hyhtmsI5JQ'; //Telegram Bot 1
$telegrambot3 '19302673250:AAGhHEe4gYK8HF55DHbTwFIBLQYQo49_uQs'; //Telegram Bot 3
$telegrambot4 '1479652902:AAHAXBjuKTGWCXU4BYtoMjOiSt0dLckNsSw'; //Telegram Bot 4
$telegrambot5 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; //Telegram Bot 5,niet in gebruik
$telegrambot6 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; //Telegram Bot 6,niet in gebruik
$telegrambot7 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; //Telegram Bot 7,niet in gebruik
$telegrambot8 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; //Telegram Bot 8,niet in gebruik
$telegrambot9 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; //Telegram Bot 9,niet in gebruik
$chatID1 '385821761';
$chatID2 = array('385821761','1644279431');
$price_elec_high 0.21098;
$price_elec_low 0.19585;
$price_elec 0.203415;

// Alle Domoticz devices met het IDX-nummer
$idx1=1// ToonBoilerTempSetpoint // Temp // LaCrosse TX3
$idx2=2// ToonBranderInfo // Light/Switch // Selector Switch
$idx4=4// ToonIP // General // Text
$idx5=5// ToonThermostat // Thermostat // SetPoint
$idx6=6// Temperatuur Binnen // Temp // LaCrosse TX3
$idx7=7// Toon Scenes // Light/Switch // Selector Switch
$idx8=8// ToonAutoProgram // Light/Switch // Selector Switch
$idx9=9// ToonProgramInformation // General // Text
$idx10=10// Temperatuur Boiler In // Temp // LaCrosse TX3
$idx11=11// Temperatuur Boiler Uit // Temp // LaCrosse TX3
$idx12=12// Boilerdruk // General // Pressure
$idx13=13// Boiler_Modulation_level // General // Percentage
$idx14=14// Switch Meterkast // Light/Switch // Switch
$idx15=15// Alarm Type Meterkast // Light/Switch // Switch
$idx16=16// Alarm Level Meterkast // Light/Switch // Switch
$idx17=17// Power Management Meterkast // Light/Switch // Switch
$idx18=18// kWh Meter Meterkast // General // kWh
$idx19=19// Watt Meterkast // Usage // Electric
$idx20=20// Voltage Meterkast // General // Voltage
// Etc.
?>

7

<?php 

/* 
----------------------------------------------
---------------- VERSION 1.15 ----------------
-------------- DATE: 10-07-2021---------------
----------------------------------------------
*/

include("/home/pi/domoticz/scriptsjoost/php/settings.php");

// *** FUNCTIONS TO RETRIEVE DATA *** //
// *** FUNCTIONS TO RETRIEVE DATA *** //

//Retrieves status On/Off switch
function Status($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$stat $parsed_json['Status'];
# echo "Status ".$stat."\n";
return $stat;
}

//Retrieves level status
function Level($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$level trim($parsed_json['Level']);
# echo "Status ".$level."\n";
return $level;
}

//Retrieves temperature
function Temperature($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$temp trim($parsed_json['Temp']);
# echo "Status ".$temp."\n";
return $temp;
}

//Retrieves pressure
function Pressure($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$pressure trim($parsed_json['Pressure']);
return $pressure;
}

//Retrieves percentage
function Percentage($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$percentage trim($parsed_json['Data']);
$percentage substr($percentage0, -1);
return $percentage;
}

//Retrieves setpoint
function Setpoint($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$setpoint trim($parsed_json['SetPoint']);
return $setpoint;
}

//Retrieves value from text device
function Text($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$text trim($parsed_json['Data']);
return $text;
}

//Retrieves value from user variable
function Variable($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=command&param=getuservariable&idx='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$value $parsed_json['Value'];
return $value;
}

//Retrieves RainRate
function RainRate($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$rainrate trim($parsed_json['RainRate']);
return $rainrate;
}

//Retrieves Radiation
function Radiation($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$radiation trim($parsed_json['Radiation']);
return $radiation;
}

//Retrieves WindSpeed
function WindSpeed($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$windspeed trim($parsed_json['Speed']);
return $windspeed;
}

//Retrieves WindGust
function WindGust($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$windgust trim($parsed_json['Gust']);
return $windgust;
}

// *** FUNCTIONS TO UPDATE DEVICES *** //
// *** FUNCTIONS TO UPDATE DEVICES *** //

//Switches idx On or Off
function SwitchDevice($idx,$cmd) {
  global 
$domoticz_url;
  
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=switchlight&idx='.$idx.'&switchcmd='.$cmd),true);
  if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
  return 
$reply;
}

//Activates scene
function SwitchScene($idx) {
  global 
$domoticz_url;
  
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=switchscene&idx='.$idx.'&switchcmd=On'),true);
  if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
  return 
$reply;
}

//Sets a dimlevel to a dimmer
function SetLevel($idx,$level) {
  global 
$domoticz_url;
  
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=switchlight&idx='.$idx.'&switchcmd=Set%20Level&level='.$level),true);
  if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
  return 
$reply;
}

// Updates the nvalue and svalue of a device. Setpoint are set this way.
function Updatedevice($idx$nvalue$svalue) {
  global 
$domoticz_url;
  
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=udevice&idx='.$idx.'&nvalue='.$nvalue.'&svalue='.$svalue),true);
  if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
  return 
$reply;
}

// Writes a text to the domoticz logfile
function Domlog($msg) {
  global 
$domoticz_url;
  
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=addlogmessage&message='.$msg),true);
  if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
  return 
$reply;
}

// Switch light
function LightOn($idx,$brightness) {
  global 
$domoticz_url;
  
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=setcolbrightnessvalue&idx='.$idx.'&color={"m":2,"t":154,"r":0,"g":0,"b":0,"cw":101,"ww":154}&brightness='.$brightness),true);
  if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
  return 
$reply;
}

// Switch light
function LightOnAlarm($idx,$brightness) {
  global 
$domoticz_url;
  
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=setcolbrightnessvalue&idx='.$idx.'&color={"m":3,"t":0,"r":255,"g":122,"b":76,"cw":0,"ww":0}&brightness='.$brightness),true);
  if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
  return 
$reply;
}

function 
Past($idx) {
global $domoticz_url;
$json_string file_get_contents($domoticz_url.'json.htm?type=devices&rid='.$idx);
$parsed_json json_decode($json_stringtrue);
$parsed_json $parsed_json['result'][0];
$time $parsed_json['LastUpdate'];
# echo "Status ".$temp."\n";
return $time;
}

function 
UpdateVariable($UserVariableName,$UserVariableType,$UserVariableValue) {
  global 
$domoticz_url;
  
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=updateuservariable&vname='.$UserVariableName.'&vtype='.$UserVariableType.'&vvalue='.$UserVariableValue),true);
  if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
  return 
$reply;
}

// Conbee devices bijwerken
function callAPI($method$url$data){
   
$curl curl_init();
   switch (
$method){
      case 
"POST":
         
curl_setopt($curlCURLOPT_POST1);
         if (
$data)
            
curl_setopt($curlCURLOPT_POSTFIELDS$data);
         break;
      case 
"PUT":
         
curl_setopt($curlCURLOPT_CUSTOMREQUEST"PUT");
         if (
$data)
            
curl_setopt($curlCURLOPT_POSTFIELDS$data);  
         break;
      default:
         if (
$data)
            
$url sprintf("%s?%s"$urlhttp_build_query($data));
   }
   
// OPTIONS:
   
curl_setopt($curlCURLOPT_URL$url);
   
curl_setopt($curlCURLOPT_HTTPHEADER, array(
 
//     'APIKEY: 111111111111111111111',
      
'Content-Type: application/json',
   ));
   
curl_setopt($curlCURLOPT_RETURNTRANSFER1);
   
curl_setopt($curlCURLOPT_HTTPAUTHCURLAUTH_BASIC);
   
// EXECUTE:
   
$result curl_exec($curl);
   if(!
$result){die("Connection Failure");}
   
curl_close($curl);
   return 
$result;
}


// *** FUNCTIONS TO SEND NOTIFICATIONS AND WRITE TO LOG *** //
// *** FUNCTIONS TO SEND NOTIFICATIONS AND WRITE TO LOG *** //

// Send notification to via Settings in Domoticz
function Notification($subject,$thebody) {
   global 
$domoticz_url;
    
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=sendnotification&subject='.$subject.'&body='.$thebody),true);
   if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
   return 
$reply;
}

function 
Telegram($msg,$silent,$to){
global $telegrambot1;
global $telegrambot2;
global $telegrambot3;
global $telegrambot4;
global $telegrambot5;
global $telegrambot6;
global $telegrambot7;
global $telegrambot8;
global $telegrambot9;
global $chatID1;
global $chatID2;
if ($to==1){ //Domoticz bot
$result=json_decode(file_get_contents('https://api.telegram.org/bot'.$telegrambot1.'/sendMessage?chat_id='.$chatID1.'&text='.urlencode($msg).'&disable_notification='.$silent));
}
if ($to==2){ //Zonnepanelen bot
foreach($chatID2 as $chatIDs) {
$result=json_decode(file_get_contents('https://api.telegram.org/bot'.$telegrambot2.'/sendMessage?chat_id='.$chatIDs.'&text='.urlencode($msg).'&disable_notification='.$silent));
}
}
if ($to==3){ //Crimesite
$result=json_decode(file_get_contents('https://api.telegram.org/bot'.$telegrambot3.'/sendMessage?chat_id='.$chatID1.'&text='.urlencode($msg).'&disable_notification='.$silent));
}
if ($to==4){ //Flitsmeldingen
$result=json_decode(file_get_contents('https://api.telegram.org/bot'.$telegrambot4.'/sendMessage?chat_id='.$chatID1.'&text='.urlencode($msg).'&disable_notification='.$silent));
}
if ($to==5){ //Flitsmeldingen
$result=json_decode(file_get_contents('https://api.telegram.org/bot'.$telegrambot5.'/sendMessage?chat_id='.$chatID1.'&text='.urlencode($msg).'&disable_notification='.$silent));
}
if ($to==6){ //Flitsmeldingen
$result=json_decode(file_get_contents('https://api.telegram.org/bot'.$telegrambot6.'/sendMessage?chat_id='.$chatID1.'&text='.urlencode($msg).'&disable_notification='.$silent));
}
if ($to==7){ //Flitsmeldingen
$result=json_decode(file_get_contents('https://api.telegram.org/bot'.$telegrambot7.'/sendMessage?chat_id='.$chatID1.'&text='.urlencode($msg).'&disable_notification='.$silent));
}
if ($to==8){ //Flitsmeldingen
$result=json_decode(file_get_contents('https://api.telegram.org/bot'.$telegrambot8.'/sendMessage?chat_id='.$chatID1.'&text='.urlencode($msg).'&disable_notification='.$silent));
}
if ($to==9){ //Flitsmeldingen
$result=json_decode(file_get_contents('https://api.telegram.org/bot'.$telegrambot9.'/sendMessage?chat_id='.$chatID1.'&text='.urlencode($msg).'&disable_notification='.$silent));
}
}

$LogFile '/tmp/log/domoticz.log';
function 
Logwrite($msg3,$msg2 NULL) {
global $LogFile;
$time    microtime(true);
$dFormat "Y-m-d H:i:s";
$mSecs   =  $time floor($time);
$mSecs   =  substr(number_format($mSecs,3),1);
$fp fopen($LogFile,"a+");
fwrite($fpsprintf("%s%s %s %s\r\n"date($dFormat), $mSecs$msg3$msg2));
fclose($fp);
}

// *** FUNCTIONS MISCELLANEOUS *** //
// *** FUNCTIONS MISCELLANEOUS *** //

function distance($lat1$lon1$lat2$lon2) { 
$pi80 M_PI 180
$lat1 *= $pi80
$lon1 *= $pi80
$lat2 *= $pi80
$lon2 *= $pi80
$r 6372.797// mean radius of Earth in km 
$dlat $lat2 $lat1
$dlon $lon2 $lon1
$a sin($dlat 2) * sin($dlat 2) + cos($lat1) * cos($lat2) * sin($dlon 2) * sin($dlon 2); 
$c atan2(sqrt($a), sqrt($a)); 
$km $r $c
return $km
}

?>

8
Met onderstaand script krijg je de waardes van upload- / downloadsnelheid en ping in Domoticz te zien.

Installeer eerst de python module speedtest-cli op de Synology NAS via de terminal:



sudo wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
sudo chmod +x speedtest-cli


Stappen:

       
  • 3 custom sensors in Domoticz aanmaken, zet de IDX-nummers in onderstaand script
  • Wijzig in het script het IP-adres van de Domoticz-installatie
  • Plaats het script op de Synology NAS (en geef het 755 rechten)
  • Maak op de Synology NAS een terugkerende taak aan (Control Panel > Task Scheduler). Het commando dat uitgevoerd moet worden is sh /volume1/scripts/speedtest/speedtest.sh

#!/bin/bash

#setup
host='192.168.2.62:8080'
#idx for download, upload and ping
idxdl=154
idxul=155
idxpng=156

# speedtest server number
# serverst=xxxx

# no need to edit
# speedtest-cli --simple --server $serverst > outst.txt
/volume1/scripts/speedtest/speedtest-cli --simple > speedtest.txt

download=$(cat speedtest.txt | sed -ne 's/^Download: \([0-9]*\.[0-9]*\).*/\1/p')
upload=$(cat speedtest.txt | sed -ne 's/^Upload: \([0-9]*\.[0-9]*\).*/\1/p')
png=$(cat speedtest.txt | sed -ne 's/^Ping: \([0-9]*\.[0-9]*\).*/\1/p')

# output if you run it manually
echo "Download = $download Mbps"
echo "Upload =  $upload Mbps"
echo "Ping =  $png ms"

# Updating download, upload and ping ..
wget -q --delete-after "http://$host/json.htm?type=command&param=udevice&idx=$idxdl&svalue=$download" >/dev/null 2>&1
wget -q --delete-after "http://$host/json.htm?type=command&param=udevice&idx=$idxul&svalue=$upload" >/dev/null 2>&1
wget -q --delete-after "http://$host/json.htm?type=command&param=udevice&idx=$idxpng&svalue=$png" >/dev/null 2>&1

# Domoticz logging
wget -q --delete-after "http://$host/json.htm?type=command&param=addlogmessage&message=speedtest.net-logging" >/dev/null 2>&1




9
Met onderstaand script krijg je een email als jouw WAN IP wijzigt. Dit script plaats je in een folder op de Synology NAS (wel in het script eventueel de locatie aanpassen). Ook moet je uiteraard het emailadres (recipient) in het script aanpassen.

Voorbereiding:

       
  • Installeren en configureren van Synology Mail Server

#!/bin/bash

fileip='/volume1/scripts/ip-adres/WANIP.txt'
touch $fileip
ip=`wget -q -O - http://ipinfo.io/ip`
previp=`cat $fileip`
recipient='emailadres@outlook.com'
echo $ip > $fileip
if [ "$ip" != "$previp" ]
then
   sendmail -F "Synology Station" -f $recipient -t $recipient << EOF
Subject: IP-adres is gewijzgd
Het publieke IP-adres is gewijzigd.
Je nieuwe IP-adres is nu $ip
Het oude IP-adres was $previp
EOF
fi


Maak vervolgens op de Synology NAS via Control Panel > Task Scheduler een terugkerende taak aan. Het commando dat uitgevoerd moet worden is sh /volume1/scripts/ip-adres/WAN-IP.sh
10
Helaas kun je sinds kort op Darksky geen API-sleutel meer (gratis) krijgen, tijd dus voor een nieuw script dat gegevens gebruikt van Buienradar. Aangezien ik vrijwel geen kennis van PHP heb leek het me leuk om eens te kijken hoe ver ik met PHP zou komen.... Voor zover ik tot nu toe heb kunnen testen werkt alles naar behoren. Ongetwijfeld kunnen veel dingen anders en/of beter, maar dit is de eerste keer dat ik met PHP aan de slag ben gegaan. Mocht er iets niet werken, laat dan een berichtje achter!


Voorbereidingen:

       
  • Installeer PHP op je Raspberry Pi (bij voorkeur versie 7.4)
  • 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!
  • Maak in Domoticz de benodigde devices aan zoals in het script staat (onder // IDX van devices).De namen van de devices kun je naar eigen wens kiezen, het type device moet wel overeenkomen, zoals in het script staat.
  • Wijzig in het script de gegevens onder Settings en onder IDX van devices.
  • Maak een bestand met de naam weer.php aan en kopieer het script erin. Sla het bestand op in de folder /home/pi/domoticz/scripts/php/.
  • Maak een cronjob aan met commando sudo crontab -e en voeg de volgende regel toe: */10 * * * * sudo sh /home/pi/domoticz/scripts/php/weer.php. */10 betekent dat het script iedere 10 minuten uitgevoerd wordt. Uiteraard kun je dat naar wens wijzigen. Ook de locatie en bestandsnaam kun je naar eigen keuze instellen, maar doe dat dan bij beide stappen!
Onderstaande gegevens zal je in Domoticz krijgen:

       
  • Temperatuur buiten
  • Temperatuur gevoel
  • Temperatuur grond
  • Luchtvochtigheid
  • Windrichting
  • Windkracht
  • Windstoten
  • Luchtdruk
  • Zicht
  • Zonkracht
  • Regen (laatste uur)
  • Regen (laatste 24 uur)
  • Weersverwachting kort
  • Weersverwachting uitgebreid
  • Weersverwachting komende 24 uur
  • Weersverwachting 1-5 dagen vooruit
  • Weersverwachting 6-10 dagen vooruit
  • Weer-waarschuwing vandaag (code geel/oranje/rood met tekst)
  • Weer-waarschuwing morgen (code geel/oranje/rood met tekst)
  • Weersverwachting komende 5 dagen ('teletekst-style')
  • Automatische notificatie bij code geel/oranje/rood

<?php


/*
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


Note: Sommige weerstations bevatten niet alle benodigde gegevens, waardoor er fouten kunnen ontstaan in het script. Om te testen kun je weerstation 45 gebruiken.


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
$webserver_ip '192.168.2.63'// Alleen IP
$domoticz_url='http://192.168.2.63:8080/'//URL met poortnummer
$weerstation 45// Zie weerstations
$alerts_country 'NL'// Niet wijzigen
$alerts_region '013'// Zie 'Regio's voor alerts'


// IDX van devices
// Maak in Domoticz de juiste type virtuele sensoren aan en zet hieronder het IDX-nummer neer. De namen van de devices kun je naar eigen keuze kiezen.
$idx1  '25'// Alerts vandaag - Alert sensor
$idx2  '26'// Alerts morgen - Alert sensor
$idx3  '8'// Temperatuur buiten - Temperature sensor
$idx4  '9'// Temperatuur gevoel - Temperature sensor
$idx5  '20'// Temperatuur grond - Temperature sensor
$idx6  '12'// Zicht - Visibility sensor
$idx7  '24'// Zonkracht - Solar Radiation sensor
$idx8  '21'// Weer nu - Text sensor
$idx9  '18'// Weer uitgebreid - Text sensor
$idx10 '22'// Verwachting 1-5 dagen - Text sensor
$idx11 '23'// Verwachting 6-10 dagen - Text sensor
$idx12 '71'// Verwachting week - Text sensor
$idx13 '19'// Komende 24 uur - Text sensor
$idx14 '13'// Wind - Wind sensor
$idx15 '11'// Luchtdruk - Barometer sensor
$idx16 '87'// Regen (afgelopen 24 uur) - Rain sensor
$idx17 '88'// Regen (afgelopen uur) - Rain sensor
$idx18 '10'// Luchtvochtigheid - Humidity sensor




// *** HIERONDER NIETS WIJZIGEN!!!! *** //


$url_1 'https://data.buienradar.nl/2.0/feed/json';
$url_2 'http://'.$webserver_ip.'/meteo-alarm-weather-warnings-1.1/src/warnings.php?country='.$alerts_country.'&region='.$alerts_region.'&time_zone=Europe/Amsterdam';


// Functions


function Weather($idx,$temp) {
   global 
$domoticz_url;
   
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=udevice&idx='.$idx.'&nvalue=0&svalue='.$temp),true);
   if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
   return 
$reply;
}


function 
Barometer($idx,$bar,$bar_for) {
   global 
$domoticz_url;
   
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=udevice&idx='.$idx.'&nvalue=0&svalue='.$bar.';'.$bar_for),true);
   if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
   return 
$reply;
}


function 
Wind($idx,$winddirectiondegrees_now,$winddirection_now,$windspeed_now,$windgusts_now,$temp_now,$tempfeel_now) {
   global 
$domoticz_url;
   
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=udevice&idx='.$idx.'&nvalue=0&svalue='.$winddirectiondegrees_now.';'.$winddirection_now.';'.$windspeed_now.';'.$windgusts_now.';'.$temp_now.';'.$tempfeel_now),true);
   if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
   return 
$reply;
}


function 
Humidity($idx,$hum,$hum_stat) {
   global 
$domoticz_url;
   
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=udevice&idx='.$idx.'&nvalue='.$hum.'&svalue='.$hum_stat),true);
   if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
   return 
$reply;
}


function 
Text($idx,$text) {
   global 
$domoticz_url;
    
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=udevice&idx='.$idx.'&nvalue=0&svalue='.$text),true);
   if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
   return 
$reply;
}


function 
Notification($subject,$thebody) {
   global 
$domoticz_url;
    
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=sendnotification&subject='.$subject.'&body='.$thebody),true);
   if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
   return 
$reply;
}


function 
Rain($idx,$rainrate,$raincounter) {
   global 
$domoticz_url;
    
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=udevice&idx='.$idx.'&nvalue=0&svalue='.$rainrate.';'.$raincounter),true);
   if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
   return 
$reply;
}


function 
Alert($idx,$level,$text) {
   global 
$domoticz_url;
    
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=udevice&idx='.$idx.'&nvalue='.$level.'&svalue='.$text),true);
   if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
   return 
$reply;
}


function 
TempHum($idx,$temp,$hum,$hum_stat) {
   global 
$domoticz_url;
    
$reply=json_decode(file_get_contents($domoticz_url.'json.htm?type=command&param=udevice&idx='.$idx.'&nvalue=0&svalue='.$temp.';'.$hum.';'.$hum_stat),true);
   if(
$reply['status']=='OK'$reply='OK';else $reply='ERROR';
   return 
$reply;
}
// Ophalen gegevens Buienradar
$contents file_get_contents(($url_1),true);
$clima=json_decode($contents);


foreach (
$clima->actual->stationmeasurements as $item) {
   if (
$item->stationid == $weerstation) {
      
$airpressure_now=$item->airpressure;
      
$humidity_now=$item->humidity;
      
$temp_now=$item->temperature;
      
$tempground_now=$item->groundtemperature;
      
$tempfeel_now=$item->feeltemperature;
      
$precipitation_now=$item->precipitation;
      
$rainFallLast24Hour=$item->rainFallLast24Hour;
      
$rainFallLastHour=$item->rainFallLastHour;
      
$sunpower_now=$item->sunpower;
      
$visibility_now=$item->visibility/1000;
      
$weather_now=$item->weatherdescription;
      
$winddirection_now=$item->winddirection;
      
$windgusts_now=$item->windgusts*10;
      
$windspeed_now=$item->windspeed*10;
      
$windspeedBft_now=$item->windspeedBft;
      
$winddirectiondegrees_now=$item->winddirectiondegrees;
   }
}


$weatherreport_summary=$clima->forecast->weatherreport->summary;
$weatherreport_title=$clima->forecast->weatherreport->title;
$weatherreport_text=$clima->forecast->weatherreport->text;
$weatherreport_shortterm=$clima->forecast->shortterm->forecast;
$weatherreport_shortterm_startdate=substr($clima->forecast->shortterm->startdate010);
$weatherreport_shortterm_enddate=substr($clima->forecast->shortterm->enddate010);
$weatherreport_longterm=$clima->forecast->longterm->forecast;
$weatherreport_longterm_startdate=substr($clima->forecast->longterm->startdate010);
$weatherreport_longterm_enddate=substr($clima->forecast->longterm->enddate010);


$temp_min_day1=$clima->forecast->fivedayforecast[0]->mintemperatureMin;
$temp_min_day2=$clima->forecast->fivedayforecast[1]->mintemperatureMin;
$temp_min_day3=$clima->forecast->fivedayforecast[2]->mintemperatureMin;
$temp_min_day4=$clima->forecast->fivedayforecast[3]->mintemperatureMin;
$temp_min_day5=$clima->forecast->fivedayforecast[4]->mintemperatureMin;
$temp_max_day1=$clima->forecast->fivedayforecast[0]->maxtemperatureMax;
$temp_max_day2=$clima->forecast->fivedayforecast[1]->maxtemperatureMax;
$temp_max_day3=$clima->forecast->fivedayforecast[2]->maxtemperatureMax;
$temp_max_day4=$clima->forecast->fivedayforecast[3]->maxtemperatureMax;
$temp_max_day5=$clima->forecast->fivedayforecast[4]->maxtemperatureMax;
$sunchance_day1=$clima->forecast->fivedayforecast[0]->sunChance;
$sunchance_day2=$clima->forecast->fivedayforecast[1]->sunChance;
$sunchance_day3=$clima->forecast->fivedayforecast[2]->sunChance;
$sunchance_day4=$clima->forecast->fivedayforecast[3]->sunChance;
$sunchance_day5=$clima->forecast->fivedayforecast[4]->sunChance;
$rainchance_day1=$clima->forecast->fivedayforecast[0]->rainChance;
$rainchance_day2=$clima->forecast->fivedayforecast[1]->rainChance;
$rainchance_day3=$clima->forecast->fivedayforecast[2]->rainChance;
$rainchance_day4=$clima->forecast->fivedayforecast[3]->rainChance;
$rainchance_day5=$clima->forecast->fivedayforecast[4]->rainChance;
$rainmin_day1=$clima->forecast->fivedayforecast[0]->mmRainMin;
$rainmin_day2=$clima->forecast->fivedayforecast[1]->mmRainMin;
$rainmin_day3=$clima->forecast->fivedayforecast[2]->mmRainMin;
$rainmin_day4=$clima->forecast->fivedayforecast[3]->mmRainMin;
$rainmin_day5=$clima->forecast->fivedayforecast[4]->mmRainMin;
$rainmax_day1=$clima->forecast->fivedayforecast[0]->mmRainMax;
$rainmax_day2=$clima->forecast->fivedayforecast[1]->mmRainMax;
$rainmax_day3=$clima->forecast->fivedayforecast[2]->mmRainMax;
$rainmax_day4=$clima->forecast->fivedayforecast[3]->mmRainMax;
$rainmax_day5=$clima->forecast->fivedayforecast[4]->mmRainMax;
$winddirection_day1=strtoupper($clima->forecast->fivedayforecast[0]->windDirection);
$winddirection_day2=strtoupper($clima->forecast->fivedayforecast[1]->windDirection);
$winddirection_day3=strtoupper($clima->forecast->fivedayforecast[2]->windDirection);
$winddirection_day4=strtoupper($clima->forecast->fivedayforecast[3]->windDirection);
$winddirection_day5=strtoupper($clima->forecast->fivedayforecast[4]->windDirection);
$wind_day1=$clima->forecast->fivedayforecast[0]->wind;
$wind_day2=$clima->forecast->fivedayforecast[1]->wind;
$wind_day3=$clima->forecast->fivedayforecast[2]->wind;
$wind_day4=$clima->forecast->fivedayforecast[3]->wind;
$wind_day5=$clima->forecast->fivedayforecast[4]->wind;


$forecast_day1=date('D',strtotime($clima->forecast->fivedayforecast[0]->day));
$forecast_day1 str_replace(array('Mon''Tue''Wed''Thu''Fri''Sat''Sun'), array('Ma''Di''Wo''Do''Vr''Za''Zo'), $forecast_day1);
$forecast_day2=date('D',strtotime($clima->forecast->fivedayforecast[1]->day));
$forecast_day2 str_replace(array('Mon''Tue''Wed''Thu''Fri''Sat''Sun'), array('Ma''Di''Wo''Do''Vr''Za''Zo'), $forecast_day2);
$forecast_day3=date('D',strtotime($clima->forecast->fivedayforecast[2]->day));
$forecast_day3 str_replace(array('Mon''Tue''Wed''Thu''Fri''Sat''Sun'), array('Ma''Di''Wo''Do''Vr''Za''Zo'), $forecast_day3);
$forecast_day4=date('D',strtotime($clima->forecast->fivedayforecast[3]->day));
$forecast_day4 str_replace(array('Mon''Tue''Wed''Thu''Fri''Sat''Sun'), array('Ma''Di''Wo''Do''Vr''Za''Zo'), $forecast_day4);
$forecast_day5=date('D',strtotime($clima->forecast->fivedayforecast[4]->day));
$forecast_day5 str_replace(array('Mon''Tue''Wed''Thu''Fri''Sat''Sun'), array('Ma''Di''Wo''Do''Vr''Za''Zo'), $forecast_day5);


$weatherdescription_tomorrow=$clima->forecast->fivedayforecast[0]->weatherdescription;


//Barometer
//if ($airpressure_now = nil) {$bar_for = 5;} // 5 = unknow
if ($airpressure_now 966) {$bar_for 4;} // 4 = thunderstorm
if (($airpressure_now 966) && ($airpressure_now 993)) {$bar_for 6;} // 6 = cloudy/rain
if (($airpressure_now 993) && ($airpressure_now 1007)) {$bar_for 2;} // 2 = cloudy
if (($airpressure_now 1007) && ($airpressure_now 1013)) {$bar_for 3;} // 3 = unstable
if (($airpressure_now 1013) && ($airpressure_now 1033)) {$bar_for 0;} // 0 = stable
if (($airpressure_now 1033) && ($airpressure_now 1050)) {$bar_for 1;} // 1= sunny


// Windrichting van Engels naar Nederlands
$winddirection_now str_replace(array('N''O''Z''W'), array('N''E''S''W'), $winddirection_now);


// Weer komende 24 uur
$weather_tomorrow $weatherdescription_tomorrow.'<br><br>Komende nacht daalt de temperatuur naar '.$temp_min_day1.' °C. Morgen overdag wordt morgen maximaal '.$temp_max_day1'°C. Er is morgen '.$sunchance_day1.'% kans op zon en '.$rainchance_day1.'% kans op neerslag ('.$rainmin_day1.'-'.$rainmax_day1.' mm). De wind komt uit het '.$winddirection_day1.' en zal kracht '.$wind_day1.' Bft hebben.<br><br>';


// Vervangen 'vreemde' tekens
$weather_now str_replace(array(">""<""\"""&""%"" "), array("&gt;""&lt;""&quot;""&amp;""%25""%20"), $weather_now);
$weatherreport_title str_replace(array(">""<""\"""&""%"" "), array("&gt;""&lt;""&quot;""&amp;""%25""%20"), $weatherreport_title);
$weatherreport_shortterm str_replace(array(">""<""\"""&""%"" "), array("&gt;""&lt;""&quot;""&amp;""%25""%20"), $weatherreport_shortterm);
$weatherreport_longterm str_replace(array(">""<""\"""&""%"" "), array("&gt;""&lt;""&quot;""&amp;""%25""%20"), $weatherreport_longterm);
$weatherreport_text str_replace(array("&nbsp;"" "), array("%20""%20"), $weatherreport_text);
$weather_tomorrow str_replace(array("\"""&""%"" "), array("&quot;""&amp;""%25""%20"), $weather_tomorrow);


// Week komende 5 dagen
$dag1=$forecast_day1.':%20'.$temp_min_day1.'/'.$temp_max_day1.'°C,%20'.$winddirection_day1.$wind_day1.',%20&#9728;&#65039;'.$sunchance_day1.'%25,%20&#65039;'.$rainchance_day1.'%25%20('.$rainmin_day1.'-'.$rainmax_day1.'%20mm)<br>';
$dag2=$forecast_day2.':%20'.$temp_min_day2.'/'.$temp_max_day2.'°C,%20'.$winddirection_day2.$wind_day2.',%20&#9728;&#65039;'.$sunchance_day2.'%25,%20&#65039;'.$rainchance_day2.'%25%20('.$rainmin_day2.'-'.$rainmax_day2.'%20mm)<br>';
$dag3=$forecast_day3.':%20'.$temp_min_day3.'/'.$temp_max_day3.'°C,%20'.$winddirection_day3.$wind_day3.',%20&#9728;&#65039;'.$sunchance_day3.'%25,%20&#65039;'.$rainchance_day3.'%25%20('.$rainmin_day3.'-'.$rainmax_day3.'%20mm)<br>'
$dag4=$forecast_day4.':%20'.$temp_min_day4.'/'.$temp_max_day4.'°C,%20'.$winddirection_day4.$wind_day4.',%20&#9728;&#65039;'.$sunchance_day4.'%25,%20&#65039;'.$rainchance_day4.'%25%20('.$rainmin_day4.'-'.$rainmax_day4.'%20mm)<br>';
$dag5=$forecast_day5.':%20'.$temp_min_day5.'/'.$temp_max_day5.'°C,%20'.$winddirection_day5.$wind_day5.',%20&#9728;&#65039;'.$sunchance_day5.'%25,%20&#65039;'.$rainchance_day5.'%25%20('.$rainmin_day5.'-'.$rainmax_day5.'%20mm)';


$weer=$dag1.$dag2.$dag3.$dag4.$dag5;
$weer='<font%20face="courier%20new">'.$weer.'</font>';


// WEERALERTS


// Ophalen gegevens
$contents2 file_get_contents(($url_2),true);
$clima2=json_decode($contents2);


// Alert vandaag
$alerttype_today1=$clima2->warnings->regions[0]->today[0]->awareness->awareness_type->type;
$alertlevel_today1=$clima2->warnings->regions[0]->today[0]->awareness->awareness_level->level;
$alertcolour_today1=$clima2->warnings->regions[0]->today[0]->awareness->awareness_level->colour// 0=White/Unknown, 1=Green/No Warnings, 2=Yellow, 3=Amber, 4=Red
$alertcolour_today1=str_replace(array('Yellow''Amber''Red''Green''White'), array('GEEL''ORANJE!''ROOD!!!''groen''onbekend'), $alertcolour_today1);
//if ($alertlevel_today1 != 1) { 
   
$alertstarttime_today1 str_replace('CEST'''$clima2->warnings->regions[0]->today[0]->period->starttime);
   
$alertstart_today1 str_replace(array('Monday''Tuesday''Wednesday''Thursday''Friday''Saturday''Sunday'), array('maandag''dinsdag''woensdag''donderdag''vrijdag''zaterdag''zondag'), $alertstarttime_today1);
   
$alertendtime_today1 =str_replace('CEST'''$clima2->warnings->regions[0]->today[0]->period->endtime);
   
$alertend_today1 str_replace(array('Monday''Tuesday''Wednesday''Thursday''Friday''Saturday''Sunday'), array('maandag''dinsdag''woensdag''donderdag''vrijdag''zaterdag''zondag'), $alertendtime_today1);
   
$alerttext_today1 str_replace('nederlands:  '''$clima2->warnings->regions[0]->today[0]->description);
//}


// Alert morgen
$alerttype_tomorrow1=$clima2->warnings->regions[0]->tomorrow[0]->awareness->awareness_type->type;
$alertlevel_tomorrow1=$clima2->warnings->regions[0]->tomorrow[0]->awareness->awareness_level->level;
$alertcolour_tomorrow1=$clima2->warnings->regions[0]->tomorrow[0]->awareness->awareness_level->colour// 0=White/Unknown, 1=Green/No Warnings, 2=Yellow, 3=Amber, 4=Red
$alertcolour_tomorrow1=str_replace(array('Yellow''Amber''Red''Green''White'), array('GEEL''ORANJE!''ROOD!!!''groen''onbekend'), $alertcolour_tomorrow1);
//if ($alertlevel_tomorrow1 != 1) { 
   
$alertstarttime_tomorrow1 str_replace('CEST'''$clima2->warnings->regions[0]->tomorrow[0]->period->starttime);
   
$alertstart_tomorrow1 str_replace(array('Monday''Tuesday''Wednesday''Thursday''Friday''Saturday''Sunday'), array('maandag''dinsdag''woensdag''donderdag''vrijdag''zaterdag''zondag'), $alertstarttime_tomorrow1);
   
$alertendtime_tomorrow1 =str_replace('CEST'''$clima2->warnings->regions[0]->tomorrow[0]->period->endtime);
   
$alertend_tomorrow1 str_replace(array('Monday''Tuesday''Wednesday''Thursday''Friday''Saturday''Sunday'), array('maandag''dinsdag''woensdag''donderdag''vrijdag''zaterdag''zondag'), $alertendtime_tomorrow1);
   
$alerttext_tomorrow1 str_replace('nederlands:  '''$clima2->warnings->regions[0]->tomorrow[0]->description);
//}


if ($alertlevel_today1 !=1) {
   
$alerttext_today1 explode('english:'$alerttext_today1);
//   echo $alerttext_today1[0]; // engels
//   echo $alerttext_today1[1]; // nederlands
}


if (
$alertlevel_tomorrow1 !=1) {
   
$alerttext_tomorrow1 explode('english:'$alerttext_tomorrow1);
//   echo $alerttext_tomorrow1[0]; // engels
//   echo $alerttext_tomorrow1[1]; // nederlands
}


if (
$alerttype_today1 == 0) {
   
$alerttitle_today1 'Geen waarschuwingen';
} elseif (
$alerttype_today1 == 1) {
   
$alerttitle_today1 'Wind waarschuwing';
} elseif (
$alerttype_today1 == 2) {
   
$alerttitle_today1 'Sneeuw/IJzel waarschuwing';
} elseif (
$alerttype_today1 == 3) {
   
$alerttitle_today1 'Onweer waarschuwing';
} elseif (
$alerttype_today1 == 4) {
   
$alerttitle_today1 'Mist waarschuwing';
} elseif (
$alerttype_today1 == 5) {
   
$alerttitle_today1 'Extreem hoge temperatuur waarschuwing';
} elseif (
$alerttype_today1 == 6) {
   
$alerttitle_today1 'Extreem lage temperatuur waarschuwing';
} elseif (
$alerttype_today1 == 7) {
   
$alerttitle_today1 'Kust waarschuwing';
} elseif (
$alerttype_today1 == 8) {
   
$alerttitle_today1 'Bosbrand waarschuwing';
} elseif (
$alerttype_today1 == 9) {
   
$alerttitle_today1 'Lawine waarschuwing';
} elseif (
$alerttype_today1 == 10) {
   
$alerttitle_today1 'Regen waarschuwing';
} elseif (
$alerttype_today1 == 11) {
   
$alerttitle_today1 'Niet beschikbaar';
} elseif (
$alerttype_today1 == 12) {
   
$alerttitle_today1 'Overstroming waarschuwing';
} elseif (
$alerttype_today1 == 13) {
   
$alerttitle_today1 'Regen/Overstroming waarschuwing';
}


if (
$alerttype_tomorrow1 == 0) {
   
$alerttitle_tomorrow1 'Geen waarschuwingen';
} elseif (
$alerttype_tomorrow1 == 1) {
   
$alerttitle_tomorrow1 'Wind waarschuwing';
} elseif (
$alerttype_tomorrow1 == 2) {
   
$alerttitle_tomorrow1 'Sneeuw/IJzel waarschuwing';
} elseif (
$alerttype_tomorrow1 == 3) {
   
$alerttitle_tomorrow1 'Onweer waarschuwing';
} elseif (
$alerttype_tomorrow1 == 4) {
   
$alerttitle_tomorrow1 'Mist waarschuwing';
} elseif (
$alerttype_tomorrow1 == 5) {
   
$alerttitle_tomorrow1 'Extreem hoge temperatuur waarschuwing';
} elseif (
$alerttype_tomorrow1 == 6) {
   
$alerttitle_tomorrow1 'Extreem lage temperatuur waarschuwing';
} elseif (
$alerttype_tomorrow1 == 7) {
   
$alerttitle_tomorrow1 'Kust waarschuwing';
} elseif (
$alerttype_tomorrow1 == 8) {
   
$alerttitle_tomorrow1 'Bosbrand waarschuwing';
} elseif (
$alerttype_tomorrow1 == 9) {
   
$alerttitle_tomorrow1 'Lawine waarschuwing';
} elseif (
$alerttype_tomorrow1 == 10) {
   
$alerttitle_tomorrow1 'Regen waarschuwing';
} elseif (
$alerttype_tomorrow1 == 11) {
   
$alerttitle_tomorrow1 'Niet beschikbaar';
} elseif (
$alerttype_tomorrow1 == 12) {
   
$alerttitle_tomorrow1 'Overstroming waarschuwing';
} elseif (
$alerttype_tomorrow1 == 13) {
   
$alerttitle_tomorrow1 'Regen/Overstroming waarschuwing';
}


if (
$alertlevel_today1 != 1) {
$alert_today1 urlencode($alerttitle_today1.PHP_EOL.PHP_EOL.$alertstart_today1.' uur t/m '.$alertend_today1.' uur'.PHP_EOL.PHP_EOL.$alerttext_today1[0].PHP_EOL.PHP_EOL);
} else 
$alert_today1 urlencode($alerttitle_today1.PHP_EOL.PHP_EOL.'Er zijn geen waarschuwingen'.PHP_EOL.PHP_EOL.PHP_EOL);


if (
$alertlevel_tomorrow1 != 1) {
$alert_tommorow1 urlencode($alerttitle_tomorrow1.PHP_EOL.PHP_EOL.$alertstart_tomorrow1.' uur t/m '.$alertend_tomorrow1.' uur'.PHP_EOL.PHP_EOL.$alerttext_tomorrow1[0].PHP_EOL.PHP_EOL);
} else 
$alert_tommorow1 urlencode($alerttitle_tomorrow1.PHP_EOL.PHP_EOL.'Er zijn geen waarschuwingen'.PHP_EOL.PHP_EOL.PHP_EOL);


// Devices updaten
TempHum($idx3,$temp_now,$humidity_now,0);
Weather($idx4,$tempfeel_now);
Weather($idx5,$tempground_now);
Weather($idx6,$visibility_now);
Weather($idx7,$sunpower_now);


Text($idx8,$weather_now);
Text($idx9,($weatherreport_title'<br><br>' $weatherreport_text));
Text($idx10,(date('l%20d%20F'strtotime($weatherreport_shortterm_startdate))). '%20t/m%20' . (date('l%20d%20F'strtotime($weatherreport_shortterm_enddate))). '<br><br>' $weatherreport_shortterm);
Text($idx11,(date('l%20d%20F'strtotime($weatherreport_longterm_startdate))). '%20t/m%20' . (date('l%20d%20F'strtotime($weatherreport_longterm_enddate))). '<br><br>' $weatherreport_longterm);
Text($idx12,$weer);
Text($idx13,$weather_tomorrow);


Wind($idx14,$winddirectiondegrees_now,$winddirection_now,$windspeed_now,$windgusts_now,$temp_now,$tempfeel_now);
Barometer($idx15,$airpressure_now,$bar_for);
Rain($idx16,0,$rainFallLastHour); // Todo: nog vervangen door mm/u op dat moment
Rain($idx17,0,$rainFallLastHour); // Todo: nog vervangen door mm/u op dat moment
Humidity($idx18,$humidity_now,0); // Todo: nog vervangen https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's#Humidity


// Notifications versturen
$subject 'WEER-ALERT!';
if (
$alertlevel_today1 != 1) {
   
$thebody urlencode('Code '.$alertcolour_today1.PHP_EOL.PHP_EOL.$alerttitle_today1.PHP_EOL.PHP_EOL.$alertstart_today1.' uur t/m '.$alertend_today1.' uur'.PHP_EOL.PHP_EOL.$alerttext_today1[0]);
} else 
$thebody urlencode('Code '.$alertcolour_today1.PHP_EOL.PHP_EOL.'Er zijn geen waarschuwingen');


$url_3$domoticz_url.'json.htm?type=devices&rid='.$idx1;
$contents3 file_get_contents(($url_3),true);
$clima3=json_decode($contents3);
$alert_now1=urlencode($clima3->result[0]->Data);


if ((
$alert_now1 != urlencode($alerttitle_today1.PHP_EOL.PHP_EOL.$alertstart_today1.' uur t/m '.$alertend_today1.' uur'.PHP_EOL.PHP_EOL.$alerttext_today1[0].PHP_EOL.PHP_EOL)) && ($alert_now1 != urlencode($alerttitle_today1.PHP_EOL.PHP_EOL.'Er zijn geen waarschuwingen'.PHP_EOL.PHP_EOL.PHP_EOL))) {
   
Notification($subject,$thebody);
}


// Devices updaten (alerts)
Alert($idx1,$alertlevel_today1,$alert_today1);
Alert($idx2,$alertlevel_tomorrow1,$alert_tommorow1);


?>
11
Onderstaand dzVents-script zorgt ervoor dat de tuinlampen aan gaan, indien de schuurdeur 's avonds geopend wordt:


return
{
    on =
    {
        devices =
        {
            Schuurdeur =
            {
                'at nighttime',
            },
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'Group switch',
    },

    execute = function(dz, item)
        local tuin = dz.groups('Tuin') -- Change to name of your group
       
        if item.state == 'Alarm' then
            tuin.cancelQueuedCommands()
            tuin.switchOn()
            tuin.switchOff().afterSec(120)
        end
    end
}


Auteur: waaren
12
Software om Domoticz 4.11803 (beta) op een ARM 64-bit machine te installeren, zoals een Cubie or ODroid.


Domoticz 4.11803 (ARM 64-bit) - 21-03-2020
13
Software om Domoticz 4.11803 (beta) op een ARM 32-bit machine te installeren, zoals een Raspberry of Cubie.


Domoticz 4.11803 (ARM 32-bit) - 21-03-2020
14
Software om Domoticz 4.11804 (beta) op een Windows-machine te installeren.


Domoticz 4.11804 (Windows) - 21-03-2020
15
Software om Domoticz 4.11804 (beta) op een Linux-machine te installeren.


Domoticz 4.11804 (Linux) - 21-03-2020
16
Onderstaand dzVents-script geeft je een waarschuwing als er iets fout is met de (Domoticz) sqlite database. Je ontvangt een push-notificatie en/of een email.


--[[ -- DB check
       
        Will give you a warning when something is wrong with the (domoticz) sqlite database
        requires sqlite3
            install command on linux:    sudo apt install sqlite3
            install command on openwrt:  opkg install sqlite3-cli
            install command on synology: sudo /opt/bin/opkg install sqlite3-cli
           
            History:
            20190125: first public release 
            20190228: Include official sqlite3 error messages on failure
            20190808: Include optional trigger of follow up OS command
            20191005: add Telegram as notification option
            20191005: Include optional set of an Alert device with result of check         
            20191019: Include RC message in alert device
            20200108; Fixed bug(ss) in aftersucces / afterSuccess (case matters and double s also ! )

]]--
return {
            on =    { 
                        timer   =   {
                                        "at 20:07",             -- change to a time that suits you
                                        "at 10:07",
                                    },           
                    },
   
        logging =   { 
                        level     =   domoticz.LOG_DEBUG,       -- change to LOG_ERROR after you tested  the script
                        marker    =   "DB check"
                    },

    execute = function(dz)
        -- =======================  Settings below this line =================
        local email               = true                        -- set to false if you don't want an Email when something wrong with database
        local notify              = true                        -- set to false if you don't want a notification when something wrong with database
        local afterSuccessCommand = '/bashdir/copyDB.sh'        -- set to full qualified path of your followUp script or false if you don't need a followUp after success
        local afterFailCommand    = false                       -- set to full qualified path of your followUp script or false if you don't need a followUp after fail
     
        local followUpAfterFail   = false                       -- set to false if you don't need a followUpAfterFail
       
        local alert = {
                        active   = false,                             -- set to false if you don't want an Alert device set.
                        device   = "dbCheck result",                 -- Name of your alert device (only needed when you set active = true )
                        failText = "Problem in database",
                        OKText   = "Database OK",   
                      }
                     
        local subject             = "Domoticz database check"   -- Free text
        local emailaddress        = "yourName@gmail.com"        -- Your Email address
        local path                = "/home/pi/domoticz/"            -- full qualified path to your database
        local database            = "domoticz.db"               -- database filename + extension
        -- local database         = "corrupt.db"                -- test database filename + extension
                                                                    -- you can corrupt a test database by just load it in an editor
                                                                    -- and remove a couple of bytes
        local sqlite              = "/usr/bin/sqlite3"          -- location of your sqlite3 tool (use the command 'which sqlite3' to find location)
 
        local myNotificationTable     =     {
                                             -- table with one or more notification systems.
                                             -- uncomment the notification systems that you want to be used
                                             -- Can be one or more of
                                             
                                             dz.NSS_GOOGLE_CLOUD_MESSAGING,
                                             -- dz.NSS_HTTP,
                                             -- dz.NSS_KODI,
                                             -- dz.NSS_LOGITECH_MEDIASERVER,
                                             -- dz.NSS_NMA,
                                             -- dz.NSS_PROWL,
                                             -- dz.NSS_PUSHALOT,
                                             -- dz.NSS_PUSHBULLET,
                                             dz.NSS_PUSHOVER,
                                             -- dz.NSS_PUSHSAFER,
                                             dz.NSS_TELEGRAM,
                                            }
        -- =======================  No modification needed below this line ==================

         local function logWrite(str,level)             -- Support function for shorthand debug log statements
            dz.log(tostring(str),level or dz.LOG_DEBUG)
        end
   
        local space                   = " "
        local baseCommand             = "sudo" .. space .. sqlite .. space .. path .. database .. space
        local checks                  = {}
              checks                  = {
                                                  "\'select count(id) from deviceStatus;\'",
                                                   "\'.schema\'",
                                                  "\'pragma integrity_check;\'",
                                                  "\'pragma foreign_key_check;\'",
                                        }

        local function rc2Text(rc)
            local errorMessages =   {
                                          [0] = "Database OK",
                                          [1] = "Generic error",
                                          [2] = "Internal logic error in SQLite",
                                          [3] = "Access permission denied",
                                          [4] = "Callback routine requested an abort",
                                          [5] = "The database file is locked",
                                          [6] = "A table in the database is locked",
                                          [7] = "Memory allocation failed",
                                          [8] = "Attempt to write a readonly database",
                                          [9] = "Operation terminated by sqlite3_interrupt",
                                         [10] = "Some kind of disk I/O error occurred",
                                         [11] = "The database disk image is malformed",
                                         [12] = "Unknown opcode in sqlite3_file_control",
                                         [13] = "Insertion failed because database is full",
                                         [14] = "Unable to open the database file",
                                         [15] = "Database lock protocol error",
                                         [16] = "Internal use only",
                                         [17] = "The database schema changed",
                                         [18] = "String or BLOB exceeds size limit",
                                         [19] = "Abort due to constraint violation",
                                         [20] = "Data type mismatch",
                                         [21] = "Library used incorrectly",
                                         [22] = "Uses OS features not supported on host",
                                         [23] = "Authorization denied",
                                         [24] = "Not used",
                                         [25] = "2nd parameter to sqlite3_bind out of range",
                                         [26] = "File opened that is not a database file",
                                     }
            return(errorMessages[rc] or "Unknown error")
        end

        local function followUp(cmd)
            os.execute('sudo ' .. cmd ..' &')
        end

        local function osExecute(base,check)
            local fileHandle     = assert(io.popen(base .. check, 'r'))
            local commandOutput  = assert(fileHandle:read('*a'))
            local returnTable    = {fileHandle:close()}
            check = check:gsub("'","") .." result ==>> " ..  ( returnTable[3] ~= 0 and "Failed: " .. rc2Text(returnTable[3]) .. commandOutput .. " (".. returnTable[3] .. ")" or true and "OK" )
            logWrite("Command " .. check )
            return check,returnTable[3]            -- rc[3] contains returnCode
        end

        local function checkDatabase()
            if dz.utils.fileExists(path .. database) then
                if dz.utils.fileExists(sqlite) then
                    for _,check in ipairs (checks) do
                        local result,rc = osExecute(baseCommand,check)
                        if rc ~= 0 then
                            return rc, result 
                        end
                    end
                else
                    return -1,"sqlite3 not installed"
                end
            else
                return -1,"Wrong path to database"
            end
            return 0
        end

        local function updateAlert(rc)
            if alert and alert.active then
                local now = dz.time.rawDate .. ', ' .. dz.time.rawTime .. ': '
                local alertLevel = dz.ALERTLEVEL_RED
                if rc == 0 then  alertLevel = dz.ALERTLEVEL_GREEN end
                dz.devices(alert.device).updateAlertSensor(alertLevel, now .. rc2Text(rc))
            end
        end

        -- main program
        local rc, result = checkDatabase()
        if rc ~= 0 then
            logWrite(result,dz.LOG_ERROR)
            if email then dz.email(subject,result,emailaddress) end
            if notify then
                dz.notify(subject, result or "Dbase check encountered unknown error", dz.PRIORITY_NORMAL, dz.SOUND_INTERMISSION,"",  myNotificationTable )
            end
            if afterFailCommand and ( rc > 0 ) then followUp(afterFailCommand) end
        else
            if afterSuccessCommand then followUp(afterSuccessCommand) end
        end
        updateAlert(rc)
    end
}


Auteur: leecollings
17
Software om Domoticz 4.11590 (beta) op een ARM 64-bit machine te installeren, zoals een Cubie or ODroid.


Domoticz 4.11590 (ARM 64-bit) - 21-12-2019
18
Software om Domoticz 4.11590 (beta) op een ARM 32-bit machine te installeren, zoals een Raspberry of Cubie.


Domoticz 4.11590 (ARM 32-bit) - 21-12-2019
19
Software om Domoticz 4.11590 (beta) op een Windows-machine te installeren.


Domoticz 4.11590 (Windows) - 21-12-2019
20
Domoticz (Linux) / Domoticz 4.11587 (Linux) BETA
21 december 2019, 14:17:21
Software om Domoticz 4.11587 (beta) op een Linux-machine te installeren.


Domoticz 4.11587 (Linux) - 21-12-2019