robinostlund / homeassistant-volkswagencarnet

Volkswagen Carnet Component for home assistant
GNU General Public License v3.0
339 stars 62 forks source link

[FR] Charging State unknown #610

Closed Thomk-63 closed 7 months ago

Thomk-63 commented 7 months ago

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

virtualdj commented 7 months ago

What is exactly the problem / feature request about? The integration is working in my case.

Thomk-63 commented 7 months ago

Other integrations have an entity in order to read the charging state "charging", "not charging". This integration has only the switch to start or stop charging, but this is a control and no monitoring/status entity.

virtualdj commented 7 months ago

Yes, but this integration is better for this reason, too. The switch is automatically turned on when starting the charge, for example, from the app; so you can just query the switch status (i.e. the switch.yourcarname_charging entity) to know if it's charging or not.

This is a plus because you can remote it from Wear OS (other integrations do not allow that).

stickpin commented 7 months ago

@virtualdj is right, you can always check the status of the Charging switch for the On/Off status. @Thomk-63 can you explain why you cannot use a switch as a trigger? I can implement a sensor if it really required. But you can actually use Template to create any sensor you want from the other sensors data: https://www.home-assistant.io/integrations/template/

Thomk-63 commented 7 months ago

Hi, I have the following problem with this: As the communication from HA to the Server of Volkswagen to my car is not very reliable (mostly the problem of the bad service from Volkswagen) I send the command to start charging and then checking the status of charging. If this was not successful, I repeat the command (surely with a certain delay, giving the integration and server some time for communication). If the control is identical to the status of charging, this is not really clear what is the status and what is the command. An example: If I manually switch the control, then this stays immediately in the ON position, but for sure at that time the car is not charging. While I am writing this, I have an idea how to manage this: I simply have to start charging, then wait the interval time for communication (was it 5min?) and after that checking the status of the switch. This should work, right?

stickpin commented 7 months ago

All the control actions are asynchronous, Application/HA sends a request to the VW server, VW server tries to reach out to the vehicle (wake it up and push the command). The process relies on the cellular network which is not always reliable. That is why both the Application and the integration are using pendingrequests API to get the status of the request. The integration will give up retrying after approximately 3 minutes. So if you check for the status of the switch after 5 minutes, it should provide you with the valid status.