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

When teslamate is in falling asleep mode, and charging starts on a scheduled charging , teslamate does not resume normal mode to pull data from the car. #4446

Open
1 task done
SkullKill opened this issue Dec 19, 2024 · 3 comments
Labels
note:discussion Details or approval are up for discussion

Comments

@SkullKill
Copy link

SkullKill commented Dec 19, 2024

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

When teslamate is in falling asleep mode, and charging starts on a scheduled charging , teslamate does not resume normal mode to pull data from the car.

Teslamate know when the next scheduled charging is due to start, and knows that the car is plugged into power.
But when it is in "falling asleep" mode, it will not auto cancel the "falling asleep" to normal mode , so that it can start pooling the car for info. This means that it is not logging the charging session.

Expected Behavior

if teslamate detects that the car is connected to power, that charging is starting at XX:XX time.
When that schedule time is reached, and teslamate mode is "falling asleep", then Teslamate should auto cancel it's "falling asleep" mode, and start pooling data from the car.

Steps To Reproduce

No response

Relevant log output

Scheduled charging was set to start at 11:00am local time, and 03:00 UTC time in the logs. Only started logging at 03:20

this happened a few times

teslamate-1  | 2024-12-16 02:46:15.695 car_id=1 [info] Driving / Ended / 4 km – 9 min
teslamate-1  | 2024-12-16 02:46:15.695 car_id=1 [info] Start / :online
teslamate-1  | 2024-12-16 02:50:22.868 car_id=1 [info] Suspending logging
teslamate-1  | 2024-12-16 02:52:16.971 [warning] Too many disconnects from streaming API
teslamate-1  | 2024-12-16 02:52:16.971 car_id=1 [info] Creating new connection …
teslamate-1  | 2024-12-16 02:52:16.971 car_id=1 [info] Disconnecting ...
teslamate-1  | 2024-12-16 02:52:16.990 car_id=1 [info] Connecting ...
teslamate-1  | 2024-12-16 02:53:26.193 [info] GET /
teslamate-1  | 2024-12-16 02:53:26.203 [info] Sent 200 in 10ms
teslamate-1  | 2024-12-16 02:54:30.424 [info] GET /
teslamate-1  | 2024-12-16 02:54:30.431 [info] Sent 200 in 6ms
teslamate-1  | 2024-12-16 02:54:36.333 [info] GET /settings
teslamate-1  | 2024-12-16 02:54:36.345 [info] Sent 200 in 12ms
teslamate-1  | 2024-12-16 02:54:38.575 [info] GET /
teslamate-1  | 2024-12-16 02:54:38.585 [info] Sent 200 in 9ms
teslamate-1  | 2024-12-16 02:54:42.761 [info] GET /
teslamate-1  | 2024-12-16 02:54:42.766 [info] Sent 200 in 5ms
teslamate-1  | 2024-12-16 02:58:54.798 [warning] Too many disconnects from streaming API
teslamate-1  | 2024-12-16 02:58:54.798 car_id=1 [info] Creating new connection …
teslamate-1  | 2024-12-16 02:58:54.798 car_id=1 [info] Disconnecting ...
teslamate-1  | 2024-12-16 02:58:54.825 car_id=1 [info] Connecting ...
teslamate-1  | 2024-12-16 03:05:31.824 [warning] Too many disconnects from streaming API
teslamate-1  | 2024-12-16 03:05:31.825 car_id=1 [info] Creating new connection …
teslamate-1  | 2024-12-16 03:05:31.825 car_id=1 [info] Disconnecting ...
teslamate-1  | 2024-12-16 03:05:31.847 car_id=1 [info] Connecting ...
teslamate-1  | 2024-12-16 03:12:08.510 [warning] Too many disconnects from streaming API
teslamate-1  | 2024-12-16 03:12:08.511 car_id=1 [info] Creating new connection …
teslamate-1  | 2024-12-16 03:12:08.511 car_id=1 [info] Disconnecting ...
teslamate-1  | 2024-12-16 03:12:08.532 car_id=1 [info] Connecting ...
teslamate-1  | 2024-12-16 03:18:46.625 [warning] Too many disconnects from streaming API
teslamate-1  | 2024-12-16 03:18:46.626 car_id=1 [info] Creating new connection …
teslamate-1  | 2024-12-16 03:18:46.627 car_id=1 [info] Disconnecting ...
teslamate-1  | 2024-12-16 03:18:46.657 car_id=1 [info] Connecting ...
teslamate-1  | 2024-12-16 03:20:24.635 car_id=1 [info] Vehicle is still online. Falling asleep for: 33 min
teslamate-1  | 2024-12-16 03:20:26.134 [info] GET https://nominatim.openstreetmap.org/reverse -> 200 (1496.130 ms)
teslamate-1  | 2024-12-16 03:20:26.186 car_id=1 [info] Charging / SOC: 45% / Home
teslamate-1  | 2024-12-16 03:20:26.186 car_id=1 [info] Disconnecting ...
teslamate-1  | 2024-12-16 03:42:54.989 [info] GET /
teslamate-1  | 2024-12-16 03:42:55.008 [info] Sent 200 in 18ms
teslamate-1  | 2024-12-16 06:45:14.226 car_id=1 [info] Phase correction: 2 -> 3
teslamate-1  | 2024-12-16 06:45:14.235 car_id=1 [info] Derived efficiency factor: 137.0 Wh/km (6x confirmed)
teslamate-1  | 2024-12-16 06:45:14.235 car_id=1 [info] Charging / Stopped / 11.16 kWh – 206 min
teslamate-1  | 2024-12-16 06:45:14.238 car_id=1 [info] Start / :online
teslamate-1  | 2024-12-16 06:45:14.248 car_id=1 [info] Connecting ...
teslamate-1  | 2024-12-16 06:48:18.779 car_id=1 [info] Suspending logging
teslamate-1  | 2024-12-16 06:51:53.972 [warning] Too many disconnects from streaming API
teslamate-1  | 2024-12-16 06:51:53.972 car_id=1 [info] Creating new connection …
teslamate-1  | 2024-12-16 06:51:53.973 car_id=1 [info] Disconnecting ...
teslamate-1  | 2024-12-16 06:51:54.004 car_id=1 [info] Connecting ...
teslamate-1  | 2024-12-16 06:56:19.032 [info] Streaming API: Vehicle offline
teslamate-1  | 2024-12-16 06:56:19.033 car_id=1 [warning] Stream reports vehicle as offline, fetching vehicle state ...
teslamate-1  | 2024-12-16 06:56:20.242 car_id=1 [info] Start / :offline
teslamate-1  | 2024-12-16 06:56:20.262 car_id=1 [info] Disconnecting ...
teslamate-1  | 2024-12-16 07:07:38.284 car_id=1 [info] Start / :online
teslamate-1  | 2024-12-16 07:07:38.323 car_id=1 [info] Connecting ...

