PHP Floorplan 2.0 for Domoticz

Update of PHP Floorplan for Domoticz and PHP Floorplan for Domoticz Extra screenshots I’ve been busy lately optimizing the code so it has a very small footprint on data traffic. I managed to optimize the code in a way that each pageview only requires 2.3KB instead of the 41KB before. Most of that is achieved by moving the …
View

LUA Pass2PHP v2.2 minimal script

<?php error_reporting(E_ALL); ini_set(“display_errors”,”on”); date_default_timezone_set(‘Europe/Brussels’); define(‘time’,$_SERVER[‘REQUEST_TIME’]); $c=json_decode(base64_decode($_REQUEST[‘c’]),true); $s=json_decode(base64_decode($_REQUEST[‘s’]),true); $i=json_decode(base64_decode($_REQUEST[‘i’]),true); $t=json_decode(base64_decode($_REQUEST[‘t’]),true); $r=str_replace(” “,”_”,key($c)); if(function_exists(key($c))) key($c)(); elseif(function_exists($r)) $r(); //START USER FUNCTIONS function pirhall() { global $s,$i,$t; if($s[‘pirhall’==”On”]) { if($s[‘lighthall’]==’Off’) sw($i[‘hall’],’On’,’hall by pir’,1000); } } //END USERFUNCTIONS. Only change IP:PORT and ios,sms account details below function sw($idx,$action=””,$info=””,$Usleep=600000) { lg(“SWITCH “.$action.” “.$info); if(empty($action)) curl(“http://127.0.0.1:8084/json.htm?type=command&param=switchlight&idx=”.$idx.”&switchcmd=Toggle”); else curl(“http://127.0.0.1:8084/json.htm?type=command&param=switchlight&idx=”.$idx.”&switchcmd=”.$action); usleep($Usleep); } function sl($idx,$level,$info=””,$Usleep=600000) …
View

LUA Pass2PHP v2.2 complete script

Another update for my Pass2PHP script. This time a great difference in setup. The $events array isn’t used anymore. Instead each update instantly executes the function with his name, if the function exists of course. Spaces can’t be used in function names, therefor they need to be replaced by underscores. In the $s, $i and …
View

LUA Pass2PHP v2.1 minimal script

Please read the information on LUA Pass2PHP v2.1 complete script for information about new stuff in 2.1 This script only contains the minimal stuff to get you started. In this example a PIR with idx 123 will switch a light on. <?php $c=json_decode(base64_decode($_REQUEST[‘c’]),true); $s=json_decode(base64_decode($_REQUEST[‘s’]),true); $i=json_decode(base64_decode($_REQUEST[‘i’]),true); $t=json_decode(base64_decode($_REQUEST[‘t’]),true); $a=$s[key($c)];$devidx=$i[key($c)]; $events=array( 123=>’pirhall’ ); if(isset($events[$devidx]))$events[$devidx](); //START USERFUNCTIONS function pirhall(){ global $a,$s,$i,$t; …
View

LUA Pass2PHP v2.1 complete script

Make sure you also read the other posts about pass2php on https://egregius.be/tag/domoticz/ as they contain more information on how to implement this. the script_device_pass2php.lua script has basically stayd the same: JSON=loadfile(‘/volume1/@appstore/domoticz/var/scripts/JSON.lua’)() base64=loadfile(‘/volume1/@appstore/domoticz/var/scripts/base64.lua’)() c=base64.encode(JSON:encode(devicechanged)) s=base64.encode(JSON:encode(otherdevices)) i=base64.encode(JSON:encode(otherdevices_idx)) t=base64.encode(JSON:encode(otherdevices_lastupdate)) os.execute(‘curl -s –data “c=’..c..’&s=’..s..’&i=’..i..’&t=’..t..'” http://127.0.0.1/secure/pass2php.php &’) commandArray={} return commandArray In the PHP file some changes are made in my own function. …
View

LUA Pass2PHP v2.0 Small example and explanation

Based on the script LUA Pass2PHP v2.0 a small example: 2 pirs in this script. They have idx 123 and idx 234. In the $events array we define wich function is called when this $idx is the changed device. Have a look at LUA Pass2PHP v2.0 for many more examples and conditional switching. Some explanation …
View

LUA Pass2PHP v2.0

Vervolg op LUA Pass2php In grote lijnen dezelfde werkwijze als de vorige versie, vooral de functies zijn een groot stuk eenvoudiger geworden waardoor de code wat overzichtelijker en makkelijker te gebruiken is. Download deze 2 bestanden en plaats ze in de Domoticz scripts folder: JSON.lua ee5_base64.lua Maak in Domoticz Events een device lua script, pas eventueel …
View

Fail2Ban on Synology DSM6

Fail2ban is a daemon that watches logfiles for errors using a regex expression. If errors are found actions are done. The most common action is blocking the source ip in firewall, or even higher using ‘ip route’. Since there isn’t much information available regarding running fail2ban on Synology DSM 6 it took some time to …
View

Speeding up things: Cache variables

I can say that I am quite addicted to speed, especially when it comes to websites and web applications. Speed is everything. I tent to search and squeeze to the last millisecond. Sometimes we assume that packages that are taken for granted just are the fastest, but are they really? Let’s do some tests and …
View

SBFSpot 2 Domoticz

Lezers die SBFspot en Domoticz gebruiken zullen wellicht wel weten dat SBFspot als native hardware kan toegevoegd worden. Maar wat als je het niet wil op die manier? Of enkel maar het huidige vermogen wil? Of SBFspot niet op dezelfde computer staat als Domoticz? Voor al dat heb ik deze oplossing bedacht: #!/bin/bash string=$(tail -1 …
View

Synology Diskstation auto-shutdown

Ik gebruikte al jaren ‘advanced power management’ op de Synology Nas zodat die automatisch zou uitschakelen, als er niks te doen is tenminste. Sinds de installatie van DSM6.0 Beta werkte die plugin niet meer en bleef de nas dus 24/7 online. Uiteindelijk maar zelf aan de slag gegaan, wou eigenlijk toch al een tijd dat …
View

PHP Floorplan for Domoticz Extra screenshots

De ontwikkeling van mijn floorplan, vooral dan het cron gedeelte is onverminderd verder gegaan. Het systeem werd uitgebreid met koppelingen naar de Synology Nas, een camera met bewegingsdetectie werd toegevoegd en de interface kreeg hier en daar wel wat aanpassingen. De code is te vinden op Github: https://github.com/Egregius/PHP-Custom-Floorplan-for-Domoticz Enkele screenshots: