still error but in line 8. thanks for taking time anyway!
Water tank level (from other webserver)
Moderator: leecollings
-
Tarzan737
- Posts: 60
- Joined: Friday 01 June 2018 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Water tank level (from other webserver)
Ok! but sorry, no success anyway 
still error but in line 8. thanks for taking time anyway!
still error but in line 8. thanks for taking time anyway!
- Attachments
-
- Screenshot (8).png (188.86 KiB) Viewed 2611 times
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Water tank level (from other webserver)
What if you past thag url in a browser and just change the ip address?
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Water tank level (from other webserver)
What? What don't you understand? You don't know what a url is? Or you don't know what a browser is?
Well, a url is a link, in this case:
And a browser? That's what you use the browse the web, like Chrome, Firefox, Safari,...
So, copy the above url and past it in the address bar of your browser.
You should see this:
Well, a url is a link, in this case:
Code: Select all
http://192.168.0.14:8080/json.htm?type=command¶m=udevice&idx=33&nvalue=0&svalue=100So, copy the above url and past it in the address bar of your browser.
You should see this:
Code: Select all
{
"status" : "OK",
"title" : "Update Device"
}-
Tarzan737
- Posts: 60
- Joined: Friday 01 June 2018 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Water tank level (from other webserver)
Sorry for late answer (been away) but i do get this
if i use 192.168.0.14
but if i use 127.0.0.1:8080 i get domoticz offline with this code
Code: Select all
"status" : "OK",
"title" : "Update Device"but if i use 127.0.0.1:8080 i get domoticz offline with this code
Code: Select all
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Domoticz Offline</title>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<style>
html, body
{
height: 100%;
}
body
{
font: 12px 'Lucida Sans Unicode', 'Trebuchet MS', Arial, Helvetica;
margin: 0;
background: #202020 url(../css/images/img01.jpg) repeat;
}
#offline
{
background-color: #fff;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
background-image: -webkit-linear-gradient(top, #fff, #eee);
background-image: -moz-linear-gradient(top, #fff, #eee);
background-image: -ms-linear-gradient(top, #fff, #eee);
background-image: -o-linear-gradient(top, #fff, #eee);
background-image: linear-gradient(top, #fff, #eee);
height: 50px;
width: 300px;
margin: -150px 0 0 -180px;
padding: 30px;
position: absolute;
top: 50%;
left: 50%;
z-index: 0;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
#offline:before
{
content: '';
position: absolute;
z-index: -1;
border: 1px dashed #ccc;
top: 5px;
bottom: 5px;
left: 5px;
right: 5px;
-moz-box-shadow: 0 0 0 1px #fff;
-webkit-box-shadow: 0 0 0 1px #fff;
box-shadow: 0 0 0 1px #fff;
}
h3
{
text-transform: uppercase;
text-align: center;
color: #666;
margin: 0 0 30px 0;
letter-spacing: 4px;
font: normal 26px/1 Verdana, Helvetica;
position: relative;
}
h3:after, h3:before
{
background-color: #777;
content: "";
height: 1px;
position: absolute;
top: 15px;
width: 60px;
}
h3:after
{
background-image: -webkit-gradient(linear, left top, right top, from(#777), to(#fff));
background-image: -webkit-linear-gradient(left, #777, #fff);
background-image: -moz-linear-gradient(left, #777, #fff);
background-image: -ms-linear-gradient(left, #777, #fff);
background-image: -o-linear-gradient(left, #777, #fff);
background-image: linear-gradient(left, #777, #fff);
right: 0;
}
h3:before
{
background-image: -webkit-gradient(linear, right top, left top, from(#777), to(#fff));
background-image: -webkit-linear-gradient(right, #777, #fff);
background-image: -moz-linear-gradient(right, #777, #fff);
background-image: -ms-linear-gradient(right, #777, #fff);
background-image: -o-linear-gradient(right, #777, #fff);
background-image: linear-gradient(right, #777, #fff);
left: 0;
}
</style>
</head>
<body>
<div id="offline">
<h3 data-i18n="Domoticz Offline">Domoticz Offline</h3>
</div>
</body>
</html>
-
Tarzan737
- Posts: 60
- Joined: Friday 01 June 2018 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Water tank level (from other webserver)
And i noticed that the value actually changed to 100 % in domoticz when i copy/pasted that line into browser, so it is updating
if i change value from 100 to 70 it is doing that as well into domoticz..
if i change value from 100 to 70 it is doing that as well into domoticz..
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Water tank level (from other webserver)
You can't use 127.0.0.1 on your computer of course.
Do you have authentication enabled?
What is you curl the url in a shell?
Do you have authentication enabled?
What is you curl the url in a shell?
-
Tarzan737
- Posts: 60
- Joined: Friday 01 June 2018 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Water tank level (from other webserver)
sorry, ofcourse i used to have domoticz on same computer..
but if you mean if i have any website protection? no i don´t
but if you mean if i have any website protection? no i don´t
-
Tarzan737
- Posts: 60
- Joined: Friday 01 June 2018 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Water tank level (from other webserver)
you mean like this?
- Attachments
-
- Screenshot (9).png (170.13 KiB) Viewed 2539 times
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Water tank level (from other webserver)
No. This command:
curl -s "url..."
curl -s "url..."
-
Tarzan737
- Posts: 60
- Joined: Friday 01 June 2018 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Water tank level (from other webserver)
i get this...
- Attachments
-
- Screenshot (10).png (133.17 KiB) Viewed 2526 times
-
Tarzan737
- Posts: 60
- Joined: Friday 01 June 2018 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Water tank level (from other webserver)
tried curl -I to...
- Attachments
-
- Screenshot (12).png (151.79 KiB) Viewed 2526 times
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Water tank level (from other webserver)
You need to place the url between quotes...
Also, please try google... He knows a lot
Also, please try google... He knows a lot
-
Tarzan737
- Posts: 60
- Joined: Friday 01 June 2018 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Water tank level (from other webserver)
ahh crap
sorry again...
anyway.. then i get status ok and title update device....
other words.. it works like that!!
anyway.. then i get status ok and title update device....
other words.. it works like that!!
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Water tank level (from other webserver)
Then it should also work from php.
-
Tarzan737
- Posts: 60
- Joined: Friday 01 June 2018 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Water tank level (from other webserver)
Propanly but it dont! Not with that code.
Everything seems to work, and when i use php
It reads correct value from tanklevel but it refuse to send it to domoticz.
Everything seems to work, and when i use php
It reads correct value from tanklevel but it refuse to send it to domoticz.
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Water tank level (from other webserver)
Did you manage to get this working yet?
What did you do in the mean time?
What did you do in the mean time?
-
Tarzan737
- Posts: 60
- Joined: Friday 01 June 2018 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Water tank level (from other webserver)
Nope, not with the PHP code.
I beg that you or someone else have the solution. It would be nice to have it in domoticz.
I don't know what I do wrong. Could it be something in settings in domoticz? But as I wrote before, it responds but not with PHP script
I beg that you or someone else have the solution. It would be nice to have it in domoticz.
I don't know what I do wrong. Could it be something in settings in domoticz? But as I wrote before, it responds but not with PHP script
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Water tank level (from other webserver)
But you didn't do anything since my last post?
You didn't try stuff?
Check the url that is printed in the terminal window.
Use another small php script with this to verify:
or
and
You didn't try stuff?
Code: Select all
<?php
$data=file_get_contents('http://192.168.0.12/tanklevl1');
$data=strafter($data,'</span><br>');
$data=strbefore($data,'%');
$idx=33;
$nvalue=0;
$svalue=$data;
$url='http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx='.$idx.'&nvalue='.$nvalue.'&svalue='.$svalue;
echo $url.PHP_EOL;
file_get_contents($url);
function strafter($string,$substring){
$pos=strpos($string,$substring);
if($pos===false)return $string;
else return(substr($string,$pos+strlen($substring)));
}
function strbefore($string,$substring){
$pos=strpos($string,$substring);
if($pos===false)return $string;
else return(substr($string,0,$pos));
}
?>Use another small php script with this to verify:
Code: Select all
<?php
file_get_contents('http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=33&nvalue=0&svalue=100);
?>
Code: Select all
<?php
file_get_contents('http://192.168.0.14:8080/json.htm?type=command¶m=udevice&idx=33&nvalue=0&svalue=100);
?>
Code: Select all
<?php
file_get_contents('the url that was printed with the first code');
?>
-
Tarzan737
- Posts: 60
- Joined: Friday 01 June 2018 20:32
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Water tank level (from other webserver)
i have actually tried this before
and then i get error on line 2 instead...
Code: Select all
<?php
file_get_contents('http://127.0.0.1:8080/json.htm?type=command¶m=udevice&idx=33&nvalue=0&svalue=100);
?>- Attachments
-
- Screenshot (13).png (158.15 KiB) Viewed 3223 times
Who is online
Users browsing this forum: No registered users and 1 guest