jonasbkarlsson / ev_smart_charging

Electric vehicle smart charging for Home Assistant.
MIT License
171 stars 25 forks source link

My ID4 not starting with Charging #176

Open janss028 opened 1 year ago

janss028 commented 1 year ago

Version of the custom_component

Version x.x.x

Configuration

Describe your configuration here.

Describe the bug

A clear and concise description of what the bug is.

Debug log


Add your logs here.
janss028 commented 1 year ago

I'm new with this intergration.

After installation of the integration my ID4 not starting with charging: image

ID4 integration image

My Settings: image

If I put the charge button of My ID4 image

I get the following error message: image

Can you tell me what I doing wrong?

Best Regards, Ron

Obelixje commented 1 year ago

I am struggling with the same on my ID.4

janneho commented 1 year ago

I do not have VW, but can you try with automation method? Leave charger configuration entity empty on integration config, and try with two automations below.

Hope it works...

Start charging automation:

alias: EV Smart Charging - Start
description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - sensor.ev_smart_charging_charging
    from: "off"
    to: "on"
condition: []
action:
  - service: button.press
    target:
      entity_id: button.id4_start_charging

Stop charging automation:

alias: EV Smart Charging - Stop
description: ""
mode: single
trigger:
  - platform: state
    entity_id:
      - sensor.ev_smart_charging_charging
    from: "on"
    to: "off"
condition: []
action:
  - service: button.press
    target:
      entity_id: button.id4_stop_charging
jonasbkarlsson commented 1 year ago

@janss028 and @Obelixje, did the suggestion about with automations help?

In general, it is however preferable to control charging via the charger instead of the car. So if you have a charger that can be controlled by HA, then I would very much recommend to do that.

janss028 commented 1 year ago

@jonasbkarlsson , @Obelixje my charger is not controlled by is also not possible to controll it with HA. Yesterday evening I did a small test with the solution of @Obelixje and I think this will work. This weekend I will do e new test and will inform you.

Thank you in advance

janss028 commented 1 year ago

@jonasbkarlsson What do you recommend if the charger can't work with HA. I think my ID4 should initiate charging?

As you can see below, the status is charging but my car is not connected

image

jonasbkarlsson commented 1 year ago

If the charging is controlled via the car, then the recommendation is to make an automation that controls the switch.ev_smart_charging_ev_connected, provinding information to the integration that the car is connected to the charger.

The easiest way to do that is, once again, is to get information from the charger. See this example.

Now, if that is not posssible, then I guess you need to start being a bit creative.

janneho commented 1 year ago

Do you have sensor sensor.id4_plug_connection_state? Or something like that? Could it be used?

janss028 commented 1 year ago

@janneho Yes, I have. Do you have it working and if yes, can you help me?

best regards, Ron

janneho commented 1 year ago

Can you check state of sensor.id4_plug_connection_state when charger is connected, and when it is unplugged from car? That could propably used for information for integration.

For automation you propably should add car location geofence to yout home. Without that car/integration does not know when you charge in fast charger, and stops charging on schedule.

janss028 commented 1 year ago

HI @janneho

The status is as below:

connected

image

disconnected

image

I create the automation below:

alias: EV Smart Charging - EV connected description: "" trigger:

and put it in the configuration below:

image

Is this coreect?

Do I need also the follow automations:

alias: EV Smart Charging - Start description: "" mode: single trigger:

and

alias: EV Smart Charging - Stop description: "" mode: single trigger:

Thank you for your help

janneho commented 1 year ago

Leave charger control switch empty in configuration. You need all 3 automations. Two of them starts and stops charging in car when integration says so. Third automation tells that car is home, and charger is plugged in to car. Automation seems about right. Make sure that charging is allowed charger is unplugged at home.

I do not have volkswagen, so no guarantees on this. Report if all is ok, or not.

janss028 commented 1 year ago

Hi @janneho

It is not possible to remove in setting:

image

If you remove it and save it, it is back after open de configuration again.

janneho commented 1 year ago

Can you add one space and nothing more?

janss028 commented 1 year ago

That helps :)

The manual start / stop works fine. Now wait till tomorrow to see if everything works fine.

image

I will give you an update.

janss028 commented 1 year ago

Hi, The car is not starting with charging.

image

It is connected and at home. I’m using the automation below:

alias: EV Smart Charging - EV connected description: "" trigger:

Manual I can start and stop charging.

image

Do you know what is wrong?

janneho commented 1 year ago

What does it look like in settings -> Devices and services -> ev smart charging. Mine is like this

Screenshot_20230514-215556

Is ev connected on?

janss028 commented 1 year ago

@janneho

below my overview

image
janneho commented 1 year ago

I can not think why it should not work. Below is from documentation. If manual start and stop works, i do not know why scheduled charging is not working.

Verifying the configuration

To verify that the integration is able to control the charging, go to Settings -> Devices & Services -> Integrations -> EV Smart Charging -> 1 device -> Controls.

Connect the EV to the charger.
PRESS the Manually start charging.
Check that charging is started.
PRESS the Manually stop charging.
Check that charging is stopped.
PRESS the Manually start charging.
Check that charging is started.

If the above works, the integration is able to control the charging.

janss028 commented 1 year ago

Hi @janneho

Charging works fine. Thank you for your help.

I have a another question. As example the care should start with charging at 14.00. If I connect my car at the charger at 10.00 it start already with charging an I must it switch off manual with the STOP charging button. Charging stops and at 14.00 it starts with charging. How can I change that charging not start after I connect the cable but start with charging if the integration says start with charging?

Thanks in advance. Ron

janneho commented 1 year ago

Try to add charge stop in EV connected script, that is what I have done. Something like this:

alias: EV Smart Charging - EV connected
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.id4_plug_connection_state
         condition:
  - condition: device
    device_id: e0f08d93788f2eedae712557a654494c
    domain: device_tracker
    entity_id: device_tracker.id4_tracker
    type: is_home
action:
  - if:
    - condition: state
       entity_id: sensor.id4_plug_connection_state
       state: connected
    then:
      - service: switch.turn_on
        data: {}
        target:
        entity_id: switch.ev_smart_charging_ev_connected
      - service: button.press
        target:
        entity_id: button.id4_stop_charging
        else:
         - if:
            condition: state
            entity_id: sensor.id4_plug_connection_state
            state: Available
        then:
           service: switch.turn_off
           data: {}
           target:
           entity_id: switch.ev_smart_charging_ev_connected
           mode: single
enoch85 commented 11 months ago

:wave:

I experience similar issues for my Tesla Model 3.

What happens is that the car goes to deep sleep, and makes all the entities unavailable, which in turn makes EV Smart think that the car is not connected/available at all and changes to "No charging planned".

I'm experimenting with waking up the car now if charging is planned, by manually pressing the wake up button that the car have (in another automation). I already have the recommended automation in place when connecting and disconnecting the car, but that doesn't help since all the entities are gone anyway.

My wifes VW e-UP! works without any issues at all on the same settings. Until then, does anyone have any idea how to fix this in the best possible way?

I will keep this issue updated with my progress.

jonasbkarlsson commented 11 months ago

@enoch85, is going to deep sleep and make all the entities unavailable to common behaviour for all Teslas? If so, then it sounds like a major problem. Strange that I haven't heard (much) about it.

For me, it would have been better if the Tesla integration kept the last know values instead of making the entities unavailable...

enoch85 commented 11 months ago

@jonasbkarlsson

is going to deep sleep and make all the entities unavailable to common behaviour for all Teslas?

I don't know, but I find the car to be very energy conserving, only loosing like 1% over several days if I don't touch it. So I guess, yes, it's a problem. The car will wake up if you plug a charge cable in it (or start charging), but with the entities unavailable it doesn't matter since charging won't start anyway. Would the setting "Keep charger on" help me here?

Right now I have this automation (which worked perfectly fine last night):

alias: Vakna Tesla!
description: Dags att ladda. :)
trigger:
  - platform: time
    at: "23:00:00"
condition:
  - condition: state
    entity_id: sensor.ev_smart_charging_charging
    attribute: Charging is planned
    state: true
action:
  - device_id: 8fc8504659b7162e4270b730466060f4
    domain: button
    entity_id: 243c1fb8746cb0cc34c5038f09e81cb7
    type: press
  - delay:
      hours: 3
      minutes: 0
      seconds: 0
      milliseconds: 0
    enabled: true
  - device_id: 8fc8504659b7162e4270b730466060f4
    domain: button
    entity_id: 243c1fb8746cb0cc34c5038f09e81cb7
    type: press
    enabled: true
mode: single

image

Usually it goes to sleep around 00:00 if I leave it with charge plugged at around 17:00-18:00, hence the time trigger at 23:00 which will press the wake up button and then do the same thing 3 hours later (charging usually occurs between 01:00-04:00.

For me, it would have been better if the Tesla integration kept the last know values instead of making the entities unavailable...

Agreed. I'm using this integration, so maybe it's time for an issue report? :)

It charged last night, and now I have this:

image

Maybe if you could save the data in your integration instead, I don't know what's best?

jonasbkarlsson commented 11 months ago

If this is the case with the entities unavailable it doesn't matter since charging won't start anyway, then it doesn't seem possible for this integration to fix this by remembering the last available data. And a change to the Tesla integration will not help either. It seems like the solution is to make sure the car does not go into deep sleep.

enoch85 commented 11 months ago

with the entities unavailable it doesn't matter since charging won't start anyway

You know the code. What I was thinking was maybe saving the state of planned charge, and try to charge even without entities available. Or am I not thinking clear?

Maybe a switch that could be called like "Force try charge" or something. That could later be used in an automation that puts the switch on, during certain conditions set by the user (me). Like, if I know the car is home, or my cellphone is home, or that the car actually is plugged in (can be checked though Easee) or something else, then I could try to force charge, even if the entities of the car is unavailable. Just brainstorming here.

The main benefit being that I don't have to wake up the car until the charging is actually happening (saving a few Wh).

enoch85 commented 11 months ago

Made an issue now anyway: https://github.com/alandtse/tesla/issues/757

jonasbkarlsson commented 11 months ago

You know the code. What I was thinking was maybe saving the state of planned charge, and try to charge even without entities available. Or am I not thinking clear?

But I thought that when you wrote "with the entities unavailable it doesn't matter since charging won't start anyway" that it meant that it would not be possible to start charging if the car is in deep sleep. Maybe you meant something else.

If you let the car go into deep sleep, and then press button.ev_smart_charging_manually_start_charging, will charging start?

enoch85 commented 11 months ago

If you let the car go into deep sleep, and then press button.ev_smart_charging_manually_start_charging, will charging start?

I have to test that.

enoch85 commented 11 months ago

It becomes like this:

image

If I press the manual start button, it wakes up again it seems. Debugging this from two directions now. Seems to happen after reboot of HAOS.

Previous solutions involved going to the car and physically detach and insert the charging cable.

enoch85 commented 11 months ago

CONFIRMED: Even after the car is in deep sleep, it's possible to start it by pressing the manual button in EV Smart.

jonasbkarlsson commented 11 months ago

What happens is that the car goes to deep sleep, and makes all the entities unavailable, which in turn makes EV Smart think that the car is not connected/available at all and changes to "No charging planned".

Hi @enoch85! I have looked into this. Are you sure that turning the entities to unavailable makes EV Smart's status change to "No charging planned"? Looking at the code, that should not happen.

If you get an error message in the log saying "SOC sensor not valid" or "Target SOC sensor not valid", that should not cancel a scheduled charging. What happens is that the last known value is continued to be used.

However, if some entities are unavailable at startup (after HA reboot), then the integration will not start at all. It will wait until all entities are available.

enoch85 commented 11 months ago

However, if some entities are unavailable at startup (after HA reboot), then the integration will not start at all. It will wait until all entities are available.

Ok, then that's the case.

I rebooted quite a lot during the setup of my HAOS. Tested yesterday also to remove all my special fixes I made to be sure it would start, and it worked. So I guess it's all good now.

After reboot: remember to wake up the car, or start a manual charging session.

Btw, maybe it would be a good idea to add to add "Please remember that a planned charge doesn't survive a HA reboot" to the documentation?