Pass2PHP
Moderator: leecollings
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
There's an example in the secure folder.
Placed mine outside the www root so I don't have to worry about personal stuff in it.
Placed mine outside the www root so I don't have to worry about personal stuff in it.
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
Do you really need php7.3? i'm running 7.0
getting this error:
[Thu Apr 11 22:00:01.740901 2019] [:error] [pid 562] [client 127.0.0.1:56398] PHP Notice: Use of undefined constant TIME - assumed 'TIME' in /var/www/html/secure /functions.php on line 354
any idea?
getting this error:
[Thu Apr 11 22:00:01.740901 2019] [:error] [pid 562] [client 127.0.0.1:56398] PHP Notice: Use of undefined constant TIME - assumed 'TIME' in /var/www/html/secure /functions.php on line 354
any idea?
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
the database is filling with my devices as they get used.
what does not work is the floorplanlog.log and with it the actions behind all the functions. the acpu is still needed right?
what does not work is the floorplanlog.log and with it the actions behind all the functions. the acpu is still needed right?
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
I updated to example config to add the TIME constant.
Strange thing about floorplanlog.log:
I define $LogFile='/var/log/floorplanlog.log'; in the configfile but $LogFile is never used anywhere else.
I do have a file like that that's owned by www-data but it's timestamp is 05-2018 so it isn't used anymore.
The lg function writes to the domoticz logfile.
APCu isn't used in my scripts anymore, but if you'd like you can still use it for small things I guess.
Strange thing about floorplanlog.log:
I define $LogFile='/var/log/floorplanlog.log'; in the configfile but $LogFile is never used anywhere else.
I do have a file like that that's owned by www-data but it's timestamp is 05-2018 so it isn't used anymore.
The lg function writes to the domoticz logfile.
APCu isn't used in my scripts anymore, but if you'd like you can still use it for small things I guess.
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Oh, and it should work with PHP 7.0. Just recently updated to 7.3 so don't think I already use stuff that's deprecated or new in 7.3.
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
Almost there i think...
only problem i have now is that script is running, i do action in domoticz, this executes the right php file in /secure/pass2php/ , database is updated with the correct status (sw('device', 'on') but that is not communicated back to domoticz, so nothing happens... what am i missing?
seems like there is a missing link between database & domoticz.
only problem i have now is that script is running, i do action in domoticz, this executes the right php file in /secure/pass2php/ , database is updated with the correct status (sw('device', 'on') but that is not communicated back to domoticz, so nothing happens... what am i missing?
seems like there is a missing link between database & domoticz.
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
Did you fill in the domoticzurl in the config file?
Do you have part of the code that should send something to domoticz?
Do you have part of the code that should send something to domoticz?
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
The domoticz url is by default in the config file.
i do a sw('device','on')
is that not enough to do the trick?
i do a sw('device','on')
is that not enough to do the trick?
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
It has to be:
Are the idx's filled in the devices table?
If not you must execute the _fetchdomoticz.php script to fill them.
Code: Select all
sw('device', 'On');
If not you must execute the _fetchdomoticz.php script to fill them.
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
ah, that is the i colom in the database, all is NULL
do i need to cron the _fetchdomoticz.php?
do i need to cron the _fetchdomoticz.php?
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
i've executed the script by browsing it:
[Fri Apr 12 10:56:09.261039 2019] [:error] [pid 10657] [client 192.168.0.254:55913] PHP Notice: Undefined variable: domoticzurl in /var/www/html/secure/_fetchdomoticz.php on line 12
[Fri Apr 12 10:56:09.261313 2019] [:error] [pid 10657] [client 192.168.0.254:55913] PHP Warning: file_get_contents(/json.htm?type=devices&used=true): failed to open stream: No such file or directory in /var/www/html/secure/_fetchdomoticz.php on line 12
[Fri Apr 12 10:56:09.261039 2019] [:error] [pid 10657] [client 192.168.0.254:55913] PHP Notice: Undefined variable: domoticzurl in /var/www/html/secure/_fetchdomoticz.php on line 12
[Fri Apr 12 10:56:09.261313 2019] [:error] [pid 10657] [client 192.168.0.254:55913] PHP Warning: file_get_contents(/json.htm?type=devices&used=true): failed to open stream: No such file or directory in /var/www/html/secure/_fetchdomoticz.php on line 12
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
You have to include it somewhere where the config is already included.
I execute it from floorplan.others.php with a button.
If the idx is null the device is used as a dummy switch outside Domoticz.
I execute it from floorplan.others.php with a button.
If the idx is null the device is used as a dummy switch outside Domoticz.
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
that page demands me a username and password (interface looks like acpu.php)
i tryed username1 - password1 but nothing.
i tryed username1 - password1 but nothing.
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
i've added the required modules to the _fetchdomoticz.php page.
it adds now only 3 idx values.
2 virtual temperature items
1 achterdeur that i don't have (and the script adds idx of the last sensor in the json file to database for this item)
all items are virtual, i have 30 items in domoticz (all virtual for now) different types, wind,pressure,Thermostat,... but these do not show in the database (cleared db and ran script)
it adds now only 3 idx values.
2 virtual temperature items
1 achterdeur that i don't have (and the script adds idx of the last sensor in the json file to database for this item)
all items are virtual, i have 30 items in domoticz (all virtual for now) different types, wind,pressure,Thermostat,... but these do not show in the database (cleared db and ran script)
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
Deleted some code from the _fetchdomoticz.php like Dimmer & Blinds percentage, now it is fine, all idx show up in table. now i need to test if it reacts in domoticz...
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
All is working, created a config.php in the var/www/ folder that was empty too tired last night i guess
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
Only the floorplan.php gives me a login page where i dont know what account i need to fill in? Where do i set that?
i'l send you my notes on the install when upgrade is done
i'l send you my notes on the install when upgrade is done
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
I wasn't intended to share my authentication script but I did now anyway. After all I do have fail2ban in place.
Already made some changes to have it more secure like httponly cookies.
Will search somehow for a more secure login system with token or something like that.
For now, usernames and passwords are stored in plain text in the config file. Another reason to put this file outside the www root folder
There was indeed a typo with the 'achterdeur' in _fetchdomoticz, it was a single = instead of a double ==.
That part is in there because the switch at my backdoor responds inversed. It sends open when closed...
The other stuff should normally function ok. It's there to 'clean' the data that comes from Domoticz. Like changing 'Level: 10%' to just '10'.
Already made some changes to have it more secure like httponly cookies.
Will search somehow for a more secure login system with token or something like that.
For now, usernames and passwords are stored in plain text in the config file. Another reason to put this file outside the www root folder
There was indeed a typo with the 'achterdeur' in _fetchdomoticz, it was a single = instead of a double ==.
That part is in there because the switch at my backdoor responds inversed. It sends open when closed...
The other stuff should normally function ok. It's there to 'clean' the data that comes from Domoticz. Like changing 'Level: 10%' to just '10'.
-
- Posts: 50
- Joined: Thursday 04 January 2018 8:43
- Target OS: Linux
- Domoticz version: 3.66
- Location: Roeselare, Wvl, BE
- Contact:
Re: Pass2PHP
Tnx for the correction
i need to add a lot of those exceptions if i'm trying to calculate with values as wind speed, solarradiation,...
you need to add changelog, can not follow witch files you change every time you are to fast
you changed the index.php file also. was interested in the miromcal
with ould index.php file i get nothing, user is correct but get empty page
new index.php only has menu.php you forgot to add menu.php to git.
i need to add a lot of those exceptions if i'm trying to calculate with values as wind speed, solarradiation,...
you need to add changelog, can not follow witch files you change every time you are to fast
you changed the index.php file also. was interested in the miromcal
with ould index.php file i get nothing, user is correct but get empty page
new index.php only has menu.php you forgot to add menu.php to git.
- Egregius
- Posts: 2582
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Pass2PHP
menu.php is just a page with my bookmarks. There's way to much personal stuff in it to share it and you shouldn't need it.
All weather related stuff is in _cron120.php.
All weather related stuff is in _cron120.php.
Who is online
Users browsing this forum: No registered users and 0 guests