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

Script doesn't stick to the amp limit #9

Open
kimme1024 opened this issue Oct 10, 2023 · 5 comments
Open

Script doesn't stick to the amp limit #9

kimme1024 opened this issue Oct 10, 2023 · 5 comments

Comments

@kimme1024
Copy link

This morning somehow the script stopped adapting the amps.
In the log below you can see that the script changed the amps at 10:15, did a couple of refreshes afterwards but nothing past that until I restarted the automation at 11:46.

Wattson Force data update  gewijzigd in 10 oktober 2023 om 10:14 getriggerd door automatisering Tesla Solar Charger  triggered
10:14:57 - 2 uur geleden

Wattson Charging amps  gewijzigd in 8 getriggerd door automatisering Tesla Solar Charger  triggered
10:15:34 - 2 uur geleden

Wattson Force data update  gewijzigd in 10 oktober 2023 om 10:15 getriggerd door automatisering Tesla Solar Charger  triggered
10:15:34 - 2 uur geleden

Wattson Force data update  gewijzigd in 10 oktober 2023 om 10:16 getriggerd door automatisering Tesla Solar Charger  triggered
10:16:10 - 2 uur geleden

Wattson Force data update  gewijzigd in 10 oktober 2023 om 10:16 getriggerd door automatisering Tesla Solar Charger  triggered
10:16:46 - 2 uur geleden

Wattson Force data update  gewijzigd in 10 oktober 2023 om 10:17 getriggerd door automatisering Tesla Solar Charger  triggered
10:17:21 - 2 uur geleden

Scherm­afbeelding 2023-10-10 om 12 30 04

After restarting the automation I now noticed that the car is charging at 13A while the limit in de script is set to 12A (due to the issue mentioned in #4.

Scherm­afbeelding 2023-10-10 om 12 25 30
Scherm­afbeelding 2023-10-10 om 12 25 45

In 2 weeks I'm getting my MCU1 replaced by the newer MCU2. After that we can rule out the fact that the issue lies there.

@flashg1
Copy link
Owner

flashg1 commented Oct 10, 2023

Please also consider including the script "Running instance count" in your control GUI to give you instant feedback that the script has been triggered. 1=script is running, 0=script not running.

https://github.com/flashg1/TeslaSolarCharger#dashboard-tesla-solar-charger-control

  • entity: automation.[YourTeslaName]_solar_charger_automation
  • type: attribute
    entity: automation.[YourTeslaName]_solar_charger_automation
    attribute: current
    name: Running instance count
  • type: attribute
    entity: automation.[YourTeslaName]_solar_charger_automation
    attribute: last_triggered
    name: Last triggered

@flashg1
Copy link
Owner

flashg1 commented Oct 10, 2023

If it is any consolation, I use the automation to charge my car everyday and have not encountered any issues.

There are a few things you need to be aware of,

  • If the HA Tesla status is incorrect or not up-to-date due to polling issue, the automation trigger can fail.
  • If your wifi communication with car is unstable, the automation can abort due to communication failure.

@flashg1
Copy link
Owner

flashg1 commented Oct 10, 2023

This showed the charging current was not set on startup, ie. charger was already turned on and charging at whatever current before you started the script. This is to allow the "Charge from grid" feature. The script will only change the current when there is a change in the available solar electricity.

image

@kimme1024
Copy link
Author

kimme1024 commented Oct 10, 2023

Please also consider including the script "Running instance count" in your control GUI to give you instant feedback that the script has been triggered. 1=script is running, 0=script not running.

https://github.com/flashg1/TeslaSolarCharger#dashboard-tesla-solar-charger-control

  • entity: automation.[YourTeslaName]_solar_charger_automation
  • type: attribute
    entity: automation.[YourTeslaName]_solar_charger_automation
    attribute: current
    name: Running instance count
  • type: attribute
    entity: automation.[YourTeslaName]_solar_charger_automation
    attribute: last_triggered
    name: Last triggered

Interesting! Didn't know that! I've made an automation that notifies me when it changes to zero...
Maybe I'd better make an automation that when it changes to zero during daylight, it automatically triggers a refresh from the Tesla integration and restarts the automation...

EDIT:

Made the following automation that should keep the script alive. Feel free to check it for errors!

alias: Tesla Charger Restart & Notification
description: ""
trigger:
  - platform: numeric_state
    entity_id: automation.tesla_solar_charger
    attribute: current
    below: 1
condition:
  - condition: sun
    before: sunset
    before_offset: "-01:01:00"
    after: sunrise
    after_offset: "+01:01:00"
action:
  - service: button.press
    data: {}
    target:
      entity_id: button.wattson_force_data_update
  - delay:
      hours: 0
      minutes: 0
      seconds: 30
      milliseconds: 0
  - service: automation.trigger
    data:
      skip_condition: true
    target:
      entity_id: automation.tesla_solar_charger
  - service: notify.mobile_app_iphone_kim
    data:
      message: >-
        Script is gestopt met werken. Er werd een poging gedaan om te
        herstarten.
      title: Tesla Solar Charger
mode: single

@kimme1024
Copy link
Author

This showed the charging current was not set on startup, ie. charger was already turned on and charging at whatever current before you started the script. This is to allow the "Charge from grid" feature. The script will only change the current when there is a change in the available solar electricity.

image

ah okay... I think I know what went wrong then...
To solve the issue where the script stopped as in #8, I made an automation that starts the script again 5min after the original script starts because when it failed, it always did after 114 seconds.
When the script didn't stop, my automation simply didn't do anything (I assumed) as it stopped with an error saying that the script was already running.
This might have caused the issue today, however it's weird that it didn't do the same everyday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants