Re: Pass2PHP
Posted: Saturday 13 July 2019 14:14
sl = set level.
So that is:
sl('Dimmer', 50);
So that is:
sl('Dimmer', 50);
Code: Select all
<?php
if($status=='On'&&TIME>=strtotime('T20:00')){
sl('Badkamer', 30, true);
}
Code: Select all
if ($d['Badkamer']['s']>='1'&&$d['Auto']['s']=='Off'&&$d['PIR_Badkamer']['s']=='Off'&&past('Badkamer')>60) {
sl('Badkamer', 0);
}
Code: Select all
if ($d['Badkamer']['s']>='1'&&$d['Auto']['s']=='Off'&&$d['PIR_Badkamer']['s']=='Off'&&past('Badkamer')>60) {
sl('Badkamer', 0);
}
Code: Select all
if ($d['Badkamer']['s']>=1&&$d['Auto']['s']=='Off'&&$d['PIR_Badkamer']['s']=='Off'&&past('Badkamer')>60) {
sl('Badkamer', 0);
}
I can't seem to get my head around it.
Code: Select all
<?php
if($status=='On'/*&&TIME<=strtotime('T08:00')&&TIME>=strtotime('T19:00')*/){
sl('Badkamer', 30, true);
}
Elseif($status=='On'&&TIME>=strtotime('T08:00')&&TIME<=strtotime('T19:00')){
sl('Badkamer', 90, true);
}
Code: Select all
if ($d['Badkamer']['s']>=1&&$d['PIR_Badkamer']['s']=='Off'&&past('Badkamer')>60) {
sl('Badkamer', 0);
}
Code: Select all
lg('Badkamer='.$d['Badkamer']['s'].', PIR='.$d['PIR_Badkamer']['s'].', past='.past('Badkamer'));
ive added the lg function which works good and it gives me the values as expected but the cron doesnt work(for the others it works ok though)
Code: Select all
if ($d[$device]['dt']=='dimmer'||$d[$device]['dt']=='rollers'||$d[$device]['dt']=='luifel') {
if ($status=='Off'||$status=='Open') {
$status=0;
} elseif ($status=='On'||$status=='Closed') {
$status=100;
} else {
$status=filter_var($status, FILTER_SANITIZE_NUMBER_INT);
}
}
Code: Select all
if ($d['Badkamer']['s']>'1'/*&&$d['PIR_Badkamer']['s']=='Off'*/&&past('Badkamer')>60){
sl('Badkamer', 20);
}
the code of the pass2php.php file is as following(You mean this file right?:
Code: Select all
<?php
/**
* Pass2PHP
* php version 7.3.3-1
*
* @category Home_Automation
* @package Pass2PHP
* @author Guy Verschuere <[email protected]>
* @license GNU GPLv3
* @link https://egregius.be
**/
require '/var/www/config.php';
require 'functions.php';
$device=$_REQUEST['d'];
$status=$_REQUEST['s'];
$username='Domoticz';
if (endswith($device, '_Temperature')) {
die('Nothing to do');
} elseif (endswith($device, '_Utility')) {
die('Nothing to do');
}
if (in_array(
$device, array(
'PIR-Bijkeuken',
'zithoek',
'kamer',
'tobi',
'alex',
'terras',
'lichtbadkamer',
'Xvol',
'Rliving',
'Rbureel',
'RkeukenL',
'RkeukenR',
'RkamerL',
'RkamerR',
'Rtobi',
'Ralex',
'luifel'
)
)
) {
if ($status=='Off'||$status=='Open') {
store($device, 0);
} elseif ($status=='On'||$status=='Closed') {
store($device, 100);
} else {
$status=filter_var($status, FILTER_SANITIZE_NUMBER_INT);
store($device, $status);
}
} elseif (in_array($device, array('badkamer_temp'))) {
$status=explode(';', $status);
$status=$status[0];
store($device, $status);
} elseif ($device=='achterdeur') {
if ($status=='Open') {
$status='Closed';
} else {
$status='Open';
}
store($device, $status);
} else {
store($device, $status);
}
lgsql('Domoticz',$device,$status);
lg($device.' = '.$status);
@include 'pass2php/'.$device.'.php';
Code: Select all
$device, array(
'PIR-Bijkeuken',
'zithoek',
'kamer',
'tobi',
'alex',
'terras',
'lichtbadkamer',
'Xvol',
'Rliving',
'Rbureel',
'RkeukenL',
'RkeukenR',
'RkamerL',
'RkamerR',
'Rtobi',
'Ralex',
'luifel'
)
Code: Select all
elseif (in_array($device, array('badkamer_temp'))) {
$status=explode(';', $status);
$status=$status[0];
store($device, $status);
}
I only see a reference to php 7.0 based on the pass2php topic. Is there another topic or a link to share?Egregius wrote:I didn't wrote the last php version, but the last pass2php version.
That's always on my Github.
Of course I can enter all the device in the array but I would rather have the latest PHP version. I checked your github pageEgregius wrote:Please read my previous reply carefully.