Open githubberboy opened 6 years ago
I i have the same request? any solution? Thanks
I've had a similar need trying to read status from my OpenSprinkler. The best way I could think up was to use a PHP script to read the values. If the output is always the same, except for the 1/0 variables you could use substr to interpret the values.
It outputs like this {"sn":[0,0,0,0,0,0,0,0],"nstations":8}
Then this script looks for the 8th character, length 1. And returns that value when you go to this php file on your web server:
<?php $ctx=stream_context_create(array('http'=> array( 'timeout' => 1 // 1 sec ) )); $url = file_get_contents('<URL HERE>', false, $ctx); $output = substr(".$url.", 8, 1); echo $output; ?>
I know this solution requires lots of counting, but as long as the output doesn't change its structure this does work. You would need 1 PHP script per http device, 1 status per device. And you would need to alter the value 8 to which ever position value you are looking for, count it out and then put in that number. But its just a suggestion
I've a status.xml file that contain multiple status values, like this:
It is possible to read the 1|0 inside
<natOut> <natIn>
?Thanks.