Jump to content

RSCP communication with PHP


Brovning

Recommended Posts

Hello,

 

is it possible to implement a RSCP (Remote-Storage-Control-Protocol) communication for a PV-battery with PHP?

I'm experienced with PHP, but I have never implemented a socket communication with PHP...

 

How do I create a frame fulfilling the length constraints (see attached image)?

RSCP_Frame.thumb.png.3bffd14a3cb4f77b7fb194b3b0bc5dc8.png

 

For example, what do I have to do to send the following frame:

Frame:    0xE3    0xDC    0x01    0x00    0x11    0x59    0x7B    0x53    0x00    0x00    0x00    0x00    0x00    0x00    0x00    0x00    0x0E    0x00    0x20    0x00    0x00    0x06    0x00    0x00    0x00    0x12    0x00    0x00    0x01    0x00    0x00    0x00

+ CRC32 Checksum

 

Best regards,

 

Brovning

Edited by Brovning
Link to comment
Share on other sites

Hello,

yes, I tried it, but the server is not responding:

$fp = stream_socket_client("tcp://".$serverIp.":".$serverPort, $errno, $errstr, 30);

$msg = pack("n*", 0xE3DC, 0x0100, 0x1159, 0x7B53, 0x0000, 0x0000, 0x0000, 0x0000, 0x0E00, 0x2000, 0x0006, 0x0000, 0x0012, 0x0000, 0x0100, 0x0000);
$msg .= pack("N", crc32($msg));

if (!$fp) {
    echo "$errstr ($errno)<br />\n";
} else {
    fwrite($fp, $msg);
    while (!feof($fp)) {
        echo fgets($fp, 1024);
    }
    fclose($fp);
}

I'm receiving a timeout after 30 seconds.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.