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

Enabling Preconditioning by using switch does not update switch state to ON in 3.0.0 Beta 3 #127

Closed
ismarslomic opened this issue Feb 4, 2024 · 6 comments

Comments

@ismarslomic
Copy link
Collaborator

When switching Preconditioning switch from OFF to ON the climate starts running on the vehicle, and the state of the Climate sensor is updated to Heating, but the Preconditioning switch has state OFF.

I thought this was because of the state were not refreshed yet (polling interval) from the vehicle, but still after 9 minutes no state change of the switch.

image
@msp1974
Copy link
Owner

msp1974 commented Feb 4, 2024

I think it is possibly looking at the wrong status attribute. Can you do a diag file when it is running preconditioning to see what is set. I thought it would be EV_PRECONDITION_OPERATING_STATUS but maybe not, or it is set to something other than "ON".

It may also be that in PHEVs this is different again as Liam states in issue #125 that he has options for both Engine Climate and Electric Climate (depending on if charging or not) which I presume is both our Climate and Preconditioning switches.

@ismarslomic
Copy link
Collaborator Author

ismarslomic commented Feb 4, 2024

Diagnostic when precondition was disabled:
config_entry-jlrincontrol-precondition-disabled.json.txt

Diagnostic when precondition just got enabled:
config_entry-jlrincontrol-precondition-enabled.json.txt

Diagnostic when precondition was enabled for 9 mins:
config_entry-jlrincontrol-precondition-enabled-in-9-mins.json.txt

In v2 of this integration I created my custom binary_sensor for Precondition status and remaining time. This has been shared in the Recipes here.

I choose to use binary_sensor (on/off) for precondition status, but the status actually got 3 states:
PRECLIM (on), OFF and STARTUP (starting). I did not bother to reflect all three states, but only on/off

Note that my car (I Pace Y21) does not support Climate switch, only Precondition (which I guess is the Electric Climate)? So I think Liam should help out with similar diagnostic file for his car for Engine and Electric Climate, so we can make logic supporting both?

@ismarslomic
Copy link
Collaborator Author

Basically logic should be:

if EV_PRECONDITION_OPERATING_STATUS == "OFF":
  switch status = "OFF"
else
  switch status = "ON"  # status is either PRECLIM or STARTUP

@ismarslomic
Copy link
Collaborator Author

ismarslomic commented Feb 4, 2024

Just tested with following changes to the code, and the switch got correct state. It even managed to turn the Preconditioning off as well 🥳

climate_deactivated = get_value_match(
    vehicle.status_ev, "EV_PRECONDITION_OPERATING_STATUS", "OFF"
)

vehicle.tracked_status.climate_active = not climate_deactivated

maybe not the most elegant way to express it, but if you are fine with this logic I can commit this to dev?

@ismarslomic
Copy link
Collaborator Author

Thinking about your point about difference between Engine Climate (Climate) and Electric Climate (Precondition) switches, both switches uses the same state attribute climate_active, should we maybe separate them?

@ismarslomic
Copy link
Collaborator Author

Fixed and verified for both climate switches!

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

No branches or pull requests

2 participants