jmcollin78 / solar_optimizer

The Solar Optimizer integration for Home Assistant starts and stops your equipments depending on the Solar net production
MIT License
53 stars 10 forks source link

Turn off optimizer and publish event when power adjustment fo variable equipment fails #36

Closed MrBLJ closed 4 weeks ago

MrBLJ commented 1 month ago

Is your feature request related to a problem? Please describe. The latest changes in the Tesla API resulted in a limited number of commands we can issue per vehicle each day. When the limit is reached, solar optimizer tries to adjust the _chargingamps of the vehicle to no avail.

The current will stay at its last level and the vehicle will keep charging. This can result in over power consumption, thus reducing the impact of the integration.

Describe the solution you'd like When solar optimizer fails to adjust the power X times (let's say 3 in a consecutive manner), the optimization should stop and an event published. In the case of Tesla, it's not relevant to try to turn off the charger since the command will fail as well.

From this event, we can set up automations to notify the user and alternative ways to turn off the charges (an event can trigger an IOS shortcut that can turn off charging).

Describe alternatives you've considered I'm working on a sensor + automation that will detect errors related to current adjustment in the logs, and trigger the actions mentioned above. I'll publish my code once done, but I think this could be a neat improvement.

jmcollin78 commented 1 month ago

Hello @MrBLJ ,

Thanks for the report. But all the behavior of Solar Optimizer is generical and Solar Optimizer don't know it is charging a Tesla. It just switch on/off some device. More over, switching on and off doesn't failed. Have you some logs when this occurs ? Is the error visible by Solar Optimizer or is it an error in the Tesla integration ?

MrBLJ commented 4 weeks ago

Hello @MrBLJ ,

Thanks for the report. But all the behavior of Solar Optimizer is generical and Solar Optimizer don't know it is charging a Tesla. It just switch on/off some device. More over, switching on and off doesn't failed. Have you some logs when this occurs ? Is the error visible by Solar Optimizer or is it an error in the Tesla integration ?

Thanks for your reply. The error is visible in the Tesla Integration (and http proxy), not in Solar optimizer.

The reason for me asking was that sometimes I see log messages such as (iirc) "Solar production not valued, optimizer will stop" or something like that, which lead me to believe that the optimizer could receive/fetch data from other entities.

It's not necessary to dig further since it's a niche use case, I'll find a workaround.

Thanks again for the time you took answering my question.