
Temperature (10)
PHP receive script for KMTronic DS1820 LAN POST version module
Written by kmtronic
Receive POST data using PHP
------------------------------------------------------------------------------
PHP file:
<?php
$date = date('Ymd');
$time = date('H:i:s');
$hourtime = date('H:i');
$unixtime = time();
$file = "/var/www/html/data/".$date.".log";
$current = file_get_contents($file);
$current .= $date;
$current .= "-";
$current .= $time;
$current .= "\t";
$current .= $unixtime;
$current .= "\t";
$temp = $_POST['temperature'];
$temp2 = implode("",$_POST['temperature']);
$current .= $temp2;
$current .= "\r\n";
// Write the contents back to the file
file_put_contents($file, $current);
// a:2:{s:9:"device_id";s:10:"B3D53A5348";s:11:"temperature";a:1:{s:18:"'282b91240700002e'";s:5:"15.43";}}
?>
DATA file:
20161229-00:00:21 1482962421 22.75
20161229-00:00:56 1482962456 22.75
20161229-00:01:30 1482962490 22.75
20161229-00:02:04 1482962524 22.75
20161229-00:02:38 1482962558 22.75
20161229-00:03:12 1482962592 22.75
20161229-00:03:46 1482962626 22.75
20161229-00:04:20 1482962660 22.75
20161229-00:04:54 1482962694 22.75
20161229-00:05:28 1482962728 22.81
20161229-00:06:02 1482962762 22.81
...
...
...
...
...
Domoticz lua script to convert XML output from KMTronic DS1820 LAN module
Written by kmtronic
Domoticz lua script to convert XML output from KMTronic
DS1820 LAN module
------------------------------------------------------------------------------
--
--
-- Domoticz lua script to convert XML output from KMTronic DS1820 LAN module
-- Reads the temperature based on the unique ID of the sensor and passes it
-- back to a virtual temperature sensor(s)
-- sensors in Domoticz
--
------------------------------------------------------------------------------
-- Rob Allen 12/04/2016
------------------------------------------------------------------------------
Thank you Rob!
Add DUMMY device (in example "ROOM DATA")
Create a temperature type sensor (in an example "T1")
Check that is available in Devices
Check what is sensor ID (in example 70)
Download from here LUA script:
http://www.domoticz.com/forum/viewtopic.php?t=6456#p83096
Put in "domoticz/scripts/lua/"
and rename to
"script_time_kmtronic.lua"
Check ID your first sensor in your Temperature monitor (in example 28006D2307000061)
Next change in example
ID from "108" to your - "70"
Sensor ID from example 28006D2307000061 with your ID
and
Device_IP = "172.16.227.201" with your (in example "192.168.1.199")
More information:
http://www.domoticz.com/forum/viewtopic.php?t=6456#p83096
For complicated or long wire lines (100-200 meters), if it is necessary,
there are two variants for compensation as shown on the figure below:
First one:
To connect parallel resistor 4.7k between +5V and 1W pin of 3pin plug-in (variant 1 of the scheme).
Second one:
To make RC filter like it's shown at variant 2 of the scheme.
You can try with 470pf and 62 or 100 Ohms resistor.
You can try variant 1 first, if there's no success - variant 2.
You can combine variant 1 and 2 but connect parallel resistor before RC filter.
More information
www.maximintegrated.com/en/app-notes/index.mvp/id/148
Default:
IP address: 192.168.1.199
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1
Username: admin
Password: admin
Reset to Default Settings:
Hold Reset button for 10 seconds
Manufacturer:
KMTronic LTD
Model:
--------
Features:
• Measures Temperatures from -55°C to +125°C (-67°F to +257°F)
• Support up to 4 DS18B20 temperature sensors
Specifications:
DS18B20
http://www.maximintegrated.com/sensors-and-sensor-interface/DS18B20.html
Supply:
Requires external 12 volt DC / 600mA power supply
Software examples:
http://www.info.kmtronic.com/temperature.html
Private Sub CommandButton1_Click()
Dim strTargetFile As String
Dim wb As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
strTargetFile = Cells(2, 1)
Set wb = Workbooks.OpenXML(Filename:=strTargetFile, LoadOption:=xlXmlLoadImportToList)
Application.DisplayAlerts = True
wb.Sheets(1).UsedRange.Copy ThisWorkbook.Sheets("Sheet1").Range("A5")
wb.Close False
Application.ScreenUpdating = True
End Sub
www.KMtronic.com/Software/Temperature/KMtronic-LAN-Temperature-Excel-Example-01.zip
LAN Temperature Monitor Visual Basic XML read example code
Written by kmtronic
Private Sub CommandButton1_Click()
Dim strTargetFile As String
Dim wb As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
strTargetFile = "http://192.168.1.199/status.xml"
Set wb = Workbooks.OpenXML(Filename:=strTargetFile, LoadOption:=xlXmlLoadImportToList)
Application.DisplayAlerts = True
wb.Sheets(1).UsedRange.Copy ThisWorkbook.Sheets("Sheet1").Range("A5")
wb.Close False
Application.ScreenUpdating = True
End Sub
All temperatures
PHP code
<?php
// Loading the XML file
$xml = simplexml_load_file("http://88.87.29.196:8002/status.xml");
echo "<h1>";
foreach($xml->children() as $sensor)
{
echo $sensor->name." <br />";
echo "Temperature : ".$sensor->temp." <br />";
echo "<hr/>";
}
echo "</h1>";
?>
One temperature
PHP code
<?php
// Loading the XML file
$xml = simplexml_load_file("http://88.87.29.196:8002/status.xml");
echo "<h1>";
foreach($xml->children() as $sensor)
{
if ($sensor->name == "Office inside" )
{
echo $sensor->name." <br />";
echo $sensor->temp." <br />";
}
}
echo "</h1>";
?>
Default:
IP address: 192.168.1.199
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1
Username: admin
Password: admin
Reset to Default Settings:
Hold Reset button for 10 seconds
Manufacturer:
KMTronic LTD
Model:
--------
Features:
• Measures Temperatures from -55°C to +125°C (-67°F to +257°F)
• Support up to 4 DS18B20 temperature sensors
Specifications:
DS18B20
http://www.maximintegrated.com/sensors-and-sensor-interface/DS18B20.html
Supply:
Requires external 12 volt DC / 600mA power supply
Software examples:
http://www.info.kmtronic.com/temperature.html