I think this little PHP-script will work:
Code: Select all
<!DOCTYPE html>
<html>
<body>
<?php
$xml=simplexml_load_file("http://enelogic:1000/cgi/electricityMeter/update") or die("Error: Cannot create object");
$DomoticzIP = "192.168.1.25";
$DomoticzPort = "8084";
$IDX = "303";
$used_high = floatval($xml->reading[0]);
$used_low = floatval($xml->reading[1]);
$produced_high = floatval($xml->reading[2]);
$produced_low = floatval($xml->reading[3]);
$actual_consumed = floatval($xml->reading[4])*1000;
$actual_produced = floatval($xml->reading[5])*1000;
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://{$DomoticzIP}:{$DomoticzPort}/json.htm?type=command¶m=udevice&idx={$IDX}&nvalue=0&svalue={$used_high};{$used_low};{$produced_high};{$produced_low};{$actual_consumed};{$actual_produced}");
curl_exec ($curl);
curl_close ($curl);
?>
</body>
</html>
- Create new hardware in Domoticz, Setup > Hardware, create hardware of type 'Dummy'.
- Then click the blue button behind it to create virtual device (P1 Smart Meter Electric) and look under Setup > Devices to add it to your Dashboard (click the green arrow).
- Note the IDX and change it in the script (also the URL & Port to your Domoticz & URL to the Enelogic device).
Copy the script to a webserver in your network (like your NAS or so, or install PHP support for the default ngingx on Domoticz) and then call the script ('enelogic.php') every minute or so (even faster, like 10sec, may also work but i'm not sure) from your cron (something like 'curl
http://ip/path/to/enelogic.php'). But first try calling the URL by hand from your browser, you should see something like "OK: Device updated" which is a notification from Domoticz.
Maybe it will also work from commandline:
Code: Select all
php /put/path/to/script/here/enelogic.php
If you don't have PHP yet: sudo apt-get install php5-cli
I will have a look on the gas part later. Not very difficult i think, same approach, only a different virtual device.
Let me know if this works for you!
I am not active on this forum anymore.