Closed pdcastro closed 9 months ago
Steps to delete the integration to be given the option of changing the update interval:
Then reinstall it by going to the Settings page again (second screenshot), clicking the Add Integration button and searching for Volkswagen We Connect ID.
Hey, with that change would it be possible, to adjust the value in an automation, like setting 45s while driving and 2mins or higher, when stationary? Or would the integration have to restart, for the updated interval to take effect?
Hey, with that change would it be possible, to adjust the value in an automation, like setting 45s while driving and 2mins or higher, when stationary? Or would the integration have to restart, for the updated interval to take effect?
@SamuelBrucksch, with this PR, the integration would need to be removed and re-added for the update interval to be changed. I imagine that the best solution would be for the integration to provide a home assistant service that could be dynamically called by automations to set the polling interval. It should not be too hard to add this feature in another PR. However, I have submitted 6 PRs in the past week (as I started using this integration myself), but I am yet to hear anything from the repo maintainer (no comments or reviews, nothing merged). I think we need to wait to hear from @mitch-dc.
@SamuelBrucksch isn't this already possible by turning of the polling of the integration and using the homeassistant.update_entity
service?
Haven't tried this myself though.
@michaelarnauts I think this is something different?
_@SamuelBrucksch isn't this already possible by turning of the polling of the integration and using the homeassistant.updateentity service?
I can confirm that this approach works. It is not even necessary to turn off the integration’s regular polling, because the integration has a built-in “protection” that ignores further update requests for 24 seconds after an update.
I configured the integration with a 5-minute (300-second) update interval set through the config flow (previous screenshots). Then I verified that the following service call, when made through a script or automation or the Developer Tools UI, causes a data refresh by the VW We Connect integration:
service: homeassistant.update_entity
data: {}
target:
entity_id:
- sensor.my_id_3_plug_connection_state
- sensor.my_id_3_state_of_charge
- sensor.my_id_3_charge_power
Replace my_id_3
with the name you gave to your car. You can find it by clicking on any VW We Connect entity and then clicking the cogwheel:
Therefore, you could write a script or automation that detected the situation of interest (e.g. the vehicle is driving, or the vehicle is charging) and called the update_entity
service at regular intervals, e.g. every 45 seconds.
This PR is an attempt to revive @tsg21’s effort in PR #72, created more than a year ago but which got stalled for apparently two reasons:
This PR addresses those points by:
update_interval
option.“99%” of the code is a copy-and-paste from PR #72, so credit goes to @tsg21. I have added the value of investigating and fixing the UI issue.
This PR is also related to issues #211, #215 and #222 insofar as reducing the polling frequency reportedly avoids WeConnect API errors (e.g. 403, 429) when the servers are busy (API call rate limiting / throttling).