ME3000: support charge/discharge power#42
ME3000: support charge/discharge power#42zulufoxtrot wants to merge 20 commits intorjpearce:me3000_qolfrom
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.
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.
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.
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.
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 |
|
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: