Set version sensor scan_interval?

Finally my HA 94.4 system seems to get the version sensor alright, and setting the logger to debug reveals this in a continuous circle:

2019-07-02 06:36:27 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-02 06:36:27 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-02 06:36:27 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-02 06:36:27 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-02 06:37:31 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-02 06:37:31 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-02 06:37:31 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-02 06:37:31 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-02 06:37:44 ERROR (SyncWorker_12) [homeassistant.components.waze_travel_time.sensor] Error on retrieving data: empty response
2019-07-02 06:38:36 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-02 06:38:36 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-02 06:38:36 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-02 06:38:36 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-02 06:39:41 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-02 06:39:41 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-02 06:39:42 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-02 06:39:42 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-02 06:40:46 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-02 06:40:46 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-02 06:40:46 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-02 06:40:46 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-02 06:41:13 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-02 06:41:13 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-02 06:41:14 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-02 06:41:14 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Hassio', 'beta': False, 'board': 'rpi3', 'image': 'raspberrypi3', 'hassos': '2.12', 'supervisor': '167', 'hassos-cli': '9'}

as you can see the bottom line follows the setup for available as I’ve configured it:

  - platform: version
    name: HA installed version

  - platform: version
    name: HA available version
#    beta: true
    image: raspberrypi3
    source: hassio

Any idea why it would use the other format for available as it does above on the other timings in this circle:

Secondly, could I set the scan_interval on these sensors, because scanning each and every minute is a bit much…

scan_interval: 14400 would suffice …

thanks.

1 Like

Well it may be possible to set scan_interval here:

However, it says:

These options are being phased out and are only available for single platform integrations.

So if they are being phased out then really I’m not sure if it will stop working in the future :frowning:

tried it for now, and, platform: version is a single platform integration? Not even sure what that means…

any thoughts on why the different feedback is given on the same sensor? I haven’t configured the source: PyPi sensor at all…

doesn’t work though, sensors are being polled each minute…

1 Like

You have something funky in your config.
it checks every 5min https://github.com/home-assistant/home-assistant/blob/23dd644f4a38d3d584d67d98820d26f80b9ebcda/homeassistant/components/version/sensor.py#L35

and unless you have defined pypi there it would not show.

well. I don’t… at least, not knowingly, and not here:

  - platform: version
    name: HA installed version

  - platform: version
    name: HA available version
#    beta: true
    image: raspberrypi3
    source: hassio

PyPi isn’t used for the source at all. Could this be done by another component?

I dod have this in the past:

#  - platform: rest
#    resource: https://pypi.python.org/pypi/homeassistant/json
#    name: HA upstream
#    value_template: >
#      {{ value_json.info.version }}
#    scan_interval: 28800

but that has been taken out ages ago…

Could be, but I doubt it.

This is the result I get with your posted config:

2019-07-02 07:00:06 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-02 07:00:06 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-02 07:00:06 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Hassio', 'beta': False, 'board': 'rpi3', 'image': 'raspberrypi3', 'hassos': '2.12', 'supervisor': '167', 'hassos-cli': '9'}
2019-07-02 07:05:13 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-02 07:05:13 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-02 07:05:13 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Hassio', 'beta': False, 'board': 'rpi3', 'image': 'raspberrypi3', 'hassos': '2.12', 'supervisor': '167', 'hassos-cli': '9'}

well, even without the first version sensor, I get the same mentions in the log.
Could HA itself initiate these PyPi lookups?
How can I find out which package in HA uses the PyPi package. Ive already set it to debug, maybe another component logger?

tried it for now, and, platform: version is a single platform integration? Not even sure what that means…

Really I’m not sure what it means either!

With older versions of HA you used to be able to set scan_interval in each sensors YAML, like this for example:

tp-link:
  switch:
  - host: 192.168.1.101
  scan_interval: 30

That would scan my tplink switch every 30 seconds.

But with more recent versions this feature has been changed or removed, so now setting scan_interval seems very difficult or impossible.

An example of how to set scan_interval if possible would be really nice. :slight_smile:

added both sensors to my second system. the exact same result, see below. Sensor for avialable is updated each 5 minutes, the others each minute (which is not as it should be). Moreover, I havent set Pypi to be the source, and, even without the sensor for installed version, both systems show the installed version sensor. an utter mystery:

ha on 94.4

019-07-03 15:38:38 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Hassio', 'beta': False, 'board': 'rpi3', 'image': 'raspberrypi3', 'hassos': '2.12', 'supervisor': '167', 'hassos-cli': '9'}
2019-07-03 15:39:17 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-03 15:39:17 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-03 15:39:18 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:39:18 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-03 15:40:22 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-03 15:40:22 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-03 15:40:22 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:40:22 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-03 15:41:25 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-03 15:41:25 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-03 15:41:25 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:41:25 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-03 15:42:29 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-03 15:42:29 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-03 15:42:29 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:42:29 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-03 15:43:33 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-03 15:43:33 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-03 15:43:33 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:43:33 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-03 15:43:46 DEBUG (MainThread) [pyhaversion] Version: 0.94.4
2019-07-03 15:43:46 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-03 15:43:48 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:43:48 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Hassio', 'beta': False, 'board': 'rpi3', 'image': 'raspberrypi3', 'hassos': '2.12', 'supervisor': '167', 'hassos-cli': '9'}

and ha on 95.4

2019-07-03 15:37:26 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Hassio', 'beta': False, 'board': 'rpi3', 'image': 'raspberrypi3', 'hassos': '2.12', 'supervisor': '167', 'hassos-cli': '9'}
2019-07-03 15:38:21 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:38:21 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-03 15:38:21 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:38:21 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-03 15:39:24 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:39:24 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-03 15:39:24 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:39:24 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-03 15:40:29 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:40:29 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-03 15:40:29 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:40:29 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-03 15:41:33 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:41:33 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-03 15:41:33 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:41:33 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'PyPi', 'beta': False}
2019-07-03 15:42:35 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:42:35 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Local'}
2019-07-03 15:42:36 DEBUG (MainThread) [pyhaversion] Version: 0.95.4
2019-07-03 15:42:36 DEBUG (MainThread) [pyhaversion] Version data: {'source': 'Hassio', 'beta': False, 'board': 'rpi3', 'image': 'raspberrypi3', 'hassos': '2.12', 'supervisor': '167', 'hassos-cli': '9'}

ill create a separate thread to catch the correct title using the Pypi, otherwise this might not get the traction it needs.

I’ll check out my logs when I can, at the moment I’ve got my logging set to ERROR, so I’ll have to set it to DEBUG for the version sensor so I can check what my scan_interval is.

I also use the GitHub sensor for release monitoring:

It’s a bit of a pain setting up the access token, but I find it works well.

I think the scan_interval of the github sensor is longer, maybe 15 mins, and occasionally I do get rate limited judging by the logs, but it works, and it may be worth trying if you need an alternative version sensor. :slight_smile:

EDIT: Here’s the YAML I’m using for the version sensor:

# The version sensor platform is displaying the
# available version online.
- platform: version
  name: version_available
  source: hassio
  image: raspberrypi3
# The version sensor platform is displaying the
# current version.
- platform: version
  name: version_current

I do get the current version of my system, there are other ways to get the current version also but they can be tricky, it involves the command line sensor I think.

Sure, I have those, but wanted to use the integrations straight out of the box.

Ive found the issue, as @ludeeus identified, it to be the breaking_changes integration causing the regular sensor: version to update each minute, instead of each 5 minutes.

Hoping that can be taken care of, and maybe add the option for scan_interval, since this is way too frequent.

As I have stated in the issue you created it does not change how that sensor works.
The logging you see is from the lib, not the sensor.

ok, I understand that, have just posted to the GitHub issue. It shows there is extra data traffic caused by the integration breaking_changes. I won’t mince words, because it doesn’t really matter, and I am not precise enough choosing them.

All I noticed is there’s an expected logging each 5 minutes without the breaking_changes integration, and with it, it sees loggin each minute, both for source: PyPi and source: local. source: PyPi would be because of the integration, but it also causes source: local to be logged.

without breaking_changes:

with breaking_changes:

this is with only breaking_changes installed, and sensor: version taken out:

and, just to be 100% sure, I’ve also tested without breaking_changes and sensor: version, to see if nothing else causes the logging, but that is not the case. Nothing showing up without them.