Skip to content

Commit

Permalink
optdata GUI fix and import rules fix
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorYbema committed Jan 16, 2025
1 parent cb837cf commit 6dba095
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions HeishaMon/decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,9 @@ void decode_optional_heatpump_data(char* data, char* actOptData, PubSubClient &
int maxvalue = atoi(opttopicDescription[Topic_Number][0]);
String dataValue = getOptDataValue(actOptData, Topic_Number);
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
sprintf_P(log_msg, PSTR("{\"data\": {\"heishavalues\": {\"topic\": \"OPTTOP%u\", \"value\": %s, \"description\": \"%s\"}}}"), Topic_Number, dataValue.c_str(),opttopicDescription[Topic_Number][1]);
sprintf_P(log_msg, PSTR("{\"data\": {\"heishavalues\": {\"topic\": \"OPT%u\", \"value\": %s, \"description\": \"%s\"}}}"), Topic_Number, dataValue.c_str(),opttopicDescription[Topic_Number][1]);
} else {
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]);
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]);
}
rules_event_cb(_F("@"), optTopics[Topic_Number]);
}
Expand Down
6 changes: 3 additions & 3 deletions HeishaMon/src/rules/rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ static int8_t lexer_parse_number(char *text, uint16_t len, uint16_t *pos) {
* The dot cannot be the first character
* and we cannot have more than 1 dot
*/
while(*pos <= len &&
while(*pos < len &&
(
isdigit(current) ||
(i == 0 && current == '-') ||
Expand All @@ -320,7 +320,7 @@ static int8_t lexer_parse_number(char *text, uint16_t len, uint16_t *pos) {
static uint16_t lexer_parse_string(char *text, uint16_t len, uint16_t *pos) {
char current = getval(text[*pos]);

while(*pos <= len &&
while(*pos < len &&
(current != ' ' &&
current != ',' &&
current != ';' &&
Expand Down Expand Up @@ -363,7 +363,7 @@ static int8_t lexer_parse_quoted_string(char *text, uint16_t len, uint16_t *pos)
static int8_t lexer_parse_skip_characters(char *text, uint16_t len, uint16_t *pos) {
char current = getval(text[*pos]);

while(*pos <= len &&
while(*pos < len &&
(current == ' ' ||
current == '\n' ||
current == '\t' ||
Expand Down
2 changes: 1 addition & 1 deletion HeishaMon/webfunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ int handleJsonOutput(struct webserver_t *client, char* actData, char* actDataExt
webserver_send_content_P(client, PSTR("\",\"Description\":\""), 17);

int maxvalue = atoi(opttopicDescription[topic][0]);
int value = actOptData[0] == '\0' ? 0 : getOptDataValue(actDataExtra, topic).toInt();
int value = actOptData[0] == '\0' ? 0 : getOptDataValue(actOptData, topic).toInt();
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)
value = 0;
}
Expand Down

0 comments on commit 6dba095

Please sign in to comment.