custom-components / sensor.nintendo_wishlist

A sensor that monitors a Nintendo Switch wish list for when games are on sale.
Apache License 2.0
17 stars 6 forks source link

In version 3, scan_interval can no longer be used. #10

Closed rjroch closed 4 years ago

rjroch commented 4 years ago

In the previous version that ran at the sensor: level, scan_interval could be added to the nintendo_wishlist sensor to control how frequently a scan is performed. Without the scan_interval defined, checks were run for sale items every 10 minutes. This seems excessive, as sales generally have a days-long duration.

In version 3, this configuration option is invalid. Please consider adding an option to set the interval for scans, as this frequency of scans generates a considerable amount of traffic.

boralyl commented 4 years ago

Thanks for reporting! I agree 10 minutes is way too often. I changed the default scan interval to 1 hour and added a new scan_interval configuration option. This is all in master and will be released tomorrow as v3.1.0.

rjroch commented 4 years ago

Thanks for taking the suggestion so quickly! However, after updating to 3.1.0 I've tried the scan_interval option you added/documented, and my HA tells me that it is an invalid option.

Logger: homeassistant.components.hassio
Source: components/hassio/__init__.py:300
Integration: Hass.io (documentation, issues)
First occurred: 2:43:26 PM (1 occurrences)
Last logged: 2:43:26 PM

Invalid config for [nintendo_wishlist]: [scan_interval] is an invalid option for [nintendo_wishlist]. Check: nintendo_wishlist->nintendo_wishlist->scan_interval. (See /config/configuration.yaml, line 343).

My configuration.yaml section is as follows:

nintendo_wishlist:
  country: US
  wishlist: !include switch_wishlist.yaml
  scan_interval:
    hours: 12

PS - I find using an !include for the wishlist itself, which works great, is a nice way to keep my config tidy. I have something like 50 titles on my wish list.

boralyl commented 4 years ago

Thanks for testing this out, I'll take a look tonight.

I'm working on a way to make it easier to test any custom component with automated tests to try to prevent this in the future, but it's not quite ready yet. So this fix I'll just do on the fly.

boralyl commented 4 years ago

Nice tip on the include!

I wasn't able to reproduce the error that you are seeing in your logs. I tried both with using an include on the wishlist and w/o it just in case that made a difference. I also tried copy/pasting your config exactly as is and also couldn't get it to complain about an invalid configuration.

I did however find another issue where the component was only updating on start. If you are still seeing the config validation error, could you try uninstalling the component and re-installing?

rjroch commented 4 years ago

I was able to get it working after uninstalling/reinstalling. Thanks again!