Allgemein über Datenlogger, Kommunikation, DFÜ
Moderator: Mod-Team
von sollner11 » 08.10.2012, 18:55
mist, jetzt ist der WR ausgegangen ... zu dunkel habe die Punkte eingefügt alles nochmal installiert /var/www/watcher/logger-src/smw-logger.c: In function ‘main’: /var/www/watcher/logger-src/smw-logger.c:177:9: warning: variable ‘tkdy’ set but not used [-Wunused-but-set-variable]
ich glaube, dass hast du schonmal als unkritisch bezeichnet aber in der solarmax-error-log kommt immer noch: - Code: Alles auswählen
Mon Oct 8 18:33:48 2012 Connected to database solarmax on host localhost Mon Oct 8 18:33:48 2012 Connected to solarmax (192.168.178.90) on port 12345 Mon Oct 8 18:33:48 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Mon Oct 8 18:33:48 2012 Socket contains no data, trying to read again later Mon Oct 8 18:33:48 2012 Received answer: {01;FB;6A|64:KDY=0;KMT=0;KYR=0;KT0=0;TNF=0;TKK=17;PAC=0;UD01=14D4;UD02=171B;ID01=3;ID02=3;SYS=4E93,0|18CE} .... root@raspberrypi:/var/log# cat solarmax-error.log Mon Oct 8 18:33:53 2012 ERROR no regexp match Mon Oct 8 18:33:50 2012 ERROR sending TCP packet
DB wird auch nicht gefüllt hatte es dann nochmal mit einer Kopie deiner Zeile probiert und neu installiert dann war der WR weg kann also erst morgen testen trotzdem vielen Dank Gruss
-
sollner11
- Fleißiges Mitglied

-
- Beiträge: 458
- Registriert: 05.05.2012, 12:15
- PV-Anlage [kWp]: 19,11
- Info: Betreiber
von zagibu » 09.10.2012, 14:56
Da muss dir ein Flüchtigkeitsfehler unterlaufen sein. Die Antwort passt in meine gepostete Regex, hab es mit Online-Tools geprüft.
-
zagibu
- Vielschreiber

-
- - Threadstarter -
-
- Beiträge: 195
- Registriert: 27.07.2010, 16:31
- PV-Anlage [kWp]: 3
- Info: Betreiber
von [Michi] » 09.10.2012, 16:51
Hallo zagibu, da ich auf die gleichen Probleme mit meinem SM8MT2 wie sollner stoße, hab ich euren Thread verfolgt. - Code: Alles auswählen
Tue Oct 9 15:59:40 2012 ERROR sending TCP packet Tue Oct 9 16:00:45 2012 ERROR no regexp match
Tue Oct 9 15:58:40 2012 Connected to solarmax (192.168.178.220) on port 12345 Tue Oct 9 15:58:40 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Tue Oct 9 15:58:40 2012 Socket contains no data, trying to read again later Tue Oct 9 15:58:40 2012 Received answer: {01;FB;77|64:KDY=B8;KMT=80;KYR=C2;KT0=C2;TNF=1389;TKK=2B;PAC=18B8;UD01=149D;UD02=14D4;ID01=54;ID02=1F2;SYS=4E28,0|1BE6} Tue Oct 9 15:58:45 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Tue Oct 9 15:58:45 2012 Received answer: Tue Oct 9 15:58:45 2012 Waiting for about 1 minute ...
Hier mal meine smw-logger.c - Code: Alles auswählen
/* Simple solarmax logger c program written by zagibu@gmx.ch in July 2010 This program was originally licensed under WTFPL 2 http://sam.zoy.org/wtfpl/ It is now licensed under GPLv2 or later http://www.gnu.org/licenses/gpl2.html
You need the mysql client library files installed to be able to compile it.
Compile with: gcc -W -Wall -Wextra -Wshadow -Wlong-long -Wformat -Wpointer-arith -rdynamic -pedantic-errors -std=c99 -o smw-logger smw-logger.c -lmysqlclient
Run with: ./smw-logger /path/to/config-file
Structure of the config-file:
Debug=0 Loginterval=60 Waitinterval=200 DBhost=localhost DBname=solarmax DBtabprefix=log DBuser=solaruser DBpass=userpassword Hostname=192.168.178.35 Hostport=12345 NumberOfInverters=1
You can set DEBUG to 1 to get detailed output in a separate logfile.
It is recommended to schedule the smw-logger to be started between 5:00 - 6:00 in the morning and stopped between 22:00 and 23:00 in the evening (compare with sunshine duration). The smw-logger has no built-in facility for logging, so use CRON or similar.
Example CRON entries: 00 05 * * * /usr/local/bin/smw-logger /usr/local/etc/smw-logger.conf 00 23 * * * killall smw-logger
Sources: - http://www.linuxhowtos.org/C_C++/socket.htm - http://wwwuser.gwdg.de/~kboehm/ebook/21_kap15_w6.html#49329 - http://man.cx/setbuf%283%29 - http://allfaq.org/forums/t/169895.aspx - http://dev.mysql.com/tech-resources/articles/mysql-capi-tutorial.html */
#define _GNU_SOURCE
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <mysql/mysql.h> #include <regex.h> #include <time.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <pthread.h>
FILE* error_file = NULL; char error_file_name[512]; char* error_mode = "w"; FILE* debug_file = NULL; char debug_file_name[512]; char* debug_mode = "w"; FILE* config_file = NULL; char* config_file_name; char* config_mode = "r"; int sockfd, portno, n, log_interval, logavg_interval, result, counter, wait_interval, active_max, nr_of_maxes, DEBUG; // Renamed this flag because it is used for connection and regexp problems int failure_flag = 0; struct sockaddr_in serv_addr; struct hostent* server; char dbhost[512]; char dbname[512]; char dbtabprefix[512]; char dbuser[512]; char dbpass[512]; char hostaddr[512]; char line[512]; char* message; char* expression = "...=([0-9A-F]*);...=([0-9A-F]*);...=([0-9A-F]*);...=([0-9A-F]*);...=([0-9A-F]*);...=([0-9A-F]*);...=([0-9A-F]*);....=([0-9A-F]*);....=([0-9A-F]*);....=([0-9A-F]*);....=([0-9A-F]*);...=([0-9A-F]*)";
int kdy, kmt, kyr, kt0, tnf, tkk, pac, ud01, ud02, id01, id02,sys; char buffer[512], buffer2[512]; char query[512]; char* temp; regex_t rx; regmatch_t* matches; MYSQL* connection = NULL; // average stuff vars int i;
void error_exit(const char* msg) { perror(msg); if (error_file != NULL) fclose(error_file); if (debug_file != NULL) fclose(debug_file); exit(0); }
void debug_entry(char* msg) { time_t timestamp = time(NULL); char debug_msg[512]; char *time_now = ctime(×tamp); time_now[strlen(time_now)-1]=0; if (debug_file == NULL) error_exit("ERROR writing to debug.log file"); sprintf(debug_msg, "%s %s", time_now, msg); fprintf(debug_file, "%s\n", debug_msg); }
void error_retry(char* msg) { time_t timestamp = time(NULL); char error_msg[512]; char *time_now = ctime(×tamp); time_now[strlen(time_now)-1]=0; if (error_file == NULL) error_exit("ERROR writing to error.log file"); sprintf(error_msg, "%s %s", time_now, msg); fprintf(error_file, "%s\n", error_msg); }
void set_nonblock(int sock) { int flags; flags = fcntl(sock,F_GETFL,0); if (flags == -1) error_exit("ERROR no valid flags on socket"); fcntl(sock, F_SETFL, flags | O_NONBLOCK); }
int main(int argc, char *argv[]) { // Hold the time to wait between single requests. //int logavg_interval = 5;
// Check commandline arguments if (argc < 2) error_exit("ERROR program needs config-file as parameter");
//Read Config File config_file_name = argv[1]; FILE *fp = fopen(config_file_name, config_mode);
// Read variables if (fp) { while (fgets(line, sizeof(line), fp)) { sscanf(line, "Debug=%d[^\n]", &DEBUG); sscanf(line, "Errorfile=%[^\n]", error_file_name); sscanf(line, "Debugfile=%[^\n]", debug_file_name); sscanf(line, "Loginterval=%d[^\n]", &log_interval); sscanf(line, "Logavginterval=%d[^\n]", &logavg_interval); sscanf(line, "Waitinterval=%d[^\n]", &wait_interval); sscanf(line, "DBhost=%[^\n]", dbhost); sscanf(line, "DBname=%[^\n]", dbname); sscanf(line, "DBtabprefix=%[^\n]", dbtabprefix); sscanf(line, "DBuser=%[^\n]", dbuser); sscanf(line, "DBpass=%[^\n]", dbpass); sscanf(line, "Hostname=%[^\n]", hostaddr); sscanf(line, "Hostport=%d[^\n]", &portno); sscanf(line, "NumberOfInverters=%d[^\n]", &nr_of_maxes); } } fclose(fp);
// Try to open error log file if ((error_file = fopen(error_file_name, error_mode)) == NULL) error_exit("ERROR opening error.log file");
// Make file unbuffered setbuf(error_file, NULL);
// create the arrays for the average calculation long tkdy[nr_of_maxes], tkmt[nr_of_maxes], tkyr[nr_of_maxes], tkt0[nr_of_maxes], ttnf[nr_of_maxes], ttkk[nr_of_maxes], tpac[nr_of_maxes], tud01[nr_of_maxes], tud02[nr_of_maxes], tid01[nr_of_maxes], tid02[nr_of_maxes], tsys[nr_of_maxes]; // calculate the requests per log_interval // TODO -2 is a dirty fix to avoid desync int logavg_pertick = (int)((log_interval-2)/logavg_interval);
// Try to open debug log file, if necessary if(DEBUG) { if((debug_file = fopen(debug_file_name, debug_mode)) == NULL) error_exit("ERROR opening debug.log file");
// Make file unbuffered setbuf(debug_file, NULL); }
// Try to compile regular expression result = regcomp(&rx, expression, REG_EXTENDED); if (result != 0) { regerror(result, &rx, expression, sizeof(expression)); regfree(&rx); sprintf(buffer, "ERROR invalid regular expression: %s", expression); error_exit(buffer); }
// Try to reserve memory for matches matches = (regmatch_t *) malloc((rx.re_nsub + 1) * sizeof(regmatch_t)); if (!matches) error_exit("Out of memory");
// Connect to database connection = mysql_init(NULL); if (!mysql_real_connect(connection, dbhost, dbuser, dbpass, dbname, 0, NULL, 0)) error_exit(mysql_error(connection));
if (DEBUG) { sprintf(buffer, "Connected to database %s on host %s", dbname, dbhost); debug_entry(buffer); }
while (1) {
// set variable to default value or it will keep trying to reconnect failure_flag = 0;
// Check if connection to db-server must be re-established if (mysql_ping(connection)) {
//TODO Maybe a reconnect (if needed) here ? // Connect to database if (!mysql_real_connect(connection, dbhost, dbuser, dbpass, dbname, 0, NULL, 0)) error_exit(mysql_error(connection));
if (DEBUG) { sprintf(buffer, "Connected to database %s on host %s", dbname, dbhost); debug_entry(buffer); } }
// Try to open socket for communication with solarmax sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { error_retry("Can't open any socket"); sleep(60); continue; }
// Try to resolve solarmax address/hostname server = gethostbyname(hostaddr); if (server == NULL) { sprintf(buffer, "Can't resolve \"%s\"", hostaddr); error_retry(buffer); sleep(60); continue; }
// Try to establish a connection with solarmax //portno = atoi(argv[2]); bzero((char *) &serv_addr, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; bcopy((char *) server->h_addr, (char *) &serv_addr.sin_addr.s_addr, server->h_length); serv_addr.sin_port = htons(portno); if (connect(sockfd, (struct sockaddr*) &serv_addr, sizeof(serv_addr)) < 0) { sprintf(buffer, "%s: Can't connect to solarmax (%s) on port %d", strerror(errno), hostaddr, portno); error_retry(buffer); sleep(60); continue; }
// Make socket non-blocking set_nonblock(sockfd);
if (DEBUG) { sprintf(buffer, "Connected to solarmax (%s) on port %d", hostaddr, portno); debug_entry(buffer); }
// Start sending the data requests and logging the answers while (1) { time_t start_time = time(NULL); for (i = 0; i < nr_of_maxes; ++i) { tkdy[i] = tkmt[i] = tkyr[i] = tkt0[i] = ttnf[i] = ttkk[i] = tpac[i] = tud01[i] = tud02[i] = tid01[i] = tid02[i] = tsys[i] = 0; }
// Get the current time for (i = 0; i < logavg_pertick; ++i) { time_t single_start_time = time(NULL); // We have to get out of this while-loop to reestablish the connection to the inverter if (failure_flag == 1){ debug_entry("Looks like we lost our connection to solarmax, reconnecting..."); break; }
for(active_max = 1; active_max <= nr_of_maxes; active_max++){
// Generate message according to device address of solarmax:
// Could be something like this: // sprintf(message, "{FB;0%d;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;PRL;IL1;IDC;UL1;UDC;SYS|%s}", active_max, 16_bit_checksum // For further information on the protocol refer to: http://blog.dest-unreach.be/2009/04/15/solarmax-maxtalk-protocol-reverse-engineered
// Until someone comes up with a nice solution to calculate the checksum, lets stick to a few precalculated message strings (tested only for 2 maxes!): if (active_max == 1) { message = "{FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe}"; } else if (active_max == 2) { message = "{FB;02;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;PRL;IL1;IDC;UL1;UDC;SYS|119A}"; } else if (active_max == 3) { message = "{FB;03;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;PRL;IL1;IDC;UL1;UDC;SYS|119B}"; } else if (active_max == 4) { message = "{FB;04;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;PRL;IL1;IDC;UL1;UDC;SYS|119C}"; } else if (active_max == 5) { message = "{FB;05;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;PRL;IL1;IDC;UL1;UDC;SYS|119D}"; } else if (active_max == 6) { message = "{FB;06;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;PRL;IL1;IDC;UL1;UDC;SYS|119E}"; } else if (active_max == 7) { message = "{FB;07;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;PRL;IL1;IDC;UL1;UDC;SYS|119F}"; } else if (active_max == 8) { message = "{FB;08;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;PRL;IL1;IDC;UL1;UDC;SYS|11A0}"; } else if (active_max == 9) { message = "{FB;09;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;PRL;IL1;IDC;UL1;UDC;SYS|11A1}"; } else { error_exit("ERROR invalid hardware address; currently works only for 9 maxes"); }
if (DEBUG) { sprintf(buffer, "Sending message: %s", message); debug_entry(buffer); }
// Send message n = write(sockfd,message,strlen(message)); if (n < 0) { close(sockfd); error_retry("ERROR sending TCP packet"); failure_flag = 1; break; }
// Read answer bzero(buffer, 256); n = read(sockfd, buffer, 255); for (counter = 0; counter < wait_interval && n < 0; counter++) { if (DEBUG) debug_entry("Socket contains no data, trying to read again later"); usleep(10000); n = read(sockfd, buffer, 255); }
if (n < 0) { close(sockfd); error_retry("ERROR receiving TCP packet"); failure_flag = 1; break; }
if (DEBUG) { sprintf(buffer2, "Received answer: %s", buffer); debug_entry(buffer2); }
// Extract the data fields from answer result = regexec(&rx, buffer, rx.re_nsub + 1, matches, 0); if (result) { regerror(result, &rx, buffer, sizeof(buffer)); //error_exit("ERROR no regexp match"); error_retry("ERROR no regexp match"); // TODO Create flag for this kind of failure or rename this one failure_flag = 2; break; }
// Convert the extracted data fields to integer values temp = strndup(buffer + matches[1].rm_so, matches[1].rm_eo - matches[1].rm_so); kdy = strtol(temp, NULL, 16); free(temp); temp = strndup(buffer + matches[2].rm_so, matches[2].rm_eo - matches[2].rm_so); kmt = strtol(temp, NULL, 16); free(temp); temp = strndup(buffer + matches[3].rm_so, matches[3].rm_eo - matches[3].rm_so); kyr = strtol(temp, NULL, 16); free(temp); temp = strndup(buffer + matches[4].rm_so, matches[4].rm_eo - matches[4].rm_so); kt0 = strtol(temp, NULL, 16); free(temp); temp = strndup(buffer + matches[5].rm_so, matches[5].rm_eo - matches[5].rm_so); ttnf[active_max-1] += strtol(temp, NULL, 16); free(temp); temp = strndup(buffer + matches[6].rm_so, matches[6].rm_eo - matches[6].rm_so); ttkk[active_max-1] += strtol(temp, NULL, 16); free(temp); temp = strndup(buffer + matches[7].rm_so, matches[7].rm_eo - matches[7].rm_so); tpac[active_max-1] += strtol(temp, NULL, 16) / 2; free(temp); temp = strndup(buffer + matches[8].rm_so, matches[8].rm_eo - matches[8].rm_so); tud01[active_max-1] += strtol(temp, NULL, 16); free(temp); temp = strndup(buffer + matches[9].rm_so, matches[9].rm_eo - matches[9].rm_so); tud02[active_max-1] += strtol(temp, NULL, 16); free(temp); temp = strndup(buffer + matches[10].rm_so, matches[10].rm_eo - matches[10].rm_so); tid01[active_max-1] += strtol(temp, NULL, 16); free(temp); temp = strndup(buffer + matches[11].rm_so, matches[11].rm_eo - matches[11].rm_so); tid02[active_max-1] += strtol(temp, NULL, 16); free(temp); temp = strndup(buffer + matches[12].rm_so, matches[12].rm_eo - matches[12].rm_so); // tsys[active_max-1] += strtol(temp, NULL, 16); sys = strtol(temp, NULL, 16); free(temp); } if (failure_flag > 0){ break; } //TODO check if the task need more time than logavg_interval sleep(logavg_interval - (time(NULL)-single_start_time)); } // Calculate the average values and insert into db if (failure_flag == 0){ for (i = 0; i < nr_of_maxes; ++i) { ttnf[i] = (int)((ttnf[i]*1.0)/(logavg_pertick*1.0)); ttkk[i] = (int)((ttkk[i]*1.0)/(logavg_pertick*1.0)); tpac[i] = (int)((tpac[i]*1.0)/(logavg_pertick*1.0)); tud01[i] = (int)((tud01[i]*1.0)/(logavg_pertick*1.0)); tud02[i] = (int)((tud02[i]*1.0)/(logavg_pertick*1.0)); tid01[i] = (int)((tid01[i]*1.0)/(logavg_pertick*1.0)); tid02[i] = (int)((tid02[i]*1.0)/(logavg_pertick*1.0)); //tsys[i] = (int)((tsys[i]*1.0)/(logavg_pertick*1.0));
// Construct the query according to active solarmax sprintf(query, "INSERT INTO %s%d (kdy, kmt, kyr, kt0, tnf, tkk, pac, ud01, ud02, id01, id02, sys) VALUES (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d);", dbtabprefix, (i+1), kdy, kmt, kyr, kt0, (int)ttnf[i], (int)ttkk[i], (int)tpac[i], (int)tud01[i], (int)tud02[i], (int)tid01[i], (int)tid02[i], sys); if (DEBUG) { sprintf(buffer, "Executing query: %s", query); debug_entry(buffer); } // Execute the query to write the data into db mysql_query(connection, query); if (mysql_errno(connection)) error_exit(mysql_error(connection)); }
}
// Wait for the specified number of seconds - calc duration - 1 if (DEBUG) debug_entry("Waiting for about 1 minute ..."); // Get the current time time_t stop_time = time(NULL); // TODO check if time needed is > log_interval int sleepTime = log_interval + start_time - stop_time - 1; if(sleepTime > 0) sleep(sleepTime); else{ sprintf(buffer, "!!! sleepTime error. Assuming desync: %i seconds. !!!\n", sleepTime); debug_entry(buffer); }
// Add a busy-loop for the last second to make sure we are perfectly accurate while (time(NULL) < start_time + log_interval) usleep(99999);
// If the connection is lost -> retry if (failure_flag == 1){ // just to be sure close(sockfd); break; } } } return 0; }
Viele Grüße Michi
-
[Michi]
- Öfters hier

-
- Beiträge: 14
- Registriert: 06.07.2012, 22:22
- Info: Interessent
von zagibu » 10.10.2012, 19:33
Hast du um 15:58 auch einen Regex error im Log? Falls ja, hab ich keine Ahnung, woher der kommt, denn das Muster passt auf die Antwort. Macht mal im Regex Match block folgendes: - Code: Alles auswählen
// Extract the data fields from answer result = regexec(&rx, buffer, rx.re_nsub + 1, matches, 0); if (result) { regerror(result, &rx, buffer, sizeof(buffer)); sprintf(buffer); //error_exit("ERROR no regexp match"); error_retry("ERROR no regexp match"); // TODO Create flag for this kind of failure or rename this one failure_flag = 2; break; }
Das sollte eigentlich eine etwas hilfreichere Fehlermeldung ausgeben.
-
zagibu
- Vielschreiber

-
- - Threadstarter -
-
- Beiträge: 195
- Registriert: 27.07.2010, 16:31
- PV-Anlage [kWp]: 3
- Info: Betreiber
von [Michi] » 11.10.2012, 17:10
erstmal Danke für die Info. Da ich das alte log nicht mehr hatte habe ich ein neues erstellt. - Code: Alles auswählen
Thu Oct 11 15:49:24 2012 Connected to solarmax (192.168.178.220) on port 12345 Thu Oct 11 15:49:24 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Thu Oct 11 15:49:24 2012 Socket contains no data, trying to read again later Thu Oct 11 15:49:24 2012 Received answer: {01;FB;75|64:KDY=9A;KMT=A2;KYR=E5;KT0=E5;TNF=1388;TKK=2A;PAC=9FE;UD01=147D;UD02=144E;ID01=47;ID02=97;SYS=4E28,0|1BA0} Thu Oct 11 15:49:29 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Thu Oct 11 15:49:29 2012 Received answer: Thu Oct 11 15:49:29 2012 Waiting for about 1 minute ... Thu Oct 11 15:50:24 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Thu Oct 11 15:50:24 2012 Waiting for about 1 minute ... Thu Oct 11 15:51:24 2012 Connected to solarmax (192.168.178.220) on port 12345 Thu Oct 11 15:51:24 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Thu Oct 11 15:51:24 2012 Socket contains no data, trying to read again later Thu Oct 11 15:51:24 2012 Received answer: {01;FB;75|64:KDY=9B;KMT=A2;KYR=E5;KT0=E5;TNF=1386;TKK=29;PAC=97E;UD01=1457;UD02=1474;ID01=40;ID02=91;SYS=4E28,0|1B5E} Thu Oct 11 15:51:29 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Thu Oct 11 15:51:29 2012 Received answer:
Thu Oct 11 15:48:24 2012 ERROR sending TCP packet Thu Oct 11 15:49:29 2012 ERROR no regexp match Thu Oct 11 15:50:24 2012 ERROR sending TCP packet Thu Oct 11 15:51:29 2012 ERROR no regexp match Thu Oct 11 15:52:24 2012 ERROR sending TCP packet
Immer wenn er den ERROR "no regexp match" bringt, ist "Received answer:" leer. Ein Timing Problem ? Ich habe schon mal die Werte: Logavginterval / Waitinterval geändert, hat aber auch nichts gebracht. Der Code ist doch schon in der smw-logger.c , oder soll der an eine andere Stelle ? Grüße [Michi]
-
[Michi]
- Öfters hier

-
- Beiträge: 14
- Registriert: 06.07.2012, 22:22
- Info: Interessent
von zagibu » 12.10.2012, 15:56
Nein, der Code ist so noch nicht im Logger. Ich habe ein sprintf dazugetan, damit man die Regex-Fehlermeldung hoffentlich besser sieht. Was ich nicht verstehe, ist, warum dein Logger nach 5 Sekunden schon wieder eine Anfrage abschickt.
-
zagibu
- Vielschreiber

-
- - Threadstarter -
-
- Beiträge: 195
- Registriert: 27.07.2010, 16:31
- PV-Anlage [kWp]: 3
- Info: Betreiber
von sollner11 » 12.10.2012, 16:02
ich probiere heute auch weiter ich glaube michi meinte, ob der regexp-code "Schnipsel" in die smw-logger.c einzuarbeiten ist ich denke ja, du willst ja wohl ne Fehlermeldung abfangen Frage: vor und nach jeder veränderung im Quelltext deinstallier ich immer brav alles geht das auch nur mit dem compilieren der smw-logger.c? Gruss Minuten später, wieder nix ... - Code: Alles auswählen
root@raspberrypi:/var/log# cat solarmax-debug.log Fri Oct 12 16:16:19 2012 Connected to database solarmax on host localhost Fri Oct 12 16:16:19 2012 Connected to solarmax (192.168.178.90) on port 12345 Fri Oct 12 16:16:19 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Fri Oct 12 16:16:19 2012 Socket contains no data, trying to read again later Fri Oct 12 16:16:19 2012 Received answer: {01;FB;6A|64:KDY=0;KMT=0;KYR=0;KT0=0;TNF=0;TKK=19;PAC=0;UD01=18FB;UD02=1CD3;ID01=0;ID02=0;SYS=4E93,0|18EE} Fri Oct 12 16:16:24 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Fri Oct 12 16:16:24 2012 Received answer: Fri Oct 12 16:16:24 2012 Waiting for about 1 minute ... Fri Oct 12 16:17:19 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Fri Oct 12 16:17:19 2012 Waiting for about 1 minute ... Fri Oct 12 16:16:27 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Fri Oct 12 16:16:27 2012 Waiting for about 1 minute ... Fri Oct 12 16:17:27 2012 Connected to solarmax (192.168.178.90) on port 12345 Fri Oct 12 16:17:27 2012 Sending message: {FB;01;46|64:KDY;KMT;KYR;KT0;TNF;TKK;PAC;UD01;UD02;ID01;ID02;SYS|10fe} Fri Oct 12 16:17:27 2012 Socket contains no data, trying to read again later Fri Oct 12 16:17:27 2012 Received answer: {01;FB;6A|64:KDY=0;KMT=0;KYR=0;KT0=0;TNF=0;TKK=19;PAC=0;UD01=1905;UD02=1CD8;ID01=0;ID02=0;SYS=4E93,0|18D1} root@raspberrypi:/var/log# cat solarmax-error.log Fri Oct 12 16:16:24 2012 ERROR no regexp match Fri Oct 12 16:17:19 2012 ERROR sending TCP packet root@raspberrypi:/var/log#
-
sollner11
- Fleißiges Mitglied

-
- Beiträge: 458
- Registriert: 05.05.2012, 12:15
- PV-Anlage [kWp]: 19,11
- Info: Betreiber
von sollner11 » 12.10.2012, 16:27
[Michi] hat geschrieben:Immer wenn er den ERROR "no regexp match" bringt, ist "Received answer:" leer.
Habe nie so lange gewartet, ...ist aber hier genauso. abgesehen davon, kommt nie was in der DB an
-
sollner11
- Fleißiges Mitglied

-
- Beiträge: 458
- Registriert: 05.05.2012, 12:15
- PV-Anlage [kWp]: 19,11
- Info: Betreiber
von [Michi] » 12.10.2012, 17:16
hallo, ich habe mal ein wireshark log gemacht und die smw-logger.c auf {FB;01;26|64:KDY;KMT;KT0;KYR;PAC|08BC} geändert. Die Daten stimmen. Für das ändern des Log´s bin ich jedoch zu blöd, beim compilieren kommt die Meldung: logger-src/smw-logger.c:369:23: Fehler: Zu wenige Argumente für Funktion »sprintf« Hast Du das mal bei Dir eingetragen ? - Code: Alles auswählen
Fri Oct 12 16:55:44 2012 Connected to database solarmax on host localhost Fri Oct 12 16:55:44 2012 Connected to solarmax (192.168.178.220) on port 12345 Fri Oct 12 16:55:44 2012 Sending message: {FB;01;26|64:KDY;KMT;KYR;KT0;PAC|08BC} Fri Oct 12 16:55:44 2012 Socket contains no data, trying to read again later Fri Oct 12 16:55:44 2012 Received answer: {01;FB;36|64:KDY=55;KMT=AF;KYR=F2;KT0=F2;PAC=168|0C6E} Fri Oct 12 16:55:49 2012 Sending message: {FB;01;26|64:KDY;KMT;KYR;KT0;PAC|08BC} Fri Oct 12 16:55:49 2012 Received answer: Fri Oct 12 16:55:49 2012 Waiting for about 1 minute ...
Fri Oct 12 16:55:49 2012 ERROR no regexp match Fri Oct 12 16:56:44 2012 ERROR sending TCP packet
Wireshark {FB;01;26|64:KDY;KMT;KT0;KYR;PAC|08BC} {01;FB;36|64:KDY=56;KMT=AF;KT0=F2;KYR=F2;PAC=166|0C6D}
Gruß [Michi]
-
[Michi]
- Öfters hier

-
- Beiträge: 14
- Registriert: 06.07.2012, 22:22
- Info: Interessent
von sollner11 » 12.10.2012, 17:47
du meinst so? - Code: Alles auswählen
Shall debugging be enabled? (y/n) [N] y /var/www/watcher/logger-src/smw-logger.c: In function ‘main’: /var/www/watcher/logger-src/smw-logger.c:369:23: error: too few arguments to function ‘sprintf’ /var/www/watcher/logger-src/smw-logger.c:177:9: warning: variable ‘tkdy’ set but not used [-Wunused-but-set-variable]
sind wir echt die einzigen mit einem aus der MT-Serie? Gruss ps: geht bei dir der Perl-Logger?
-
sollner11
- Fleißiges Mitglied

-
- Beiträge: 458
- Registriert: 05.05.2012, 12:15
- PV-Anlage [kWp]: 19,11
- Info: Betreiber
Zurück zu Datenlogger
Ähnliche Beiträge
Wer ist online?
Mitglieder in diesem Forum: 0 Mitglieder und 0 Gäste
|