Pass2PHP
Moderator: leecollings
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
Upgrade finished, had some trouble with getting statusses from other devices as i needed to re-write them as you told.
only thing that does not work is my screens
i get azimuth of the sun by running a script (dzvents) grabbing from darkcloud and updating a general custom sensortype every 5 minutes. it seems like pass2php does not see the update every 5 min so it does not do anything with the sensor.
maybe i'l do the execution in cron instead of in the custom sensortype php file.
only thing that does not work is my screens
i get azimuth of the sun by running a script (dzvents) grabbing from darkcloud and updating a general custom sensortype every 5 minutes. it seems like pass2php does not see the update every 5 min so it does not do anything with the sensor.
maybe i'l do the execution in cron instead of in the custom sensortype php file.
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
Installation on debian stretch:
New version 04/2019
With my sql:
wget http://repo.mysql.com/mysql-apt-config_0.8.9-1_all.deb
dpkg -i mysql-apt-config_0.8.9-1_all.deb
apt update
apt install mysql-server
mysql_secure_installation
Root password: domoticz
mysql -u root -p
Create user:
GRANT ALL PRIVILEGES ON *.* TO 'domotica'@'localhost' IDENTIFIED BY 'domotica';
Create db
CREATE DATABASE domotica;
Restore database
mysql -u domotica -p domotica < Create-Update SQL Database.txt
Install phpmyadmin
apt-get install phpmyadmin
Domoticz
Copy config.php to \var\www\
Copy all scripts to the correct location \var\www\html\
Adjust the _fetchdomoticz.php script:
require '/var/www/config.php';
require 'functions.php';
$domoticzurl='http://127.0.0.1:8080';
Set the correct rights in the log files
Chown www-data:www-data /var/log/domoticz.txt for example
Browse to the _fecthcomoticz.php script and look in the db if the idx is added
New version 04/2019
With my sql:
wget http://repo.mysql.com/mysql-apt-config_0.8.9-1_all.deb
dpkg -i mysql-apt-config_0.8.9-1_all.deb
apt update
apt install mysql-server
mysql_secure_installation
Root password: domoticz
mysql -u root -p
Create user:
GRANT ALL PRIVILEGES ON *.* TO 'domotica'@'localhost' IDENTIFIED BY 'domotica';
Create db
CREATE DATABASE domotica;
Restore database
mysql -u domotica -p domotica < Create-Update SQL Database.txt
Install phpmyadmin
apt-get install phpmyadmin
Domoticz
Copy config.php to \var\www\
Copy all scripts to the correct location \var\www\html\
Adjust the _fetchdomoticz.php script:
require '/var/www/config.php';
require 'functions.php';
$domoticzurl='http://127.0.0.1:8080';
Set the correct rights in the log files
Chown www-data:www-data /var/log/domoticz.txt for example
Browse to the _fecthcomoticz.php script and look in the db if the idx is added
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
Tnx @gimic
It is installing however i received some key warnings.
Code: Select all
pi@domoticz-pi:~ $ sudo apt update
Get:1 http://repo.mysql.com/apt/debian stretch InRelease [19.2 kB]
Hit:3 http://raspbian.raspberrypi.org/raspbian stretch InRelease
Hit:4 http://archive.raspberrypi.org/debian stretch InRelease
Err:1 http://repo.mysql.com/apt/debian stretch InRelease
The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <[email protected]>
Get:2 https://dl.ubnt.com/unifi/debian stable InRelease [3,024 B]
Reading package lists... Done
W: GPG error: http://repo.mysql.com/apt/debian stretch InRelease: The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <[email protected]>
E: The repository 'http://repo.mysql.com/apt/debian stretch InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
I am not working on pi, i am on thin cliënt with debian stretch on it. I'l look at it tonight if i missed any commands between, but dont think so.
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
i did not do any other commands, did not get errors either
google mysql raspberry pi and you will find a howto, its bascially only apt-get install mysql
the commands for the db should be the same.
google mysql raspberry pi and you will find a howto, its bascially only apt-get install mysql
the commands for the db should be the same.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
I guess it has something to do with:
https://dbahire.com/how-to-install-mysq ... n-stretch/
MariaDB is also installed on the Pi.... for my Unifi stuff.
Seems a bit tricky to have them both installed according to the article.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Mariadb is the same as mysql, isn't it?
I even think mariadb is the default mysql server in debian 9.
Anyway, I'm running mariadb so it shouldn't be a problem.
Edit: It is: https://mariadb.com/resources/blog/mari ... -debian-9/
I even think mariadb is the default mysql server in debian 9.
Anyway, I'm running mariadb so it shouldn't be a problem.
Edit: It is: https://mariadb.com/resources/blog/mari ... -debian-9/
Last edited by Egregius on Sunday 14 April 2019 7:07, edited 1 time in total.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
Let me just try to use mariadb and create an extra dB for pass2php
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
Indeed my DB is also Mariadb
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
I'm back in the game.. reverted.... and started over using:
https://r00t4bl3.com/post/how-to-instal ... spberry-pi
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server
sudo mysql_secure_installation
That post contained the answer to my issue:
Let's continue.
https://r00t4bl3.com/post/how-to-instal ... spberry-pi
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server
sudo mysql_secure_installation
Code: Select all
pi@domoticz-pi:~ $ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.1.37-MariaDB-0+deb9u1 Raspbian 9.0
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Code: Select all
pi@domoticz-pi:~ $ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
As I am working on the WAF approved a.k.a. live system I have to be careful.
For the installation wiki on RASPBERRY with MARIA DB.. in addition to the installation manual.
Importing the Database, first exit MYSQL
Check if Database was created
I addded the store($device,$status) function to my existing Pass2PHP and it is filling the database
For the installation wiki on RASPBERRY with MARIA DB.. in addition to the installation manual.
Importing the Database, first exit MYSQL
Code: Select all
mysql -u domotica -p domotica < 'Create-Update SQL Database.txt'
Code: Select all
mysql -u root -p
Code: Select all
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| domotica |
| information_schema |
| mysql |
| performance_schema |
+--------------------+
4 rows in set (0.00 sec)
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
Is it correct that I am missing the IDX value ??
Haha Can be solved with _fetchdomoticz.phpPass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
Code: Select all
function rgb($name,$hue,$level,$check=false)
{
global $user,$d,$domoticzurl;
lg(' (RGB) | '.$user.' => '.$name.' '.$level);
if ($d[$name]['i']>0) {
if ($check==false) {
file_get_contents($domoticzurl.'/json.htm?type=command¶m=setcolbrightnessvalue&idx='.$d[$name]['i'].'&hue='.$hue.'&brightness='.$level.'&iswhite=false');
} else {
if ($d[$name]['s']!=$$level) {
file_get_contents($domoticzurl.'/json.htm?type=command¶m=setcolbrightnessvalue&idx='.$d[$name]['i'].'&hue='.$hue.'&brightness='.$level.'&iswhite=false');
}
}
} else {
store($name, $level);
}
}
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
For some reason, sometimes my lights don't receive a status.. messing the whole system up.
I modified the status function a bit so that I can still use the existing rules without having to rewrite everything.
Code: Select all
function status($name)
{
global $d;
// lg('Status requested for: '.$name.' with status: '.$d[$name]['s']);
$status = $d[$name]['s'];
if ($status === '100') return 'On';
elseif ($status === '0') return 'Off';
elseif (empty($status)) return 'Empty'; // Sometimes no status.... strange..
else return $d[$name]['s'];
}
Last edited by sincze on Tuesday 16 April 2019 12:16, edited 1 time in total.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
You could add some logging in pass2php when the status is empty to figure out why this is happening.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
It has something to do with:
Code: Select all
function yeelight($name,$command,$info='')
{ //Available commands: nightlight, fulllight, warmer, cooler, brightnessup, brightnessdown
$idx=idx($name);
if($idx>0)
{
$comment='(Pass2PHP Yeelight | '.$name.' => '.$command.' => '.$info;
lg($comment);
sl($name,100); // Switch light on first. Ater that apply the mood command.
curl(domoticz.'json.htm?type=command¶m='.$command.'&idx='.$idx);
}
}
Code: Select all
yeelight('Lamp LED Study Left',100,'Nightlight');
Code: Select all
yeelight('Lamp LED Study Left','nightlight','Nightlight');
Drilling down further.. adding a log in pass2php.php
Code: Select all
2019-04-16 14:26:09.537 Status: --->> Starting with: Lamp LED Study Left Received status is: Set Level !
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
For easy migration still tons and tons of code to review.. I modified the Pass2php legacy cset and cget functions so that I can store the values I want in 'cache' in the DB as well. I think this is correct. cache=='mysql
Code: Select all
function cset($key,$value){
global $d;
if(cache=='apcu'){
apcu_store($key,$value);
}elseif(cache=='apc'){
apc_store($key,$value);
}elseif(cache=='memcached'){
if(!$m=xsMemcached::Connect('127.0.0.1',11211)){return;}$m->Set($key,$value);
}elseif(cache=='mysql'){
storemode($key, $value,true);
}
}
function cget($key){
global $d;
if(cache=='apcu'){
return apcu_fetch($key);
}elseif(cache=='apc'){
return apc_fetch($key);
}elseif(cache=='memcached'){
if(!$m=xsMemcached::Connect('127.0.0.1',11211)){return 0;}return $m->Get($key);
}elseif(cache=='mysql'){
return $d[$key]['m'];
}
}
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
I don’t have rgb stuff...
But I’m sure you’ll figure it out
But I’m sure you’ll figure it out
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
Got it. Will show fix tomorrow
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
- sincze
- Posts: 1299
- Joined: Monday 02 June 2014 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Location: Netherlands / Breda Area
- Contact:
Re: Pass2PHP
Issue was previously seen here: https://www.domoticz.com/forum/viewtopi ... hp#p135033
As not all devices will provide a "Set Level: 35%" but just "Set Level". I think it is a Domoticz device bug. "Set Level: 35%" will work with default Pass2PHP, "Set Level" definitely not. To Solve it Pass2PHP.php needs a little modification.
Within functions I created an additional function nvalue() to retrieve the missing info from the DB.
The patient... a.k.a. the House is running fine for over 12 hours now and no WAF complaints.
As not all devices will provide a "Set Level: 35%" but just "Set Level". I think it is a Domoticz device bug. "Set Level: 35%" will work with default Pass2PHP, "Set Level" definitely not. To Solve it Pass2PHP.php needs a little modification.
Code: Select all
if(in_array($device,array('Lamp (Kastenkamer) (RF)','Lamp (CV Ruimte) (RF)','Lamp (Keukentafel)','Lamp (Keukentafel) (RF)','Lamp (Bank)','Lamp (Bank) (RF)',
'Lamp LED TV','Lamp LED Vensterbank','Lamp LED Tafel (Woonkamer)','Lamp LED Trap','Lamp LED Hal','Lamp LED Keukenkast',
'Xiaomi RGB Gateway','Xiaomi RGB Gateway (Keuken)','Lamp LED Study Left','Lamp LED Study Right','Lamp (Kastenkamer) (RF)' ))) {
if($status=='Off'){
store($device, 0); // 14-04-2019 Pass2PHP 3.0 If one of the above items (dimmers is updated store different values)
}elseif($status=='On'){
store($device, 100); // 14-04-2019 Pass2PHP 3.0 If one of the above items (dimmers is updated store different values)
}elseif( $status==='Set Level' || $status==='Set Color' || empty($status) ) {
store($device, nvalue($device,'Level')); // 14-04-2019 Pass2PHP 3.0 If one of the above items (dimmers is updated store different values)
}else{
$status=filter_var($status,FILTER_SANITIZE_NUMBER_INT);
store($device,$status); // 14-04-2019 Pass2PHP 3.0 If one of the above items (dimmers is updated store different values, dimmer value)
}
}
else {
store($device,$status); // 14-04-2019 Pass2PHP 3.0 If not one of the above items (dimmers is updated store different values)
}
//lgsql('Domoticz',$device,$status);
@include rootdir.'pass2php/'.$device.'.php';
//lg('Pass2php: Called '.$device.' = Received "'.$status.'" status');
}
Code: Select all
function nvalue($name,$nvalue) // Added: 06-11-2018
{
$idx=idx($name);
$json_string=curl(domoticz.'json.htm?type=devices&rid='.$idx); // retrieve current level
$parsed_json = json_decode($json_string, true);
$parsed_json = $parsed_json['result'][0];
if(array_key_exists($nvalue, $parsed_json)) {
$value=$parsed_json[$nvalue];
}
else $value='NA';
return $value;
}
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Who is online
Users browsing this forum: No registered users and 1 guest