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

feat: Implemented time response for cloudless time synchronization #82

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

davidrapan
Copy link
Contributor

@davidrapan davidrapan commented Dec 22, 2024

SSIA;

Fixes #81

I think that this could be appropriate solution but what do you think guys?

😉

@davidrapan davidrapan force-pushed the v5_heartbeat_response branch from 42d0d90 to 87abc88 Compare December 22, 2024 01:41
@davidrapan davidrapan force-pushed the v5_heartbeat_response branch from 22da908 to 22b64ca Compare December 22, 2024 01:50
@davidrapan davidrapan changed the title feat: Implemented response to heartbeat packets for cloudless time synchronization feat: Implemented time response for cloudless time synchronization Dec 22, 2024
@davidrapan davidrapan force-pushed the v5_heartbeat_response branch from 786d135 to a3aebf6 Compare December 22, 2024 14:40
@davidrapan davidrapan force-pushed the v5_heartbeat_response branch from a3aebf6 to 1424502 Compare December 22, 2024 14:44
@davidrapan davidrapan force-pushed the v5_heartbeat_response branch from 10f6642 to f16ac48 Compare December 22, 2024 16:11
@davidrapan davidrapan force-pushed the v5_heartbeat_response branch from a900bd8 to c43846c Compare December 25, 2024 19:31
@davidrapan davidrapan force-pushed the v5_heartbeat_response branch from 4e6cb30 to e5d4d94 Compare December 26, 2024 02:38
@davidrapan davidrapan force-pushed the v5_heartbeat_response branch from bc90d2b to 86398b5 Compare December 26, 2024 03:24
@davidrapan davidrapan force-pushed the v5_heartbeat_response branch from 62f10ac to 0a08116 Compare December 26, 2024 04:11
@davidrapan davidrapan force-pushed the v5_heartbeat_response branch from fef2ba1 to 4d120f7 Compare December 26, 2024 04:30
@davidrapan davidrapan force-pushed the v5_heartbeat_response branch 8 times, most recently from 0ab7326 to 305ab8f Compare December 26, 2024 06:00
@davidrapan davidrapan force-pushed the v5_heartbeat_response branch from 305ab8f to c4ce1f7 Compare December 26, 2024 06:16
Copy link
Owner

@jmccrohan jmccrohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial ACK/NAK on this.

serial was poor parameter name choice, but for compatibility reasons, I think it needs to stay.

v5_loggerserial stay as such because it refers to the logger serial number as opposed to that of the inverter (I've had issued raised on how do I enter inverter serial numbers with letters...)

v5_serial... yeah, I've no idea what I was thinking with that variable name. v5_seq or v5_seqno makes a lot more sense.

@@ -269,7 +272,7 @@ def _v5_frame_decoder(self, v5_frame):
raise V5FrameError("V5 frame contains invalid sequence number")
if v5_frame[7:11] != self.v5_loggerserial:
raise V5FrameError("V5 frame contains incorrect data logger serial number")
if v5_frame[3] != self.v5_magic and v5_frame[4] != CONTROL.REQUEST - 0x30:
if v5_frame[3] != self.v5_magic or v5_frame[4] != CONTROL.REQUEST - 0x30:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity, it would be easier if we stuck with either the existing definition of a two byte control code, or else redefine that into two, new, single byte fields. We refer to 0x4510 in some places, and now we are refering to just 0x45. Same with 0x3000 vs 0x30.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You reviewed outdated code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But yes, I'm all for separating those bytes cause handling it that way (using int) is way easier.

@davidrapan
Copy link
Contributor Author

davidrapan commented Dec 28, 2024

serial was poor parameter name choice, but for compatibility reasons, I think it needs to stay.

What compatibility? It's not exposed anywhere. They are together with self.v5_loggerserial which is byte representation of self.serial and self.v5_serial representation of self.sequence_number. This inconsistency is way worse imo (not even mentioning how it drives my OCD nuts 😆) than any incompatibility (which I don't even think there is any given the fact that both are just inner/not exposed attributes).

v5_loggerserial stay as such because it refers to the logger serial number as opposed to that of the inverter (I've had issued raised on how do I enter inverter serial numbers with letters...)

I would totally agree /w this point if it was reflected here too

def __init__(self, address, serial, **kwargs):

But when I was going trough the code cause of building of that v5 header and so I was like wait what?

But you are the boss at the end so...

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

Successfully merging this pull request may close these issues.

Microinverter HEARTBEAT (COUNTER) response implementation for cloudless time synchronization
2 participants