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

Example of how to override the scan interval #99

Open
vesanieminen opened this issue Apr 15, 2024 · 6 comments
Open

Example of how to override the scan interval #99

vesanieminen opened this issue Apr 15, 2024 · 6 comments

Comments

@vesanieminen
Copy link

Could you provide an example e.g. in the readme.md of how one could change the scan interval for this addon (other than forking the repo myself and changing DEFAULT_SCAN_INTERVAL and MIN_SCAN_INTERVAL in const.py directly)?

Context:
Yesterday I upgraded my Nibe F470 from Nibe Uplink to myUplink and noticed that the resolution for e.g. the current sensors is around 10 - 15 seconds and I would like to utilize that instead of the default 1 - 5 min interval that this project has set so that I could calculate the electricity consumption at my house more accurately. Is there a technical reason for the interval to be that high initially btw e.g. to limit API request amount or something? On dev.myuplink.com I noticed this which doesn't sound too limiting to me:
The current limit for public API clients is one request every 4th second with occasional bursts allowed.

Screenshot 2024-04-14 at 15 00 28
@jaroschek
Copy link
Owner

The possible fastest way would be to edit the config entry directly.

The entry should be store in the following file in your HA instance: /config/.storage/core.config_entries

There you should find en entry with the domain myuplink that could look like the following:

      {
        "entry_id": "...",
        "version": 1,
        "minor_version": 1,
        "domain": "myuplink",
        "title": "Nibe",
        "data": {
          "auth_implementation": "myuplink_...",
          "token": {
            "access_token": "...",
            "expires_in": 3600,
            "token_type": "Bearer",
            "refresh_token": "...",
            "scope": "READSYSTEM WRITESYSTEM offline_access",
            "expires_at": 1713868041.2234557
          }
        },
        "options": {
          "scan_interval": 300
        },
        "pref_disable_new_entities": false,
        "pref_disable_polling": false,
        "source": "user",
        "unique_id": null,
        "disabled_by": null
      },

In this entry you can edit the value for scan_interval to any value in seconds you would like.

I will reduce (or remove) the lower limit of the config value in a future version.

@jaroschek
Copy link
Owner

jaroschek commented Apr 23, 2024

Unfortunately for @vesanieminen the config flow allows currently only values as low as 60 seconds.

But interesting ... this file is used in my local dev container for HA and in my production docker setup of HA. Are there other possible ways of storing core data?

@7RST1
Copy link
Contributor

7RST1 commented Apr 23, 2024

Unfortunately for @vesanieminen the config flow allows currently only values as low as 60 seconds.

[...] Are there other possible ways of storing core data?

Yeah, I realized that after posting.

No, you're right, I checked a new unused fresh separate instance of Hass by mistake.

This meaning i basically posted all misinformation, no substance, which is why i removed the post😅

@jaroschek
Copy link
Owner

@vesanieminen With the latest release it is now possible to configure the scan intervall to as low as 5 seconds:
1.2.4 https://github.com/jaroschek/home-assistant-myuplink/releases/tag/1.2.4

@vesanieminen
Copy link
Author

Awesome, thanks. I'll give it a test later today.

@vesanieminen
Copy link
Author

I tested this earlier, changed the value to 5 seconds, saw that for a while the values like the currents of the different phases updated multiple times a minute. After I updated HA to the latest version and restart the device the update frequency changed to 5 minutes. I did check the 5 second value is still there in /config/.storage/core.config_entries.
Also the data in myUplink has a higher resolution than 5 minutes. I wonder if myUplink is throttling the queries or something. I'll try to dig a bit more on this later.

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

3 participants