ddaddy / Tesla-Smart-Charging

4 stars 0 forks source link

charger turned-off for unknown reason #4

Closed troullll closed 1 day ago

troullll commented 2 days ago

image hi, a few days after some different situations, I have this new issue (30 traces only so I can't check it), any idea ? thanks

ddaddy commented 2 days ago

Sorry, I only speak a little French so don't fully understand your screenshot. At 09:40 I doubt there is sufficient solar to charge?

Also, the lines about the charge latch seem strange. Could you have had a very brief power cut?

troullll commented 2 days ago

ok, charger turned-off at the top of my screenshot, turned-on at the bottom. so weird...

image yes, 1 spare Amp at 9:40

yes, I always have those lines asleep / charger door / port latch why Asleep is "on" ? it seems Polling doesn't work... how could I check if it works ?

troullll commented 2 days ago

could we add a Wake-Up or Force Update action before any Tesla Smart Charge automation ?

ddaddy commented 2 days ago

I think them lines run backwards? The most recent at the top.

I have already added some Polling automations which reduce the polling time during the day. Have you installed them?

ddaddy commented 2 days ago

Also, I think that when a command is sent to the car, it is woken up and all data refreshed. That is handled by the Tesla integration.

troullll commented 2 days ago

installed and tested, Polling Time effectively change. the Charger sensor is not up to date when automation runs it ... ok, data is delayed by the polling itself, but I really think when the Tesla is deep "Asleep", we should add a binary_sensor.charging check, to ensure automation isn't changing amps as the Tesla effectively is not charging, it happened some times

ddaddy commented 1 day ago

Ok, as my car never sleeps for some reason 🤷‍♂️ (An old Model S) I never see this issue. Reading the instructions for the Tesla HA Integration again, I see that it doesn't intentionally wake the car up. The only way to do this is by sending a command like 'lock doors' and this wakes the car.

I'll add to the automation, that if the car is asleep, send this command instead of doing any of the charging actions. Then 10 seconds later when it runs again, it should have the data it needs to proceed with charging.

ddaddy commented 1 day ago

This would actually mean, that as soon as the sun comes up, the automation will wake the car up and then it'll likely never sleep again during the day if it's at home. Is that ok?

ddaddy commented 1 day ago

Ok, i've added what I think is a better workaround. If the automation wants to start charging:

Enough spare amps to charge
Charger is off
Battery level is below charge limit

and

Car is asleep

Then it will just send the Wake Up command to the car.

Then when the automation runs again after 10 seconds, the car should be in a state ready to accept the charge requests.

You'll need to go through the file again and replace all occurrences of jess with your car name and setup your variables etc..

troullll commented 1 day ago

got it. I think when the Tesla start to charge at 1A, it stays at "starting charge", so binary_sensor.charging stays off. I set the minimum_start_amps at 2, and it is ok. Anyone else ?

troullll commented 1 day ago

oh sorry, I had not seen your answers, I'll check that !

troullll commented 1 day ago

Ok, as my car never sleeps for some reason 🤷‍♂️ (An old Model S) I never see this issue. Reading the instructions for the Tesla HA Integration again, I see that it doesn't intentionally wake the car up. The only way to do this is by sending a command like 'lock doors' and this wakes the car.

I'll add to the automation, that if the car is asleep, send this command instead of doing any of the charging actions. Then 10 seconds later when it runs again, it should have the data it needs to proceed with charging.

ok ,good idea

This would actually mean, that as soon as the sun comes up, the automation will wake the car up and then it'll likely never sleep again during the day if it's at home. Is that ok?

ok anyway

Ok, i've added what I think is a better workaround. If the automation wants to start charging:

Enough spare amps to charge
Charger is off
Battery level is below charge limit

and

Car is asleep

Then it will just send the Wake Up command to the car.

Then when the automation runs again after 10 seconds, the car should be in a state ready to accept the charge requests.

You'll need to go through the file again and replace all occurrences of jess with your car name and setup your variables etc..

ok, I'll check this, thanks

ddaddy commented 1 day ago

Ignore my first 2 comments as i've made it only wake the car if the automation is actually wanting to start the charge. And I also found the 'Wake Up' button in the integration, although the docs suggest you have to send a command to wake up.

If you find it not waking up, let me know and i'll change it to send a door lock command instead.

troullll commented 1 day ago

yes I'm reading your changes. BTW, do you think the charger latch thing is an issue ? image

ddaddy commented 1 day ago

I don't know what would cause that. I would suggest a power cut, but it seems to happen too often for you.

Maybe try setting the minimum charge to 2a instead of 1a.

troullll commented 1 day ago

yes I already set the minimum_start_amps at 2, and it is ok to get the correct charger state. I copypasted your Wake Up changes (minus Jess), I'll test it tomorrow hehe

troullll commented 18 hours ago

image sorry, same thing this morning . image why does the option 2 did turned off the charger switch ? I checked the "option 2" code :

ddaddy commented 17 hours ago

I don't know 🤷‍♂️ There is no code there to turn it off.

Do you have any other automations that might turn it off? Does it only happens once in the morning, then everything works ok after?

troullll commented 16 hours ago

indeed on the trace of your automation ! how ? btw, I suspect the charger switch bug. I manually turned on the charger this morning, and it switched off itself 2s after. Wondering if it's caused by a Tesla Integration bug, as the interaction on our Tesla Apps is Start Charge OR Stop charge (buttons) and not a switch neither a toggle... I will perform these tests : alias: test switch toggle description: "" triggers: [] conditions: [] actions:

troullll commented 15 hours ago

it happened twice more this morning (after few seconds) image

ddaddy commented 15 hours ago

If the charger turns off after 2 seconds when you manually turn it on then it can't be an issue with this automation.

Try disabling all the polling automations, the charging_off_when_plugged_in automation and all the others like the Stop charging at sunset.

troullll commented 15 hours ago

indeed on the trace of your automation ! how ? btw, I suspect the charger switch bug. I manually turned on the charger this morning, and it switched off itself 2s after. Wondering if it's caused by a Tesla Integration bug, as the interaction on our Tesla Apps is Start Charge OR Stop charge (buttons) and not a switch neither a toggle... I will perform these tests : alias: test switch toggle description: "" triggers: [] conditions: [] actions:

* type: turn_on
  device_id: 65e6446555340f0b71c0d7ac6a62132c
  entity_id: 1ef66a2a8b3de3ba688f81363dde937c
  domain: switch

* type: turn_off
  device_id: 65e6446555340f0b71c0d7ac6a62132c
  entity_id: 1ef66a2a8b3de3ba688f81363dde937c
  domain: switch

* type: toggle
  device_id: 65e6446555340f0b71c0d7ac6a62132c
  entity_id: 1ef66a2a8b3de3ba688f81363dde937c
  domain: switch

* action: switch.turn_on
  metadata: {}
  data: {}
  target:
  entity_id: switch.charger

* action: switch.toggle
  metadata: {}
  data: {}
  target:
  entity_id: switch.charger
  mode: single

no issue

troullll commented 15 hours ago

If the charger turns off after 2 seconds when you manually turn it on then it can't be an issue with this automation.

Try disabling all the polling automations, the charging_off_when_plugged_in automation and all the others like the Stop charging at sunset.

disabled all these ones wait and see