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));
}
?>
but the tanklevel unit was off by mistake... and then it sent the value 0 to domoticz and i can see it in domoticz log to.. incoming connection 127.0.0.1... but when i started tanklevel sensor i got error again... but it reads values (in this case 81% tanklevl1) but it don´t send it to domoticz