Http integration on local server

Hi everyone, I have a Chirstack server up and running with a gateway and some devices, everything is up and I guess it’s working fine.

Now i want show the data im receiving on a simple web page i been working on, everything is running locally

Is http integration enough for this? I also want to send data from the web page.

Also and this is too much but is there any guide or example for integration in Javascript.

Hey there!
To be honest, I don’t know how to execute this use case, but maybe you can try platforms like Albato. They have HTTP capability - HTTP Request/Outgoing webhook Integrations | Connect your apps with Albato

Did you get this solved - i know it is kind of an old post.

what exactly you wanted to achieve?

Sorry for the slow response - i have been on vacation. I have some sensors that connect to a mikrotik gateway. The gateway connects to chirpstack and chirpstack is supposed to forward to a php page using the http integration. However, i get intermittent packets to the php page. I might get three or four then skip two or three then get one then skip then get more. I can’t figure out why

please show us some logs.once throughly verify your php code.

Which logs would help and where are they located? The php code is good because some of the packets come through. If the php was bad none would come through. Unfortunately i can’t find a pattern to which ones don’t go.

I use python and all the uplinks are good. The problem is in your code . so whats your php design like what are you using for http integration?

Ok - so the sensor is seding through a mikrotik router which is in my chirpstack. The communication there works fine as seen in the screen shot below. Every 15 minutes a packet is received. Chirpsatack only shows the last 10 ppackets but it shows the problem. The packets for 6:33 and 6:48 are not received by the php page. Also below is the text saved by the php file. And finally here is my php


<?php

date_default_timezone_set("America/Los_Angeles");

$file = "./heltecdata.txt";
file_put_contents($file,"\n---- data rec'd ", FILE_APPEND |LOCK_EX);
file_put_contents($file,date("Y-m-d H:i:s"), FILE_APPEND |LOCK_EX);
file_put_contents($file,"\n", FILE_APPEND |LOCK_EX);

$json = file_get_contents('php://input');
$data = json_decode($json, true);

if (empty($data)) {file_put_contents($file, "File error decoding json", FILE_APPEND | LOCK_EX); exit();}
//else {
//	foreach($data as $key => $val) {
//		file_put_contents($file, "\nKEY IS: ".$key." val is: ".$val, FILE_APPEND | LOCK_EX);
//		foreach($val as $_key => $_val) {
//			file_put_contents($file, "\n     Key IS: ".$_key."  val is: ".$_val, FILE_APPEND | LOCK_EX);
//		}
//	}
//}
file_put_contents("./heltecdataraw.txt","-------------------------------\n--JSON\n", FILE_APPEND |LOCK_EX);
file_put_contents("./heltecdataraw.txt",$json, FILE_APPEND |LOCK_EX);
file_put_contents("./heltecdataraw.txt","\n", FILE_APPEND | LOCK_EX);
file_put_contents("./heltecdataraw.txt","--DATA\n", FILE_APPEND | LOCK_EX);
file_put_contents("./heltecdataraw.txt",$data, FILE_APPEND |LOCK_EX);
file_put_contents("./heltecdataraw.txt","\n", FILE_APPEND | LOCK_EX);
//file_put_contents("./heltecdataraw.txt","--SDATA\n", FILE_APPEND | LOCK_EX);
//file_put_contents("./heltecdataraw.txt",$sdata, FILE_APPEND |LOCK_EX);


$sensdata = $data['data'];
$sensdatab64 = base64_decode($sensdata);
$sensdatahex = bin2hex($sensdatab64);
//file_put_contents($file, "\nsensdata is: ".$sensdata."  sensdatahex is: ".$sensdatahex." - ".$sensdatab64."\n+++++++++++++\n", FILE_APPEND | LOCK_EX);

$ztime = strtotime($data['time']);
$ltime = date("Y-m-d H:i:s", $ztime);

$devname = $data['deviceInfo']['deviceName'];
if ($devname == "Makerfab Soil Sensor") {
	$soil = hexdec(substr($sensdatahex,4,4));
	$abat = hexdec(substr($sensdatahex,8,2));
	$hum = hexdec(substr($sensdatahex,10,4));
	$senstemp = hexdec(substr($sensdatahex,14,4));
}
elseif ($devname == "GM Thermocouple") {
	$t1f = hexdec(substr($sensdatahex,0,2));
	$t2f = hexdec(substr($sensdatahex,2,2));
	$t3f = hexdec(substr($sensdatahex,4,2));
	$t4f = hexdec(substr($sensdatahex,6,2));
	$t5f = hexdec(substr($sensdatahex,8,2));
	$file = "./tcdata.csv";
	$data_str = $ltime.",Device=".$devname.", Hexstr".$sensdatahex.",".$t1f.",".$t2f.",".$t3f.",".$t4f.",".$t5f."\n";
	
}
else {
	$abat = hexdec(substr($sensdatahex,0,2));
	$htemp = hexdec(substr($sensdatahex,2,2));
	$soil = hexdec(substr($sensdatahex,4,2));
	$senstemp = hexdec(substr($sensdatahex,6,2));
	$hum = hexdec(substr($sensdatahex,8,2));
}

$ztime = strtotime($data['time']);
$ltime = date("Y-m-d H:i:s", $ztime);

file_put_contents($file, $data_str, FILE_APPEND | LOCK_EX);
/*file_put_contents($file, ", Device= ".$devname, FILE_APPEND | LOCK_EX);
file_put_contents($file, ", HexStr= ".$sensdatahex, FILE_APPEND | LOCK_EX);
file_put_contents($file, ", T1 = ".$t1f, FILE_APPEND | LOCK_EX);
file_put_contents($file, ", T2 = ".$t2f, FILE_APPEND | LOCK_EX);
file_put_contents($file, ", T3 = ".$t3f, FILE_APPEND | LOCK_EX);
file_put_contents($file, ", T4 = ".$t4f, FILE_APPEND | LOCK_EX);
file_put_contents($file, ", T5 = ".$t5f, FILE_APPEND | LOCK_EX);
file_put_contents($file, "\n", FILE_APPEND | LOCK_EX);
*/
?>

Chirpstack events

PHP output file
image