Is there any documentation available for the SimpleParser channel protocol? It looks like it will be appropriate for interfacing with one of our pieces of equipment, but I don't see anything anywhere about the syntax for the "Expected response" field in the Command Definitions. I also hit an error of "Invalid format of format string" for the datapoint--what's the correct format to use here?
@mdturnerphys Same here! I want to try to make an interface between domoticz and unipi, but no documentation at all :(
Hello @mdturnerphys @JasperJackson!
Simple parser is a tough one :) It was designed as a simple tool to ease the process of implementing custom communication protocols of serial devices. It might be good for parsing 1way communication with a device which only sends data to the line, but for any advanced functionality, I recommend implementing it in ST.
Unfortunately, it is not yet documented but we have requested at least basic description from the Mervis developers... If you want, you can check the example project to be found at downloads.unipi.technology
Thanks, @tomas_hora. I've just gone ahead and written my own in ST, based off the custom serial protocol example. I'm not sure if that sample actually works for serial communications, but for TCP I had to split Case 3 into 2 cases:
3: if io.getportstatus(handle) = 0 then state := 4; end_if; 4: received := io.readport(handle, adr dataRecv, 100); if received > 0 THEN output_string := bytes_to_string(adr dataRecv, received); output_length := len(output_string); command_out := command_in; last_output_time := getutctime(); state:=5; END_IF;
Not doing this seemed to result in the read buffer being reset before the bytes could be read.