mirror of https://github.com/arendst/Tasmota.git
Merge pull request #15886 from KG3RK3N/development
Fix missing sign of current power value on smart meter AS2020
This commit is contained in:
commit
fc12056787
|
@ -3993,7 +3993,7 @@ extern char *SML_GetSVal(uint32_t index);
|
|||
} else {
|
||||
|
||||
|
||||
#ifdef ED300L
|
||||
#if defined(ED300L) || defined(AS2020)
|
||||
fvar = SML_Status(fvar1);
|
||||
#else
|
||||
fvar = 0;
|
||||
|
|
|
@ -1236,7 +1236,7 @@ void Hexdump(uint8_t *sbuff, uint32_t slen) {
|
|||
AddLogData(LOG_LEVEL_INFO, cbuff);
|
||||
}
|
||||
|
||||
#ifdef ED300L
|
||||
#if defined(ED300L) || defined(AS2020)
|
||||
uint8_t sml_status[MAX_METERS];
|
||||
uint8_t g_mindex;
|
||||
#endif
|
||||
|
@ -1283,6 +1283,16 @@ double dval;
|
|||
sml_status[g_mindex]=*(cp+2);
|
||||
}
|
||||
#endif
|
||||
#ifdef AS2020
|
||||
unsigned char *cpx=cp-5;
|
||||
// decode OBIS 0180 amd extract direction info
|
||||
if (*cp==0x64 && *cpx==0 && *(cpx+1)==0x01 && *(cpx+2)==0x08 && *(cpx+3)==0) {
|
||||
sml_status[g_mindex]=*(cp+2);
|
||||
}
|
||||
if (*cp==0x63 && *cpx==0 && *(cpx+1)==0x01 && *(cpx+2)==0x08 && *(cpx+3)==0) {
|
||||
sml_status[g_mindex]=*(cp+1);
|
||||
}
|
||||
#endif
|
||||
|
||||
cp=skip_sml(cp,&result);
|
||||
// check time
|
||||
|
@ -1398,6 +1408,15 @@ double dval;
|
|||
dval*=-1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef AS2020
|
||||
// decode current power OBIS 00 10 07 00
|
||||
if (*cpx==0x00 && *(cpx+1)==0x10 && *(cpx+2)==0x07 && *(cpx+3)==0) {
|
||||
if (sml_status[g_mindex]&0x08) {
|
||||
// and invert sign on solar feed
|
||||
dval*=-1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return dval;
|
||||
}
|
||||
|
@ -2099,7 +2118,7 @@ void SML_Decode(uint8_t index) {
|
|||
// matches, get value
|
||||
dvalid[vindex] = 1;
|
||||
mp++;
|
||||
#ifdef ED300L
|
||||
#if defined(ED300L) || defined(AS2020)
|
||||
g_mindex=mindex;
|
||||
#endif
|
||||
if (*mp == '#') {
|
||||
|
@ -3026,7 +3045,7 @@ uint32_t SML_SetBaud(uint32_t meter, uint32_t br) {
|
|||
uint32_t SML_Status(uint32_t meter) {
|
||||
if (meter<1 || meter>meters_used) return 0;
|
||||
meter--;
|
||||
#ifdef ED300L
|
||||
#if defined(ED300L) || defined(AS2020)
|
||||
return sml_status[meter];
|
||||
#else
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue