I'm trying to use the ESP8266 EasyIoT Driver to input data from another system, but I'm having trouble understanding the protocol from the GitHub source code.
Maybe someone with a working Arduino / ESP8266 sensor could do a Wireshark log of the TCP-session between the ESP8266 and the EasyIoT server? Preferably a complete sesion from the point where the a new sensor is added in the server, requesting it's unique _nodeId and then starting to transmit some simple data (f.ex. a single temperature reading).
So far I have mostly just been sucessfull at seeing the EasyIoT server debug response to more or less random data like this (strangely the EasyIoT server seems to interpret every single 0xFF as two 0xFF):
geir wrote: I'm trying to use the ESP8266 EasyIoT Driver to input data from another system, but I'm having trouble understanding the protocol from the GitHub source code.
Maybe someone with a working Arduino / ESP8266 sensor could do a Wireshark log of the TCP-session between the ESP8266 and the EasyIoT server? Preferably a complete sesion from the point where the a new sensor is added in the server, requesting it's unique _nodeId and then starting to transmit some simple data (f.ex. a single temperature reading).
So far I have mostly just been sucessfull at seeing the EasyIoT server debug response to more or less random data like this (strangely the EasyIoT server seems to interpret every single 0xFF as two 0xFF):
In your case you have invalid CRC. For every message CRC is calculated. If it's not correct message is ignored. And you need ping every 5s. And also add node in system before send messages to server.
You have also other options to send data to EasyIoT server, like http call. See lua or Arduino IDE examples. I will also add mqtt in future.
I'm aware of the invalid CRC since I was just playing around, sending more or less random data to the EasyIoT server. However I have concluded that a telegram needs to start with 0x68
Since I'm struggling to understand the code in the Arduino library, I would be very thankfull if anyone could provide me the raw bytes sendt and received during a connection of a new ESP8266. First I would need to understand how to correctly request for a _nodeId, then how to send a simple measured value / ping-telegrams if no new values are to be sendt. Since my device can not run the Arduino library, I'm dependant on building the correct TCP-telegram byte for byte. I'm under the impression that the protocol is quite simple, so I guess this should be doable if I just understand the bytes of the protocol telegrams myself.
I would prefer this raw TCP connection over HTTP or similar (which I belive to have higher overhead).
geir wrote: I'm aware of the invalid CRC since I was just playing around, sending more or less random data to the EasyIoT server. However I have concluded that a telegram needs to start with 0x68
Since I'm struggling to understand the code in the Arduino library, I would be very thankfull if anyone could provide me the raw bytes sendt and received during a connection of a new ESP8266. First I would need to understand how to correctly request for a _nodeId, then how to send a simple measured value / ping-telegrams if no new values are to be sendt. Since my device can not run the Arduino library, I'm dependant on building the correct TCP-telegram byte for byte. I'm under the impression that the protocol is quite simple, so I guess this should be doable if I just understand the bytes of the protocol telegrams myself.
I would prefer this raw TCP connection over HTTP or similar (which I belive to have higher overhead).
I do not have Wireshark. Just see code and everything will be clear. In Esp8266EasyIoTMsg.h is message definition, 0x68 is beginning of message and in Esp8266EasyIoT.cpp method process() is main function to handle messages.
I have tried understanding the protocol based on the source, but I guess it's a bit over my level. Maybe you help me out by writing down a typical dialog between ESP8266 and EasyIoT server? Based on what I know so far, I suppose these are the steps:
You chose to add a new device in EasyIoT server and get a 30 second timeframe to connect a new device. The new device is powered up and opens a TCP-connection to the EasyIoT server before the dialog starts:
Maybe the client also needs to tell the server what kind of measurand it is providing (f.ex. temperature)?
Client sends a measured value (f.ex. temperature): 0x68 ...
Client sends a ping if no new value after 5 seconds: 0x68 ...
I would be very thankfull if someone could fill in this dialog with the actual bytes of a real life communication session. Then I guess I will be able to further expand my understanding of different variants of the telegrams with for example multiple sensor and similar.
It's a slow progress, but I'm finally I'm able to make the EasyIoT server respond with a _nodeId for my device!
68 01 FF FF 03 00 FF 00 65 Device asking for _nodeId
68 02 00 00 63 01 FF 02 D4 03 00 Server responding with 0x3000
Guess I will need to "reverse engineer" some more from the Arduino library until my device actually is able to be registered on the server and eventually deliver som data.