charger: add TIMXON Modbus charger - #32825
Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="templates/definition/charger/timxon.yaml" line_range="6" />
<code_context>
+ - brand: TIMXON
+capabilities: ["meter", "dim"]
+params:
+ - name: modbus
+ choice: ["tcpip", "rs485"]
+ - name: connector
</code_context>
<issue_to_address>
**issue (review_instructions):** The `modbus` parameter is missing an explicit `type` field, which is likely required for template params and inconsistent with how `connector` (and other templates) define choices.
In the templates directory, choice-like parameters are typically declared with an explicit `type: choice` (or another supported type) alongside the `choice` list. Here, `modbus` only defines `choice` without a `type`, while `connector` correctly uses `type: choice`. This likely violates the param definition rules in `templates/README.md` and may cause the renderer to treat `modbus` incorrectly. Please align `modbus` with the documented param schema and with existing charger templates, e.g. by adding `type: choice` or whatever type is prescribed in the README.
<details>
<summary>Review instructions:</summary>
**Path patterns:** `templates/**/*.yaml`
**Instructions:**
Verify that the changes comply to the rules defined in templates/README.md. Also check consistence (wording) with other files inside templates directory.
</details>
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Updated the template parameter schema and all checks are passing now. |
TIMXON evcc Real-Device Test PlanThis document records real-device test results for integrating TIMXON chargers with evcc. Its goal is to verify that the Modbus protocol implementation is safe and stable, and to provide test evidence for a future submission to evcc upstream. 1. Test Objectives
2. Test Environment Information
3. Configuration ExamplesModbus TCPchargers:
- name: timxon_1
type: template
template: tmx
modbus: tcpip
id: 1
host: 192.168.1.30
port: 502
connector: 1Test data: interval: 10s chargers:
USB-RS485chargers:
- name: timxon_1
type: template
template: tmx
modbus: rs485serial
id: 1
device: COM3
baudrate: 9600
comset: "8N1"
connector: 1Note: The current UI display name is 4. UI Template Selection Test
5. Read-Only Diagnostic TestDo not plug in the vehicle or execute start/stop commands yet. Run read-only diagnostics first. .\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 --diagnose --timeout 5sRecord the following output:
Test data: 6. Status Mapping Testevcc uses the A/B/C status model:
7. Start/Stop TestBefore testing, it is recommended to set a low current first, for example 6A. .\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 -i 6PS C:\EVCC> .\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 -i 6 Start charging: .\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 -ePS C:\EVCC> .\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 -e Stop charging: .\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 -dPS C:\EVCC> .\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 -d
8. Current Limit TestSet different current values in sequence and observe the actual device limit and vehicle-side current. .\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 -i 6
.\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 -i 10
.\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 -i 16
Key conclusions:
PS C:\EVCC> .\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 -i 16 9. Meter Data TestRun during charging: .\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 --timeout 5s
Test data: Power: 0W 1.911s Power: 0W 731ms Total time: 3.772s Power: 2106W 1.781s Total time: 4.652s Power: 4197W 1.054s Total time: 6.073s 10. Single-Phase / Three-Phase Test
Note: The current TIMXON driver does not implement the evcc PS C:\EVCC> .\evcc-tmx.exe -c .\evcc.tmx.yaml -l trace charger timxon_1 --timeout 5s Total time: 4.652s 11. Dual-Connector TestIf the device has dual connectors, test
Confirm these points carefully:
12. Full evcc Runtime TestStart full evcc: .\evcc-tmx.exe -c .\evcc.tmx.yaml -l debugOpen the UI:
PS C:\EVCC> .\evcc-tmx.exe -c .\evcc.tmx.yaml -l debug 13. Exceptional Scenario Test
14. Logs and EvidencePlease save the following materials for a future evcc issue / PR:
15. Final Conclusion
16. Summary for evcc MaintainersStart evcc PS C:\EVCC> .\evcc-tmx.exe |
| func (wb *Timxon) Enable(enable bool) error { | ||
| var command uint16 = 2 // Stop | ||
| if enable { | ||
| command = 1 // Start |
There was a problem hiding this comment.
This looks to me like starting and stopping a charge session which is NOT intented?
Enable()/Enabled() deals with granting or revoking permission to charge.
| // ChargedEnergy implements the api.ChargeRater interface | ||
| func (wb *Timxon) ChargedEnergy() (float64, error) { | ||
| energy, err := wb.readUint16(wb.base + timxonRegConChargedEnergy) | ||
| if err != nil { | ||
| return 0, err | ||
| } | ||
|
|
||
| return float64(energy) / 10, nil | ||
| } |
There was a problem hiding this comment.
Is this tested?
When does it start and stop counting the charged energy?
| // ChargeDuration implements the api.ChargeTimer interface | ||
| func (wb *Timxon) ChargeDuration() (time.Duration, error) { | ||
| duration, err := wb.readUint32(wb.base + timxonRegConChargeDuration) | ||
| if err != nil { | ||
| return 0, err | ||
| } | ||
|
|
||
| return time.Duration(duration) * time.Second, nil | ||
| } |
There was a problem hiding this comment.
Is this tested?
When does it start and stop?
| 8: // Faulted | ||
| return api.StatusA, nil | ||
| case | ||
| 1, // Preparing |
There was a problem hiding this comment.
Which status is returned during waiting for rfid card swipe?
|
Thanks for your PR. Please attach the full Modbus reference documentation this PR is based on. |
Summary
Adds support for TIMXON Modbus chargers.
This change includes:
Testing
Tested with: