teslamotors / fleet-telemetry

Apache License 2.0
682 stars 81 forks source link

Which field provides the ChargingState? #123

Open virtualzone opened 9 months ago

virtualzone commented 9 months ago

Hi there,

I'm trying to retrieve the ChargingState from the telemetry data. I assumed this was returned in the ChargeState.

I assumed that ChargeState had type charging_value, so I could check i.e. for ChargeStateDisconnected (enum value 1).

However, ChargeState only returns a string_value which is Idlewhenever the vehicle is not charging.

Help is appreciated, thanks in advance!

jbanyer commented 9 months ago

I'm also interested in this question. Our use case requires knowing all the different charging states.

Currently we use charge_state.charging_state in the Fleet API vehicle data.

purcell-lab commented 8 months ago

ChargeState:/ ChargeEnableRequest: seems to change when charging starts/ stops:

https://github.com/teslamotors/fleet-telemetry/issues/127#issuecomment-1999095245

peetermeos commented 8 months ago

As far as I can see, ChargingState returns rather useless Idle/Enabled string value, the expected enum ChargingState is always default (ie. ChargingStateUnknown). So in short, it does not seem to be yet fully implemented. Emailed support about it, no response yet.

jbanyer commented 7 months ago

@agbpatro are you able to comment on this? It's very important for our use case (chargehq.net). Thanks.

agbpatro commented 7 months ago

For ChargeState , value should be stored in string

stx commented 7 months ago

@agbpatro Developers want to know how to access the ChargingState values like Disconnected, Charging, Complete, listed here: https://github.com/teslamotors/fleet-telemetry/blob/0431c0fa97158bbac5d2c7fb2eb0b517e2c95530/protos/vehicle_data.proto#L181

ChargeState does not provide this (it provides "Idle" or "Enable") and it appears there is no way to retrieve this field. This is a very important field for virtually all third party apps. Is there a way to get the ChargingState?

agbpatro commented 7 months ago

I see yeah. That is not supported yet. Will update the thread here once its available

stx commented 7 months ago

@agbpatro Thanks for the update! FYI this is a major blocker for all consumer and charging apps in moving to fleet telemetry from data requests. That field is needed to know what the car is doing and to know when to issue start/stop charging commands.

jbanyer commented 7 months ago

@agbpatro thanks, just reiterating @stx's comment that this issue is preventing us from moving to fleet telemetry. I did email fleetapisupport@tesla.com about it on 18th March but haven't had a reply. Cheers.

Bre77 commented 7 months ago

@jbanyer FYI we have observed three states from Streaming that map to polled values:

"Idle": "stopped", #streaming "QualifyLineConfig": "starting", #streaming "Enable": "charging", #streaming

https://github.com/Teslemetry/hass-teslemetry/blob/eb3e886e8222010d2e131c5092e5dd94f0444a18/custom_components/teslemetry/sensor.py#L49

Urkman commented 5 months ago

I see yeah. That is not supported yet. Will update the thread here once its available

Any Updates on this?

And is there currently a way to get the information that the user connects or disconnects the charger? And when the charging completes (not stopped)?

Urkman commented 5 months ago

One more on this: A user off my App was charging at a "32 kWh am EnBW HPC". But the charging_state was Idle for the whole time...

Any idea on this?