Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential Predbat Interwork issue #81

Open
dbw1966 opened this issue Aug 30, 2024 · 1 comment
Open

Potential Predbat Interwork issue #81

dbw1966 opened this issue Aug 30, 2024 · 1 comment

Comments

@dbw1966
Copy link

dbw1966 commented Aug 30, 2024

See Predbat issue #1407.

Inconsistent PV today data spotted, coincident with logs in HA showing for example

2024-08-29 18:37:15.405 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'solarPVAmps' when rendering '{{ value_json.solarPVAmps }}'
2024-08-29 19:37:16.917 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'batterySOC' when rendering '{{ value_json.batterySOC }}'

Logfile attached.
HA Log DW 240830 1008.txt

Maybe error handling at Predbat not accurate?

@dbw1966
Copy link
Author

dbw1966 commented Aug 31, 2024

Someone on FB pointed to an error in the code for sofar2mqtt. The last lines read

bool checkCRC(uint8_t frame[], byte frameSize)
{
unsigned int calculated_crc, received_crc;

received_crc = ((frame[frameSize-2] << 8) | frame[frameSize-1]);
calcCRC(frame, frameSize);
calculated_crc = ((frame[frameSize-2] << 8) | frame[frameSize-1]);
return (received_crc = calculated_crc);

}

And they should have read
bool checkCRC(uint8_t frame[], byte frameSize)
{
unsigned int calculated_crc, received_crc;

received_crc = ((frame[frameSize-2] << 8) | frame[frameSize-1]);
calcCRC(frame, frameSize);
calculated_crc = ((frame[frameSize-2] << 8) | frame[frameSize-1]);
return (received_crc == calculated_crc);

}

== is the comparitor that should have been used.

I will see if this fixes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant