nfarina / homebridge-tesla

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

How to use with automation? #52

Closed BjornB2 closed 2 years ago

BjornB2 commented 3 years ago

Hi! I wanted to use this to automate my hvac but I am unsure if I need to manually wake the car with the connected switch before I can send a hvac on request. It seems that if my car is asleep the hvac fixed 'not responding' on the tile in the home app. And if I need to switch the connected switch to on, is that where the 1 min wait time for the config is for?

nfarina commented 3 years ago

Sending a command to the car's HVAC will make the plugin "wake up" the car first, just as if you'd turned on the "connection" switch. And yeah waking up the car is not always guaranteed, that's the 1 minute wait time you saw.

BjornB2 commented 3 years ago

Ah I see. And this even works while the hvac switch shows 'not responding'? I assumed it wouldn't even try to send the command then.

nfarina commented 3 years ago

It’s not that “smart” :) telling the hvac to turn on will attempt wakeup regardless of what state it’s in or if it failed before.

BjornB2 commented 3 years ago

image

If I now press the airco button, nothing happens. Also not in the log. All I see is some entries from when I open the home app and the state is checked:

[11/10/2020, 9:28:40 PM] [Model S] Using vehicle "Seven of Nine" with state "asleep"

But it seems the airco button still can be used in an automation, because then I do see the vehicle waking up:

[11/10/2020, 9:31:15 PM] [Model S] Using vehicle "Seven of Nine" with state "asleep" [11/10/2020, 9:31:15 PM] [Model S] Waiting for vehicle to wake up... [11/10/2020, 9:31:21 PM] [Model S] Using vehicle "Seven of Nine" with state "online" [11/10/2020, 9:31:21 PM] [Model S] Set climate to true

I didn't expect this different behavior so I guess I learned something today 😊

BjornB2 commented 3 years ago

I now do see the actions in the log, but strange enough it doesn't actually work. Yesterday morning it worked (Yay!), but later yesterday and this morning it didn't.

[11/11/2020, 12:30:01 PM] [Model S] Using vehicle "Seven of Nine" with state "asleep" [11/11/2020, 12:30:02 PM] [Model S] Using vehicle "Seven of Nine" with state "asleep" [11/11/2020, 12:30:03 PM] [Model S] Using vehicle "Seven of Nine" with state "asleep" [11/11/2020, 12:30:06 PM] [Model S] Using vehicle "Seven of Nine" with state "asleep" [11/11/2020, 12:30:06 PM] [Model S] Waiting for vehicle to wake up... [11/11/2020, 12:30:07 PM] [Model S] Using vehicle "Seven of Nine" with state "asleep" [11/11/2020, 12:30:07 PM] [Model S] Waiting for vehicle to wake up... [11/11/2020, 12:30:10 PM] [Model S] Using vehicle "Seven of Nine" with state "asleep" [11/11/2020, 12:30:10 PM] [Model S] Waiting for vehicle to wake up... [11/11/2020, 12:30:15 PM] [Model S] Using vehicle "Seven of Nine" with state "asleep" [11/11/2020, 12:30:15 PM] [Model S] Waiting for vehicle to wake up... [11/11/2020, 12:30:21 PM] [Model S] Using vehicle "Seven of Nine" with state "online" [11/11/2020, 12:30:21 PM] [Model S] Set climate to true [11/11/2020, 1:00:00 PM] [Model S] Using vehicle "Seven of Nine" with state "online" [11/11/2020, 1:00:01 PM] [Model S] Climate on? false [11/11/2020, 1:00:02 PM] [Model S] Using vehicle "Seven of Nine" with state "online" [11/11/2020, 1:00:03 PM] [Model S] Using vehicle "Seven of Nine" with state "online" [11/11/2020, 1:00:05 PM] [Model S] Using vehicle "Seven of Nine" with state "online" [11/11/2020, 1:00:05 PM] [Model S] Set climate to false

It does say it sets the climate to true, but when the trigger I made for turning it off again after 30 minutes if I am still at home, you see it detects it was not actually on,.

[11/12/2020, 7:50:01 AM] [Model S] Using vehicle "Seven of Nine" with state "offline" [11/12/2020, 7:50:02 AM] [Model S] Using vehicle "Seven of Nine" with state "offline" [11/12/2020, 7:50:03 AM] [Model S] Using vehicle "Seven of Nine" with state "offline" [11/12/2020, 7:50:05 AM] [Model S] Using vehicle "Seven of Nine" with state "offline" [11/12/2020, 7:50:05 AM] [Model S] Waiting for vehicle to wake up... [11/12/2020, 7:50:07 AM] [Model S] Using vehicle "Seven of Nine" with state "offline" [11/12/2020, 7:50:07 AM] [Model S] Waiting for vehicle to wake up... [11/12/2020, 7:50:10 AM] [Model S] Using vehicle "Seven of Nine" with state "offline" [11/12/2020, 7:50:10 AM] [Model S] Waiting for vehicle to wake up... [11/12/2020, 7:50:14 AM] [Model S] Using vehicle "Seven of Nine" with state "offline" [11/12/2020, 7:50:14 AM] [Model S] Waiting for vehicle to wake up... [11/12/2020, 7:50:20 AM] [Model S] Using vehicle "Seven of Nine" with state "online" [11/12/2020, 7:50:20 AM] [Model S] Set climate to true

I checked it in the Tesla app at 8:00 but it wasn't on.

What can be wrong here?

Thanks Björn

BjornB2 commented 3 years ago

And 20 minutes later (I was still at home) the scheduled turning off of the HVAC did work again.

[11/12/2020, 8:10:03 AM] [Model S] Climate on? true [11/12/2020, 8:10:04 AM] [Model S] Using vehicle "Seven of Nine" with state "online" [11/12/2020, 8:10:05 AM] [Model S] Using vehicle "Seven of Nine" with state "online" [11/12/2020, 8:10:06 AM] [Model S] Using vehicle "Seven of Nine" with state "online" [11/12/2020, 8:10:06 AM] [Model S] Set climate to false

At this point it seems to be more or less random if it works or not.

nfarina commented 2 years ago

Closing this; feel free to reopen if it's still a problem!