nfarina / homebridge-tesla

Tesla plugin for homebridge: https://github.com/nfarina/homebridge
154 stars 38 forks source link

Unlock Tesla charging port Feature? #96

Closed davefr90 closed 1 year ago

davefr90 commented 1 year ago

Is it possible to implement the "Unlock charging port" function from the Tesla app?

I use Siri in the garage with my Homepod and when I want to drive and I don't have a Tesla charging cable connected, I always have to go through the app and unlock the charging port. If this existed as a regular switch (not a lock) it would make things a whole lot easier. Then I could just say "unlock charging port" and pull out the cable.

nfarina commented 1 year ago

I think I'm going to change the behavior of the "Charge Port" lock to be about the state of the charge port latch instead of the charge port door. Right now it's strange to see that something is "unlocked" when you're charging and the latch is actually engaged.

When unlocking the charge port, it would either 1) stop charging and disengage latch if plugged in, or 2) open the charge port door.

Any reason not to make this change?

nfarina commented 1 year ago

Actually, I believe it already works this way! If you say "Unlock the charge port" does it not disengage the latch?

davefr90 commented 1 year ago

hi, I can show you the exact variants again. So you know what I mean. If I want to "open the charging port" and the plug is plugged in, the charging process usually starts automatically, so the "charging" function is of course also activated automatically and the charging cable is locked. When the charging process is complete because the desired SOC has been reached, "Charging" switches off and the charging port is still unlocked, but unfortunately the possibility of pulling the cable is currently not possible. But that's because the "Unlock charging cable" function is not yet available in the plugin. A variant would be: If "Charge" is activated and the charging cable is plugged in, the lock is automatically activated and as soon as "Charge" is deactivated (whether manual or automatic), the lock should also unlock so that the charging cable can be pulled out again.

davefr90 commented 1 year ago

E8949996-F839-450C-ABE4-396252FB9234 8EA0B2D6-42FE-4625-9491-9A955CADFD40

nfarina commented 1 year ago

Could you try the new beta version of the plugin? npm install --global homebridge-tesla@beta

I think it should do what you want. The "Charge Port" lock will reflect the state of the latch, and not the state of the charging port door. When you say "Unlock the Charge Port" it should allow you to remove the cable whether the car is charging or not.

nfarina commented 1 year ago

(note that you will need to add "chargePort": true to your plugin config to get the lock)

davefr90 commented 1 year ago

Thank you, yes that is exactly what I need. All people who don't have a Tesla charging cable with a Tesla button to unlock will have a problem. The only thing I'm still missing is unfortunately the biggest problem. Unfortunately, a “door lock” cannot simply be unlocked with a HomePod, as I always have to confirm it with my cell phone before the lock opens, so the “door lock” would have to become a “switch”, is that possible? Since I control everything in the garage by voice, this would be the perfect solution. So I thought that the "locking of the charging cable" could be installed as an extra switch.

davefr90 commented 1 year ago

image

nfarina commented 1 year ago

So the disadvantage to making it a switch is people wouldn't be able to say natural commands like "Open the Charge Port" or "Unlock the Charge Port"; instead you'd have to say "Turn off the Charge Port" etc.

There is a way to bypass HomeKit's security requirements for door locks though! You could create a Scene called something like "Unlatch The Charger" that wouldn't interfere with existing services. And that Scene would trigger a dummy switch to turn "on". You would then have an Automation that reacts to the dummy switch being turned on and unlocks the charge port. That won't require you to confirm on your phone.

davefr90 commented 1 year ago

Unfortunately that is no longer possible or I have already tried it with scenes. but unfortunately the query comes with confirmation on the iPhone 🫤. Apple seems to have changed something when it worked. the charging port can also stay as a door lock, that's ok. Only a switch for “unlock charging cable” would make sense. then you could say: "Activate locking or deactivate locking" this switch does not yet exist in the plugin.

nfarina commented 1 year ago

Hm, it seemed like the workaround people were using recently but it's possible it doesn't work anymore. Have you tried it? I'll give it a try later today.

davefr90 commented 1 year ago

yes I tried it and also extra with different scene names. I could send you a recording of it. I would be surprised if it works for you 😩.

davefr90 commented 1 year ago

😊 could you try it? I would be interested to know if it works for you.

nfarina commented 1 year ago

Just tried it and it worked perfectly! I'm going to use this myself for my "Get the Car Ready" scene in the morning. I like to shout it at HomePod, and it turns on climate, unlocks the charge port, and unlocks the doors (for my kids to get in before me).

Here's what it looks like ("Model Y Door Locks" is a dummy switch):

{
    "accessory": "DummySwitch",
    "name": "Model Y Door Locks",
    "reverse": true
}
[2022-11-3 16:24:27] [Model Y Door Locks] Setting switch to false
[2022-11-3 16:24:27] [Model Y] Tesla reports vehicle is awake.
[2022-11-3 16:24:27] [Model Y] Getting latest vehicle data from Tesla…
[2022-11-3 16:24:28] [Model Y] Vehicle data updated.
[2022-11-3 16:24:28] [Model Y Door Locks] Setting switch to true
[2022-11-3 16:24:29] [Model Y] Tesla reports vehicle is awake.
[2022-11-3 16:24:29] [Model Y] Unlocking vehicle.

davefr90 commented 1 year ago

I wanted to report back. I have now found the error. if i took your plugin with the dummy switch the problem would actually be solved🤗. thank you very much again. Now I can finally set it up correctly everywhere. Thank you very much for the support 💪🏼 my children are happy now too 😅🤝🏼

nfarina commented 1 year ago

Awesome, so glad it’s working for you now! Thanks for the update. ❤️