xraver / mercedes_me_api

Script to use Mercedes Me APIs.
MIT License
57 stars 14 forks source link

Refresh Interval #11

Closed DENightOne closed 3 years ago

DENightOne commented 3 years ago

Just a quick question:

scan_interval: < TIME PERIOD TO REFRESH RESOURCES > What unit of time is that scan interval in? Is it millisenconds ,seconds or minutes and what would you recommend as a good time to set?

Ps..You documenation says I should copy .mervedes_token into the HACS folder.... the componet only works if I copy it into the base folder where my configuratiuon.yaml file is.

danielrheinbay commented 3 years ago

scan_interval is a generic Home Assistant option, specified in seconds. Find more information here: https://www.home-assistant.io/docs/configuration/platform_options/

DENightOne commented 3 years ago

scan_interval is a generic Home Assistant option, specified in seconds. Find more information here: https://www.home-assistant.io/docs/configuration/platform_options/

Thanks for the feedback, I just wanted to make sure, as although scan_interval is generic there are loads of exceptions to the rule, for example the climatecell.co add-on specifies a much more detailed format for scan interval.

scan_interval:

At least one of these must be specified:

      days: 0
      hours: 1
      minutes: 0
      seconds: 0
      milliseconds: 0
    exclude_interval:
      1:
        - "23:00"
        - "07:00"
danielrheinbay commented 3 years ago

Uh, thanks for the heads up :+1: I was not aware of that. Looking at the code, however, I believe mercedes_me_api does indeed expect seconds:

Here it reads the value from the config, defaulting to 30 if no values is specified: https://github.com/xraver/mercedes_me_api/blob/f707fd8cd8bea96264d4310cc6aa4c6b3c132dae/custom_components/mercedesmeapi/config.py#L33

Here, that raw value is used as the "seconds" parameter to schedule a HASS task: https://github.com/xraver/mercedes_me_api/blob/f707fd8cd8bea96264d4310cc6aa4c6b3c132dae/custom_components/mercedesmeapi/__init__.py#L74