Repository navigation
Conversation
Publish door, boot, tyre pressure and interior temperature entities only when the vehicle model configuration declares them (DOOR, BOOT, J17, INTEMP), and unpublish them otherwise. This removes the rear door entities on 2-door vehicles such as the MG Cyberster (DOOR=1100). Read S35 as an integer when detecting a sunroof: the value 2 alone does not denote a sunroof. WINDOW, BONNUT, BATTERY and EXTEMP are deliberately ignored: real vehicles report 0 for them while still sending the data (e.g. the MG4 reports WINDOW=0000). Add 18 real model configurations as test fixtures.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Use the vehicle model configuration (
vehicleModelConfiguration) to decide which Home Assistant entities a vehicle actually has.DOOR, 4-char positional mask: driver, passenger, rear left, rear right): rear door entities are no longer published on 2-door vehicles such as the MG Cyberster (DOOR=1100).BOOT), tyre pressures (J17) and interior temperature (INTEMP) are published only when declared.S35) is now read as an integer: the value2alone does not denote a sunroof.Codes deliberately not used
Real vehicles report these as
0while still sending the data, so gating on them would hide working entities:WINDOW0000but send state for all 4 windowsEXTEMP0on MG3, ZS, HS, S9 and MG4 UrbanBATTERY0on HS and MG4 Urban, missing on one ZS EVBONNUT0on an MG3 2023 but1on an MG3 2025Comments in
vehicle_info.pyand next to the window sensors record this so nobody re-adds them.Tests
tests/fixtures/vehicle_model_configurations.json: 18 real model configurations (MG4, MG4 Urban, MG3, MG5, ZS EV, ZS Hybrid+, HS PHEV, AS33, S9 PHEV, Cyberster). They come from publictownsmcp/mg-saic-haissue reports plus one captured MG4, and contain no VINs.tests/test_vehicle_info_features.py: flag and mask parsing, and the expected features for every real configuration.tests/test_ha_discovery_feature_gating.py: discovery publishes or unpublishes the gated entities, and keeps the ungated ones even when their codes are0.ruff check,ruff format,mypyandpytest tests(413 passed) pass locally.