fuTelldus - PHP application for sensor-logging

Moderator: Telldus

Tony
Posts: 7
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by Tony »

csom wrote:
Tony wrote:
I have managed to get the old version running without the sensor logging unfortunately(45 years since last update) but I can se some info if i click on the senors like temp and humidity.
Any idea what I am doing wrong?
The lights list works.

What would be the best way of upgrading to your modified version?

Sorry for all the questions, I have tried to resinstall the old version for a couple of hours and getting nowhere with the logging.

/Tony
If I understand you right the sensors_table in the database shows your sensors? and the device table shows your devices?
But your sensors_log table does not get the results from cron_temp_log.php script, right?

The best way to upgrade would be to make a new database if you don't want to erase your current one and run fuTelldus_csom.sql to import all the necessary info.
Simply start from scratch and import all the files from my gitHub source.

and then just put in your database info in config.inc.php and then login.
Yes there are no rowes in sensors_log or in schedule in the database.
I would like to get the old version ok before attempting to have a go at the new one.

TY for your help and the quick response.

/Tony
csom
Posts: 20
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by csom »

Tony wrote:
Yes there are no rowes in sensors_log or in schedule in the database.
I would like to get the old version ok before attempting to have a go at the new one.

TY for your help and the quick response.

/Tony
Ok, you could try the new version just to be sure that it isn't anything wrong with the original script.
I know that I had to modify the original script a bit to log sensor values from sensors that didn't provide humidity.
In the new mod the logging script is right.
Tony
Posts: 7
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by Tony »

I think it has something to do with PEAR_package_fuTelldus.zip beacuse i couldn´t download that so instead i downloaded HTTP_OAuth-0.3.1.
When I run the script I get some error msgs regarding File(HTTP/OAuth.php) is not within the allowed path, I am running a webserver on my Synology NAS.
Do you have the PEAR_package_fuTelldus.zip?

/Tony
csom
Posts: 20
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by csom »

Tony wrote:I think it has something to do with PEAR_package_fuTelldus.zip beacuse i couldn´t download that so instead i downloaded HTTP_OAuth-0.3.1.
When I run the script I get some error msgs regarding File(HTTP/OAuth.php) is not within the allowed path, I am running a webserver on my Synology NAS.
Do you have the PEAR_package_fuTelldus.zip?

/Tony
Yes Tony, I use the PEAR package from futelldus. The floders should be placed under your futelldus rootfolder.
I got the file if You need it, please mail me and I'll reply you with the file.
My mail is written in earlier posts in this thread.
Nautilus
Posts: 80
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by Nautilus »

csom wrote:
csom wrote: I'll look into it and try it out.
I've updated the event-page and it's now uploaded on gitHub.

It now shows the next time the schedules suppose to run instead of planned hour:minute.
Thanks! Gives mcuh more meaningful times now :) The next run time could be set to N/A for inactive schedules if further tweaking is desired.

I registered to Pushover.net and download the iOS app but haven't got it to work yet. The server from where I'm running it has curl and I've set the "user key" from the iOS application as "Pushover user-key" and then created "futelldus" as a web application to Pushover.net and used the "API Token/key" under this web application as the "Pushover app-key". Is this correct?

There is also some subscription settings there which I'm not sure of whether I should do something with :) I created a subscription group, opened the link on my iOS device and subscribed to the application. Now I see the app in Pushover but do not get notifications. Emails are coming through fine so it is something with the pushover feature that is not working for me. Any tips how to troubleshoot?

Also, not sure if it is just me but when opening the app through the webapp link, it opens fine but after one rotate to landscape mode it does not get back to "visible-phone" mode and actually the section the app takes from the screen keeps getting smaller and smaller with each rotation until it crashes :)

I was thinking also that it would be a nice feature to see the "last sent" info for devices as well. And maybe even have a possibility to set the "repeat every x minute" if the user does not want to repeat it too often.

This got me also thinking that could it be set so that at each run of the cron file it would set "last run" info somewhere to the database (about the cron running, not the schedules) and then the device history would be checked until this time and notification sent if device state has changed since?
csom
Posts: 20
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by csom »

Nautilus wrote:
Thanks! Gives mcuh more meaningful times now :) The next run time could be set to N/A for inactive schedules if further tweaking is desired.

I registered to Pushover.net and download the iOS app but haven't got it to work yet. The server from where I'm running it has curl and I've set the "user key" from the iOS application as "Pushover user-key" and then created "futelldus" as a web application to Pushover.net and used the "API Token/key" under this web application as the "Pushover app-key". Is this correct?
Yes that's right, your user-key is displayed on the front-page of pushover.net and the app-key is created when you create an application in your pushover account to link with futelldus. I had another user who got it working without any issues. have you looked if your web server logs shows any error using curl? It sounds that it's a problem with curl. You can try to send a push direct from pushover's website to your devices, does that work?
Nautilus wrote: There is also some subscription settings there which I'm not sure of whether I should do something with :) I created a subscription group, opened the link on my iOS device and subscribed to the application. Now I see the app in Pushover but do not get notifications. Emails are coming through fine so it is something with the pushover feature that is not working for me. Any tips how to troubleshoot?
I haven't created a subscription group to get it to work on my phone. I just downloaded the app from app-store and entered my user-key into my phone to add it to my account.
Nautilus wrote: Also, not sure if it is just me but when opening the app through the webapp link, it opens fine but after one rotate to landscape mode it does not get back to "visible-phone" mode and actually the section the app takes from the screen keeps getting smaller and smaller with each rotation until it crashes :)
I use an Iphone and haven't had any issues with the web app feature or open it in safari. I can rotate my cell several times without screen changes size. It also works fine on my ipad. What type of phone are you using?
Nautilus
Posts: 80
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by Nautilus »

csom wrote:...application in your pushover account to link with futelldus
Thanks for the comments. I'll enable the logging to see if it catches anything there. Meanwhile, does this tell anything that why curl would not work:

cURL support enabled
cURL Information 7.21.0
Age 3
Features
AsynchDNS No
Debug No
GSS-Negotiate Yes
IDN Yes
IPv6 Yes
Largefile Yes
NTLM Yes
SPNEGO No
SSL Yes
SSPI No
krb4 No
libz Yes
CharConv No
Protocols dict, file, ftp, ftps, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, smtp, smtps, telnet, tftp
Host i686-pc-linux-gnu
SSL Version OpenSSL/1.0.1m
ZLib Version 1.2.3.3

The version I'm using is not a clean install as I have my own configurations there. Database and the settings pages should be in order, also the cron.php. I also updated the global functions where there is the Pushover function. Is there something else I could be missing?
csom
Posts: 20
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by csom »

Nautilus wrote: Thanks for the comments. I'll enable the logging to see if it catches anything there. Meanwhile, does this tell anything that why curl would not work:

cURL support enabled
cURL Information 7.21.0
Age 3
Features
AsynchDNS No
Debug No
GSS-Negotiate Yes
IDN Yes
IPv6 Yes
Largefile Yes
NTLM Yes
SPNEGO No
SSL Yes
SSPI No
krb4 No
libz Yes
CharConv No
Protocols dict, file, ftp, ftps, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, smtp, smtps, telnet, tftp
Host i686-pc-linux-gnu
SSL Version OpenSSL/1.0.1m
ZLib Version 1.2.3.3

The version I'm using is not a clean install as I have my own configurations there. Database and the settings pages should be in order, also the cron.php. I also updated the global functions where there is the Pushover function. Is there something else I could be missing?
1. It's hard to say if you missing anything. But it looks to me like you have the curl installed and enabled correct.

2. Ok, so you'd don't use a clean install. It could depend on that. It's very tricky to say if you don't have a clean install but as you say. the settings pages (schedules, settings_exec and user) should be updated and then the cron_schedule and global_php and then all the languages files. I can't remember if it uses other files to do push. But I think that should be enough.

Can't you try to setup a clean install by the side to test if you get that to work?

I suggest you try to send you a push message direct on pushovers site. If that works there is something fault with your config in futelldus or curl config, but if that doesn't work you have to look at your pushover setup on your cell.
Nautilus
Posts: 80
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by Nautilus »

Hi,

the direct pushover work fine and I can also get a push notification by setting the provided email address as a recipient. I tried further debugging by adding

$info = curl_getinfo($ch);
print_r ($info);

Below is the output:

Array ( [url] => https://api.pushover.net/1/messages.json [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 3.157507 [namelookup_time] => 0.020507 [connect_time] => 3.15753 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 )

I guess http_code => 0 means that it cannot connect to the url? When I try it directly from web browser it opens, but chrome complains that the ssl has not got public audit records, though I doubt this could be the reason for curl to fail from my server...
csom
Posts: 20
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by csom »

Nautilus wrote:Hi,

the direct pushover work fine and I can also get a push notification by setting the provided email address as a recipient. I tried further debugging by adding

$info = curl_getinfo($ch);
print_r ($info);

Below is the output:

Array ( [url] => https://api.pushover.net/1/messages.json [content_type] => [http_code] => 0 [header_size] => 0 [request_size] => 0 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 3.157507 [namelookup_time] => 0.020507 [connect_time] => 3.15753 [pretransfer_time] => 0 [size_upload] => 0 [size_download] => 0 [speed_download] => 0 [speed_upload] => 0 [download_content_length] => -1 [upload_content_length] => -1 [starttransfer_time] => 0 [redirect_time] => 0 )

I guess http_code => 0 means that it cannot connect to the url? When I try it directly from web browser it opens, but chrome complains that the ssl has not got public audit records, though I doubt this could be the reason for curl to fail from my server...
According to pushovers manual:
pushover manual wrote: curl_setopt_array($ch = curl_init(), array(
CURLOPT_URL => "https://api.pushover.net/1/messages.json",
CURLOPT_POSTFIELDS => array(
"token" => "abc123",
"user" => "user123",
"message" => "hello world",
),
CURLOPT_SAFE_UPLOAD => true,
));
curl_exec($ch);
curl_close($ch);
and the sendpush function in global.functions.php
global.functions.php wrote: 72 function sendPush($token, $user, $title, $message) {
73 curl_setopt_array($ch = curl_init(), array(
74 CURLOPT_URL => "https://api.pushover.net/1/messages.json",
75 CURLOPT_POSTFIELDS => array(
76 "token" => "{$token}",
77 "user" => "{$user}",
78 "title" => "{$title}",
79 "message" => "{$message}",
80 ),
81 CURLOPT_SAFE_UPLOAD => true,
82 ));
83 curl_exec($ch);
84 curl_close($ch);
85 }
I just followed their manual and I can't see what could be wrong?
Tony
Posts: 7
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by Tony »

Hi

Does anyone have the fuTelldus-crontab on synology.pdf?

/Tony
Nautilus
Posts: 80
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by Nautilus »

csom wrote: I just followed their manual and I can't see what could be wrong?
It turned out I was on the right track with the certificate thoughts. I tested with curl_errno() and got:

Code: Select all

error:SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
So I once more tried:

Code: Select all

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
And now it worked (although I tried it already few days ago but then it was as a part of the curl_setopt_array, now as a separate line).

Not sure if it has anything to do with this but I use a self signed certificate on my web server...

And thanks for helping with the issue! :)
Nautilus
Posts: 80
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by Nautilus »

Hi, I found a couple of potential bugs, or at least stuff that I needed to modify to get it working for my setup.

mainpage.php (row 114):

Code: Select all

echo "<a href='?page=chart&id=$sensorID'><img style='height:16px;' src='../images/chart_line.png' /> {$lang['View chart']}</a>";
I assume the link should be to chart_sensor.php and not chart.php? With chart it returns the whole thing. Or is there some added "include" to respect the id? Also, my server does not display any image with a link like src='../images/chart_line.png', needed to change this to src='images/chart_line.png'


settings.php (row 69):

Code: Select all

      <div class="span9">
      	<?php
      		if (isset($_GET['view'])) {
      			include("inc/settings_" . $view . ".php");
      		} else {
		  if ($user['admin'] == 1) 
      			include("inc/settings_general.php");
			else
			  header("Location: ?page=settings&view=user&action=edit&id={$user['user_id']}");
			  exit();
      		}
      	?>
      </div>
The if..else stuff is a bit mixed up here I think. If no view is set it will go to exit and does not print out the footer. I change it to:

Code: Select all

<div class="span9">
  <?php
    if (isset($_GET['view'])) {
      include("inc/settings_" . $view . ".php");
    } 
    elseif ($user['admin'] == 1) { 
      include("inc/settings_general.php");
    }
    else {
      header("Location: ?page=settings&view=user&action=edit&id={$user['user_id']}");
      exit();
    }
  ?>
</div>
csom
Posts: 20
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by csom »

Nautilus wrote:Hi, I found a couple of potential bugs, or at least stuff that I needed to modify to get it working for my setup.

mainpage.php (row 114):

Code: Select all

echo "<a href='?page=chart&id=$sensorID'><img style='height:16px;' src='../images/chart_line.png' /> {$lang['View chart']}</a>";
I assume the link should be to chart_sensor.php and not chart.php? With chart it returns the whole thing. Or is there some added "include" to respect the id? Also, my server does not display any image with a link like src='../images/chart_line.png', needed to change this to src='images/chart_line.png'
The image link is right depending on if your futelldus folder is on the "root" of the domain or if it's in a subfolder. So your solution is right :)

The link to the chart should be right because the file in the inc-folder is called chart.php under the public sub-folder. I assume that it's the public mainpage.php you are referring to, right?
Nautilus
Posts: 80
Joined: Fri Mar 17, 2023 9:45 am

Re: fuTelldus - PHP application for sensor-logging

Post by Nautilus »

csom wrote: The link to the chart should be right because the file in the inc-folder is called chart.php under the public sub-folder. I assume that it's the public mainpage.php you are referring to, right?
Hi, I was referring to the private mainpage. I thought the link was meant to go the the chart_sensor.php as it contains the "&id=[sensor id]" part and at least in the original setup chart.php shows all charts and not an individual based on the id (but this new chart_sensor.php does it). So I thought that either there is some new include-rule in the chart.php (which I did not notice) or then link should point directly to chart_sensor.php.

A feature for the scheduler that might be interesting to copy from the "official" event scheduler is the "execute http request to a custom url". So that if device state changes you'd be able to execute a http request (or maybe any script if run from self maintained web server). Unfortunately I don't have an idea how one would go about to implement something like this, so I'm just throwing the idea out there...:)

Also, it would be nice if the user could overwrite all the standard notification texts (like the pushTitle and mailMessage / mailSubject) with custom ones. Meaning that the if the custom text exists, it would be used instead of the standard one.
Post Reply