Screenshots

No response

Additional data

timezone is correct on the machine, and there are no custom timezone defined in docker-compose.yml for teslamate

skullkill@ch-1:~$ timedatectl
Local time: Thu 2024-12-19 09:24:24 AWST
Universal time: Thu 2024-12-19 01:24:24 UTC
RTC time: Thu 2024-12-19 01:24:24
Time zone: Australia/Perth (AWST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no

Type of installation

Docker

Version

v1.32.0

@JakobLichterfeld
Copy link
Collaborator

Thanks for reporting. As you can see this is expected behavior, scheduled charging is not handled well in the Tesla API.

@JakobLichterfeld JakobLichterfeld added the note:discussion Details or approval are up for discussion label Dec 21, 2024
@SkullKill
Copy link
Author

@JakobLichterfeld Teslamate has all the required info to handle this properly without any other info from the API.

(1) Teslamate Knows the next Scheduled Charging start time
(2) It knows that the car is plugged in
(3) and it knows that Teslamate is in the Sleep Attempt mode.
(4) and it can cancel the sleep attempt to start pooling data from the car.

so there could be a logic in teslamate like so, that would solve this issue

if the time is (start of scheduled charging, [in the screenshot, as an example, at 09:00:00 am] )
{
    if car plugged in
    {
        if teslamate is in sleep attempt mode
        {
            Cancel TeslaMate Sleep Attempt
        }
    }
}

Screenshot 2024-12-21 201158-description

@JakobLichterfeld
Copy link
Collaborator

JakobLichterfeld commented Dec 21, 2024

Obviously TelsaMate detects in StreamingAPI mode if a drive is started or a charge is started, but this is not 100% working in all "edge" cases, scheduled charging, intermitted charging etc. are such "edge" cases.

Not saying it could not be improved, but it most cases this will lead to multiple cars no sleeping correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
note:discussion Details or approval are up for discussion
Projects
None yet
Development

No branches or pull requests

2 participants