Hemautomatiseringskomih�glapp

2015-10-29

Tips och trix f�r att f� saker att prata med varandra.

Fr�ga nod 54 vad den har f�r data via domoticz API

http://192.168.37.23:8080/json.htm?type=devices&rid=54

Vilket borde ge en utdata i stil med
{
   "ActTime" : 1446051883,
   "ServerTime" : "Oct 28 2015 18:04:43",
   "Sunrise" : "07:09:00",
   "Sunset" : "15:30:00",
   "result" : [
      {
         "BatteryLevel" : 255,
         "CustomImage" : 0,
         "Data" : "500.0 Watt",
         "Favorite" : 0,
         "HardwareID" : 3,
         "HardwareName" : "ZwaveUSB",
         "HaveTimeout" : false,
         "ID" : "0000204",
         "LastUpdate" : "2015-10-28 17:55:13",
         "Name" : "FWP_LVP",
         "Notifications" : "false",
         "PlanID" : "0",
         "Protected" : false,
         "ShowNotifications" : true,
         "SignalLevel" : 12,
         "SubType" : "Electric",
         "Timers" : "false",
         "Type" : "Usage",
         "TypeImg" : "current",
         "Unit" : 2,
         "Used" : 1,
         "XOffset" : "0",
         "YOffset" : "0",
         "idx" : "54"
      }
   ],
   "status" : "OK",
   "title" : "Devices"
}

F� ut resultatet av rubriken 'Data' fr�n domoticz, fr�ga nod nummer 54:

<?php
$json_string = file_get_contents("http://192.168.37.23:8080/json.htm?type=devices&rid=54");
$parsed_json = json_decode($json_string, true);
$parsed_json = $parsed_json['result'][0];
$temp = $parsed_json['Data'];
echo "Elf&ouml;rbrukning Luftv&auml;rmepump ".$temp."\n";
?>

Resultatet blir;
Elf�rbrukning Luftv�rmepump 452.7 Watt



Navigering