-
Notifications
You must be signed in to change notification settings - Fork 2
ME3000: support charge/discharge power #42
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
base: me3000_qol
Are you sure you want to change the base?
ME3000: support charge/discharge power #42
Conversation
…er reported in separate register. everything working, need to check for regressions.
…er reported in separate register. everything working, need to check for regressions.
…er reported in separate register. everything working, need to check for regressions.
| f"Received a request for {register['name']} but mode value: {new_value} is not a known mode. Ignoring") | ||
| if 'function' not in register: | ||
| logging.error(f"No function was provided for register {register['name']} skipping write operation. Check the JSON is configured correctly.") | ||
| continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one is just a syntax change, the logic stays the same.
instead of "if, then, else", i use a "if not" and the continue keyword.
the rest of the diff is just just indentation changes, each line is unindented by 1 increment.
| register, raw_value) | ||
| while retry > 0: | ||
| if self.raw_data[register['name']] == int(new_raw_value): | ||
| if int(self.raw_data[register['name']]) == int(new_raw_value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this change and the 2 that follow, I think the LLM wrote this. it's cosmetic, I can remove them if you want
|
|
||
| def update_state(self): | ||
| for register in self.config['registers']: | ||
| if not register.get('read', True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one is for the charge_discharge_power register that can't be read from, only written to (supposedly)
| from_raw = self.raw_data.get(register.get('name')) | ||
| from_value = self.translate_from_raw_value( | ||
| register, from_raw) | ||
| try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catching any conversion errors here to allow the rest of the registers to be processed normally.
| start_register = int(block['start_register'], 16) | ||
| required_length = int(block['length']) | ||
| values = [] | ||
| raw_value = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused variables.
|
The result is beautiful 🥲 Screen.Recording.2026-01-14.at.20.49.08-1.movScreen.Recording.2026-01-14.at.20.49.08.movI used an input number and an automation in HA to bind the slider to the MQTT topic. |
Alright. Support for ME3000SP desired battery charge/discharge power in passive mode.
Summary of changes:
readflag. if true or absent: read it. if false: don't read it. needed for charge_discharge_power that is write only (as far as I can tell)Checks (serial number checks bypassed):
Not working yet: