Skip to content

Commit 6dba095

Browse files
committed
optdata GUI fix and import rules fix
1 parent cb837cf commit 6dba095

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

HeishaMon/decode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ void decode_optional_heatpump_data(char* data, char* actOptData, PubSubClient &
412412
int maxvalue = atoi(opttopicDescription[Topic_Number][0]);
413413
String dataValue = getOptDataValue(actOptData, Topic_Number);
414414
if (maxvalue == 0) { //this takes the special case where the description is a real value description instead of a mode, so get description index 1
415-
sprintf_P(log_msg, PSTR("{\"data\": {\"heishavalues\": {\"topic\": \"OPTTOP%u\", \"value\": %s, \"description\": \"%s\"}}}"), Topic_Number, dataValue.c_str(),opttopicDescription[Topic_Number][1]);
415+
sprintf_P(log_msg, PSTR("{\"data\": {\"heishavalues\": {\"topic\": \"OPT%u\", \"value\": %s, \"description\": \"%s\"}}}"), Topic_Number, dataValue.c_str(),opttopicDescription[Topic_Number][1]);
416416
} else {
417-
sprintf_P(log_msg, PSTR("{\"data\": {\"heishavalues\": {\"topic\": \"OPTTOP%u\", \"value\": %s, \"description\": \"%s\"}}}"), Topic_Number, dataValue.c_str(),opttopicDescription[Topic_Number][dataValue.toInt() + 1]);
417+
sprintf_P(log_msg, PSTR("{\"data\": {\"heishavalues\": {\"topic\": \"OPT%u\", \"value\": %s, \"description\": \"%s\"}}}"), Topic_Number, dataValue.c_str(),opttopicDescription[Topic_Number][dataValue.toInt() + 1]);
418418
}
419419
rules_event_cb(_F("@"), optTopics[Topic_Number]);
420420
}

HeishaMon/src/rules/rules.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ static int8_t lexer_parse_number(char *text, uint16_t len, uint16_t *pos) {
296296
* The dot cannot be the first character
297297
* and we cannot have more than 1 dot
298298
*/
299-
while(*pos <= len &&
299+
while(*pos < len &&
300300
(
301301
isdigit(current) ||
302302
(i == 0 && current == '-') ||
@@ -320,7 +320,7 @@ static int8_t lexer_parse_number(char *text, uint16_t len, uint16_t *pos) {
320320
static uint16_t lexer_parse_string(char *text, uint16_t len, uint16_t *pos) {
321321
char current = getval(text[*pos]);
322322

323-
while(*pos <= len &&
323+
while(*pos < len &&
324324
(current != ' ' &&
325325
current != ',' &&
326326
current != ';' &&
@@ -363,7 +363,7 @@ static int8_t lexer_parse_quoted_string(char *text, uint16_t len, uint16_t *pos)
363363
static int8_t lexer_parse_skip_characters(char *text, uint16_t len, uint16_t *pos) {
364364
char current = getval(text[*pos]);
365365

366-
while(*pos <= len &&
366+
while(*pos < len &&
367367
(current == ' ' ||
368368
current == '\n' ||
369369
current == '\t' ||

HeishaMon/webfunctions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ int handleJsonOutput(struct webserver_t *client, char* actData, char* actDataExt
12531253
webserver_send_content_P(client, PSTR("\",\"Description\":\""), 17);
12541254

12551255
int maxvalue = atoi(opttopicDescription[topic][0]);
1256-
int value = actOptData[0] == '\0' ? 0 : getOptDataValue(actDataExtra, topic).toInt();
1256+
int value = actOptData[0] == '\0' ? 0 : getOptDataValue(actOptData, topic).toInt();
12571257
if (maxvalue == 0) { //this takes the special case where the description is a real value description instead of a mode, so value should take first index (= 0 + 1)
12581258
value = 0;
12591259
}

0 commit comments

Comments
 (0)